add option to toggle filtering

This commit is contained in:
StapleButter 2017-12-07 02:50:05 +01:00
parent 18bcefe83b
commit e4f030149b
6 changed files with 18 additions and 5 deletions

View File

@ -35,6 +35,7 @@ int ScreenRotation;
int ScreenGap;
int ScreenLayout;
int ScreenSizing;
int ScreenFilter;
int DirectBoot;
@ -88,6 +89,7 @@ ConfigEntry ConfigFile[] =
{"ScreenGap", 0, &ScreenGap, 0, NULL, 0},
{"ScreenLayout", 0, &ScreenLayout, 0, NULL, 0},
{"ScreenSizing", 0, &ScreenSizing, 0, NULL, 0},
{"ScreenFilter", 0, &ScreenFilter, 1, NULL, 0},
{"DirectBoot", 0, &DirectBoot, 1, NULL, 0},

View File

@ -37,6 +37,7 @@ extern int ScreenRotation;
extern int ScreenGap;
extern int ScreenLayout;
extern int ScreenSizing;
extern int ScreenFilter;
extern int DirectBoot;

View File

@ -505,7 +505,7 @@ _UI_EXTERN void uiDrawRestore(uiDrawContext *c);
// bitmap API
_UI_EXTERN uiDrawBitmap* uiDrawNewBitmap(uiDrawContext* c, int width, int height);
_UI_EXTERN void uiDrawBitmapUpdate(uiDrawBitmap* bmp, const void* data);
_UI_EXTERN void uiDrawBitmapDraw(uiDrawContext* c, uiDrawBitmap* bmp, uiRect* srcrect, uiRect* dstrect, bool filter);
_UI_EXTERN void uiDrawBitmapDraw(uiDrawContext* c, uiDrawBitmap* bmp, uiRect* srcrect, uiRect* dstrect, int filter);
_UI_EXTERN void uiDrawFreeBitmap(uiDrawBitmap* bmp);
// TODO manage the use of Text, Font, and TextFont, and of the uiDrawText prefix in general

View File

@ -185,7 +185,7 @@ void uiDrawBitmapUpdate(uiDrawBitmap* bmp, const void* data)
cairo_surface_mark_dirty(bmp->bmp);
}
void uiDrawBitmapDraw(uiDrawContext* c, uiDrawBitmap* bmp, uiRect* srcrect, uiRect* dstrect, bool filter)
void uiDrawBitmapDraw(uiDrawContext* c, uiDrawBitmap* bmp, uiRect* srcrect, uiRect* dstrect, int filter)
{
cairo_save(c->cr);
cairo_rectangle(c->cr, dstrect->X, dstrect->Y, dstrect->Width, dstrect->Height);

View File

@ -555,7 +555,7 @@ void uiDrawBitmapUpdate(uiDrawBitmap* bmp, const void* data)
bmp->bmp->CopyFromMemory(&rekt, data, bmp->Stride);
}
void uiDrawBitmapDraw(uiDrawContext* c, uiDrawBitmap* bmp, uiRect* srcrect, uiRect* dstrect, bool filter)
void uiDrawBitmapDraw(uiDrawContext* c, uiDrawBitmap* bmp, uiRect* srcrect, uiRect* dstrect, int filter)
{
D2D_RECT_F _srcrect = D2D1::RectF(srcrect->X, srcrect->Y, srcrect->X+srcrect->Width, srcrect->Y+srcrect->Height);
D2D_RECT_F _dstrect = D2D1::RectF(dstrect->X, dstrect->Y, dstrect->X+dstrect->Width, dstrect->Y+dstrect->Height);

View File

@ -310,12 +310,12 @@ void OnAreaDraw(uiAreaHandler* handler, uiArea* area, uiAreaDrawParams* params)
uiDrawSave(params->Context);
uiDrawTransform(params->Context, &TopScreenTrans);
uiDrawBitmapDraw(params->Context, ScreenBitmap, &top, &TopScreenRect);
uiDrawBitmapDraw(params->Context, ScreenBitmap, &top, &TopScreenRect, Config::ScreenFilter==1);
uiDrawRestore(params->Context);
uiDrawSave(params->Context);
uiDrawTransform(params->Context, &BottomScreenTrans);
uiDrawBitmapDraw(params->Context, ScreenBitmap, &bot, &BottomScreenRect);
uiDrawBitmapDraw(params->Context, ScreenBitmap, &bot, &BottomScreenRect, Config::ScreenFilter==1);
uiDrawRestore(params->Context);
}
@ -937,6 +937,13 @@ void OnSetScreenSizing(uiMenuItem* item, uiWindow* window, void* param)
uiMenuItemSetChecked(MenuItem_ScreenSizing[i], i==ScreenSizing);
}
void OnSetScreenFiltering(uiMenuItem* item, uiWindow* window, void* blarg)
{
int chk = uiMenuItemChecked(item);
if (chk != 0) Config::ScreenFilter = 1;
else Config::ScreenFilter = 0;
}
void ApplyNewSettings()
{
@ -1101,6 +1108,9 @@ int main(int argc, char** argv)
uiMenuAppendSubmenu(menu, submenu);
}
menuitem = uiMenuAppendCheckItem(menu, "Screen filtering");
uiMenuItemOnClicked(menuitem, OnSetScreenFiltering, NULL);
uiMenuItemSetChecked(menuitem, Config::ScreenFilter==1);
uiMenuItemSetChecked(MenuItem_ScreenRot[ScreenRotation], 1);
uiMenuItemSetChecked(MenuItem_ScreenGap[ScreenGap], 1);