diff --git a/src/jinete/jtheme.cpp b/src/jinete/jtheme.cpp index cda1842e9..2a17553b5 100644 --- a/src/jinete/jtheme.cpp +++ b/src/jinete/jtheme.cpp @@ -171,6 +171,25 @@ int ji_color_background() return ji_current_theme->color_background(); } +BITMAP* ji_apply_guiscale(BITMAP* original) +{ + int scale = jguiscale(); + if (scale > 1) { + BITMAP* scaled = create_bitmap_ex(bitmap_color_depth(original), + 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; +} + void _ji_theme_draw_sprite_color(BITMAP *bmp, BITMAP *sprite, int x, int y, int color) { diff --git a/src/jinete/jtheme.h b/src/jinete/jtheme.h index fa127b924..486e370ad 100644 --- a/src/jinete/jtheme.h +++ b/src/jinete/jtheme.h @@ -106,6 +106,8 @@ int ji_color_hotface(); int ji_color_selected(); int ji_color_background(); +BITMAP* ji_apply_guiscale(BITMAP* original); + // This value is a factor to multiply every screen size/coordinate. // Every icon/graphics/font should be scaled to this factor. inline int jguiscale() diff --git a/src/modules/skinneable_theme.cpp b/src/modules/skinneable_theme.cpp index cbb6591d8..40c094eca 100644 --- a/src/modules/skinneable_theme.cpp +++ b/src/modules/skinneable_theme.cpp @@ -388,7 +388,7 @@ void SkinneableTheme::regen() draw_trans_sprite(m_part[c], m_sheet_bmp, -sheet_info[c].x, -sheet_info[c].y); set_trans_blender(0, 0, 0, 0); - m_part[c] = apply_gui_scale(m_part[c]); + m_part[c] = ji_apply_guiscale(m_part[c]); } // Load tool icons @@ -425,7 +425,7 @@ void SkinneableTheme::regen() // Add the tool-icon in the map if (m_toolicon[tool_id]) destroy_bitmap(m_toolicon[tool_id]); - m_toolicon[tool_id] = apply_gui_scale(toolicon); + m_toolicon[tool_id] = ji_apply_guiscale(toolicon); xmlIcon = xmlIcon->NextSiblingElement(); } @@ -1692,24 +1692,6 @@ void SkinneableTheme::less_bevel(int *bevel) if (bevel[3] > 0) --bevel[3]; } -BITMAP* SkinneableTheme::apply_gui_scale(BITMAP* original) -{ - int scale = jguiscale(); - 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 b38a52bce..ab4dd6a35 100644 --- a/src/modules/skinneable_theme.h +++ b/src/modules/skinneable_theme.h @@ -396,7 +396,6 @@ 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);