DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR Active]

Link: http://www.fltk.org/str.php?L2606
Version: 1.3-current


Thanks for the report and the patch.

I changed it a little to support positive ld() values other than w()*d()
as well. I tested it by modifying test/unittest_images.cxx and found no
problems.

Please test attached patch fltk_alpha_blend_2.patch and report whether
this fixes your problem.


Link: http://www.fltk.org/str.php?L2606
Version: 1.3-current
Index: src/Fl_Image.cxx
===================================================================
--- src/Fl_Image.cxx    (revision 8592)
+++ src/Fl_Image.cxx    (working copy)
@@ -379,9 +379,16 @@
 // 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;
+  if (ld < 0)
+    srcptr -= ld * (img->h()-1);
+  srcptr += cy * ld + cx * img->d();
 
+  int srcskip = ld - img->d() * W;
+
   uchar *dst = new uchar[W * H * 3];
   uchar *dstptr = dst;
 
@@ -392,7 +399,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-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-bugs

Reply via email to