diff --git a/src/modules/skinneable_theme.cpp b/src/modules/skinneable_theme.cpp index b8a9926fc..42d66a3f4 100644 --- a/src/modules/skinneable_theme.cpp +++ b/src/modules/skinneable_theme.cpp @@ -26,6 +26,7 @@ #include "loadpng.h" #include "ase_exception.h" #include "modules/skinneable_theme.h" +#include "modules/gui.h" #define CHARACTER_LENGTH(f, c) ((f)->vtable->char_length((f), (c))) @@ -1621,6 +1622,24 @@ void SkinneableTheme::less_bevel(int *bevel) if (bevel[3] > 0) --bevel[3]; } +BITMAP* SkinneableTheme::apply_gui_scale(BITMAP* original) +{ + int scale = guiscale(); + if (scale > 1) { + BITMAP* scaled = create_bitmap(original->w*scale, + original->h*scale); + + for (int y=0; yh; ++y) + for (int x=0; xw; ++x) + putpixel(scaled, x, y, getpixel(original, x/scale, y/scale)); + + destroy_bitmap(original); + return scaled; + } + else + return original; +} + /* controls the "X" button in a window to close it */ bool SkinneableTheme::theme_frame_button_msg_proc(JWidget widget, JMessage msg) { diff --git a/src/modules/skinneable_theme.h b/src/modules/skinneable_theme.h index 013a7c952..fd185d537 100644 --- a/src/modules/skinneable_theme.h +++ b/src/modules/skinneable_theme.h @@ -386,6 +386,7 @@ private: void draw_entry_cursor(JWidget widget, int x, int y); void draw_bevel_box(int x1, int y1, int x2, int y2, int c1, int c2, int *bevel); void less_bevel(int *bevel); + BITMAP* apply_gui_scale(BITMAP* original); static bool theme_frame_button_msg_proc(JWidget widget, JMessage msg); static bool theme_combobox_button_msg_proc(JWidget widget, JMessage msg);