summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2011-04-20 14:01:04 +0000
committerAlbrecht Schlosser <albrechts.fltk@online.de>2011-04-20 14:01:04 +0000
commit18628d428b46148957f558df79b1869723be274a (patch)
treeecd1d6104737a7e4e178714760905cd1ad9af7ad /src
parent2999acc1bb349205e72a3ce54be58c6d1b67fbd0 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Image.cxx7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Fl_Image.cxx b/src/Fl_Image.cxx
index 985e09212..1c37489a9 100644
--- a/src/Fl_Image.cxx
+++ b/src/Fl_Image.cxx
@@ -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++;