Author: AlbrechtS
Date: 2011-04-20 07:01:04 -0700 (Wed, 20 Apr 2011)
New Revision: 8611
Log:
Fixed alpha blending under X11 when line data size != 0 (STR #2606)


Modified:
   branches/branch-1.3/CHANGES
   branches/branch-1.3/src/Fl_Image.cxx

Modified: branches/branch-1.3/CHANGES
===================================================================
--- branches/branch-1.3/CHANGES 2011-04-20 13:45:35 UTC (rev 8610)
+++ branches/branch-1.3/CHANGES 2011-04-20 14:01:04 UTC (rev 8611)
@@ -146,6 +146,7 @@
 
          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).

Modified: branches/branch-1.3/src/Fl_Image.cxx
===================================================================
--- branches/branch-1.3/src/Fl_Image.cxx        2011-04-20 13:45:35 UTC (rev 
8610)
+++ branches/branch-1.3/src/Fl_Image.cxx        2011-04-20 14:01:04 UTC (rev 
8611)
@@ -379,8 +379,10 @@
 // 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 @@
 
   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++;

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to