Fixed alpha blending under X11 when line data size != 0 (STR #2606)

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8611 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Albrecht Schlosser 2011-04-20 14:01:04 +00:00
parent 2999acc1bb
commit 18628d428b
2 changed files with 5 additions and 3 deletions

View File

@ -146,6 +146,7 @@ CHANGES IN FLTK 1.3.0
Bug Fixes
- Fixed alpha blending under X11 when line data size != 0 (STR #2606)
- Fixed Fl_Tabs selection border drawing, if tabs are at the bottom
of the widget (STR #2480)
- Fixed Compiling with mingw-w64 (STR #2308).

View File

@ -379,8 +379,10 @@ void Fl_RGB_Image::desaturate() {
// Composite an image with alpha on systems that don't have accelerated
// alpha compositing...
static void alpha_blend(Fl_RGB_Image *img, int X, int Y, int W, int H, int cx, int cy) {
uchar *srcptr = (uchar*)img->array + img->d() * (img->w() * cy + cx);
int srcskip = img->d() * (img->w() - W);
int ld = img->ld();
if (ld == 0) ld = img->w() * img->d();
uchar *srcptr = (uchar*)img->array + cy * ld + cx * img->d();
int srcskip = ld - img->d() * W;
uchar *dst = new uchar[W * H * 3];
uchar *dstptr = dst;
@ -392,7 +394,6 @@ static void alpha_blend(Fl_RGB_Image *img, int X, int Y, int W, int H, int cx, i
if (img->d() == 2) {
// Composite grayscale + alpha over RGB...
// Composite RGBA over RGB...
for (int y = H; y > 0; y--, srcptr+=srcskip)
for (int x = W; x > 0; x--) {
srcg = *srcptr++;