mirror of
https://github.com/fltk/fltk.git
synced 2026-05-21 14:31:40 +08:00
Fix for issue #159 - continued
Changes here concentrate the fix within static function alpha_blend() and thus are visible only when drawing transparent images under X11 platform without Xrender.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -658,13 +658,15 @@ static void alpha_blend(Fl_RGB_Image *img, int X, int Y, int W, int H, int cx, i
|
||||
int ld = img->ld();
|
||||
if (ld == 0) ld = img->data_w() * img->d();
|
||||
uchar *srcptr = (uchar*)img->array + cy * ld + cx * img->d();
|
||||
|
||||
uchar *dst = fl_read_image(NULL, X, Y, W, H, 0);
|
||||
if (!dst) {
|
||||
fl_draw_image(srcptr, X, Y, W, H, img->d(), ld);
|
||||
return;
|
||||
}
|
||||
int srcskip = ld - img->d() * W;
|
||||
|
||||
uchar *dst = new uchar[W * H * 3];
|
||||
uchar *dstptr = dst;
|
||||
|
||||
fl_read_image(dst, X, Y, W, H, 0);
|
||||
|
||||
uchar srcr, srcg, srcb, srca;
|
||||
uchar dstr, dstg, dstb, dsta;
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ uchar *fl_read_image(uchar *p, int X, int Y, int w, int h, int alpha) {
|
||||
img = Fl_Screen_Driver::traverse_to_gl_subwindows(Fl_Window::current(), X, Y, w, h, NULL);
|
||||
}
|
||||
int depth = alpha ? 4 : 3;
|
||||
if (img->d() != depth) {
|
||||
if (img && img->d() != depth) {
|
||||
uchar *data = new uchar[img->w() * img->h() * depth];
|
||||
if (depth == 4) memset(data, alpha, img->w() * img->h() * depth);
|
||||
uchar *d = data;
|
||||
|
||||
Reference in New Issue
Block a user