Bugfix: Icons were drawing on wrong subpixel positions, distorting
badly. Now it's crispy and tasty!

Noticed there's a magnifier icon already, using it for the search
option.
This commit is contained in:
Ton Roosendaal 2009-06-04 15:19:48 +00:00
parent 59333375b3
commit 33b0ba4a76
3 changed files with 14 additions and 13 deletions

@ -630,7 +630,8 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
static void widget_draw_icon(uiBut *but, BIFIconID icon, int blend, rcti *rect)
{
float xs=0, ys=0, aspect, height;
int xs=0, ys=0;
float aspect, height;
/* this icon doesn't need draw... */
if(icon==ICON_BLANK1 && (but->flag & UI_ICON_SUBMENU)==0) return;
@ -663,33 +664,33 @@ static void widget_draw_icon(uiBut *but, BIFIconID icon, int blend, rcti *rect)
if(but->flag & UI_ICON_LEFT) {
if (but->type==BUT_TOGDUAL) {
if (but->drawstr[0]) {
xs= rect->xmin-1.0;
xs= rect->xmin-1;
} else {
xs= (rect->xmin+rect->xmax- height)/2.0;
xs= (rect->xmin+rect->xmax- height)/2;
}
}
else if (but->block->flag & UI_BLOCK_LOOP) {
xs= rect->xmin+1.0;
xs= rect->xmin+1;
}
else if ((but->type==ICONROW) || (but->type==ICONTEXTROW)) {
xs= rect->xmin+3.0;
xs= rect->xmin+3;
}
else {
xs= rect->xmin+4.0;
xs= rect->xmin+4;
}
ys= (rect->ymin+rect->ymax- height)/2.0;
ys= (rect->ymin+rect->ymax- height)/2;
}
else {
xs= (rect->xmin+rect->xmax- height)/2.0;
ys= (rect->ymin+rect->ymax- height)/2.0;
xs= (rect->xmin+rect->xmax- height)/2;
ys= (rect->ymin+rect->ymax- height)/2;
}
UI_icon_draw_aspect_blended(xs, ys, icon, aspect, blend);
}
if(but->flag & UI_ICON_SUBMENU) {
xs= rect->xmax-17.0;
ys= (rect->ymin+rect->ymax- height)/2.0;
xs= rect->xmax-17;
ys= (rect->ymin+rect->ymax- height)/2;
UI_icon_draw_aspect_blended(xs, ys, ICON_RIGHTARROW_THIN, aspect, blend);
}

@ -489,7 +489,7 @@ void info_header_buttons(const bContext *C, ARegion *ar)
{
static char search[256]= "";
uiBut *but= uiDefSearchBut(block, search, 0, ICON_PROP_ON, 256, xco+5, yco, 120, 19, "");
uiBut *but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, 256, xco+5, yco, 120, 19, "");
uiButSetSearchFunc(but, operator_search_cb, NULL, operator_call_cb);

@ -420,7 +420,7 @@ static uiBlock *wm_block_search_menu(bContext *C, ARegion *ar, void *arg_op)
block= uiBeginBlock(C, ar, "_popup", UI_EMBOSS);
uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_RET_1);
but= uiDefSearchBut(block, search, 0, ICON_PROP_ON, 256, 10, 10, 180, 19, "");
but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, 256, 10, 10, 180, 19, "");
uiButSetSearchFunc(but, operator_search_cb, NULL, operator_call_cb);
uiPopupBoundsBlock(block, 0.0f, 0, -20); /* move it downwards, mouse over button */