Added SkinneableTheme::apply_gui_scale() member function.

This commit is contained in:
David Capello 2010-03-07 11:55:24 -02:00
parent 2d3cfe116b
commit dc19778ecc
2 changed files with 20 additions and 0 deletions

View File

@ -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; y<scaled->h; ++y)
for (int x=0; x<scaled->w; ++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)
{

View File

@ -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);