mirror of
https://github.com/fltk/fltk.git
synced 2026-05-21 14:31:40 +08:00
Fix for issue #155 - continued
This fix takes care of the Windows platform.
This commit is contained in:
@@ -535,18 +535,22 @@ void Fl_GDI_Graphics_Driver::draw_rgb(Fl_RGB_Image *rgb, int XP, int YP, int WP,
|
||||
if (!*Fl_Graphics_Driver::id(rgb)) {
|
||||
cache(rgb);
|
||||
}
|
||||
float scaleW = float(rgb->data_w())/rgb->w();
|
||||
float scaleH = float(rgb->data_h())/rgb->h();
|
||||
int W = WP, H = HP;
|
||||
cache_size(rgb, W, H);
|
||||
int Wfull = rgb->w(), Hfull = rgb->h();
|
||||
cache_size(rgb, Wfull, Hfull);
|
||||
HDC new_gc = CreateCompatibleDC(gc_);
|
||||
int save = SaveDC(new_gc);
|
||||
SelectObject(new_gc, (HBITMAP)*Fl_Graphics_Driver::id(rgb));
|
||||
Wfull = W*(rgb->data_w()/float(Wfull)); Hfull = H*(rgb->data_h()/float(Hfull));
|
||||
cx *= scale(); cy *= scale();
|
||||
if (cx+Wfull > rgb->data_w()) Wfull = rgb->data_w()-cx;
|
||||
if (cy+Hfull > rgb->data_h()) Hfull = rgb->data_h()-cy;
|
||||
if ( (rgb->d() % 2) == 0 ) {
|
||||
alpha_blend_(XP*scale(), YP*scale(), W, H, new_gc, cx*scaleW, cy*scaleH, WP*scaleW, HP*scaleH);
|
||||
alpha_blend_(XP*scale(), YP*scale(), W, H, new_gc, cx, cy, Wfull, Hfull);
|
||||
} else {
|
||||
SetStretchBltMode(gc_, HALFTONE);
|
||||
StretchBlt(gc_, XP*scale(), YP*scale(), W, H, new_gc, cx*scaleW, cy*scaleH, WP*scaleW, HP*scaleH, SRCCOPY);
|
||||
StretchBlt(gc_, XP*scale(), YP*scale(), W, H, new_gc, cx, cy, Wfull, Hfull, SRCCOPY);
|
||||
}
|
||||
RestoreDC(new_gc, save);
|
||||
DeleteDC(new_gc);
|
||||
|
||||
Reference in New Issue
Block a user