Hello community, here is the log from the commit of package mgp for openSUSE:Factory checked in at 2016-05-25 21:28:14 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/mgp (Old) and /work/SRC/openSUSE:Factory/.mgp.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "mgp" Changes: -------- --- /work/SRC/openSUSE:Factory/mgp/mgp.changes 2016-05-23 16:39:06.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.mgp.new/mgp.changes 2016-05-25 21:28:22.000000000 +0200 @@ -1,0 +2,7 @@ +Mon May 23 16:06:14 CEST 2016 - ti...@suse.de + +- Fix the incomplete previous patch for the alpha channel + (boo#980768): + mgp-alpha-channel.diff + +------------------------------------------------------------------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ mgp-alpha-channel.diff ++++++ --- /var/tmp/diff_new_pack.huyWWm/_old 2016-05-25 21:28:23.000000000 +0200 +++ /var/tmp/diff_new_pack.huyWWm/_new 2016-05-25 21:28:23.000000000 +0200 @@ -1,13 +1,27 @@ --- - draw.c | 41 ++++++++++++++++++++++++++++-- + draw.c | 35 +++++++++++++++++++++++++- image/image.h | 1 image/new.c | 4 ++ image/zoom.c | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++------ - 4 files changed, 113 insertions(+), 11 deletions(-) + 4 files changed, 109 insertions(+), 9 deletions(-) --- a/draw.c +++ b/draw.c -@@ -1980,6 +1980,7 @@ obj_image_trans(image, x, y) +@@ -1966,6 +1966,13 @@ obj_image_color(image, bimage, d, inithi + return i; + } + ++static Pixel impose_pixel(Pixel fore, Pixel back, byte a) ++{ ++ return RGB_TO_TRUE(TRUE_RED(fore) * a + TRUE_RED(back) * (255 - a), ++ TRUE_GREEN(fore) * a + TRUE_GREEN(back) * (255 - a), ++ TRUE_BLUE(fore) * a + TRUE_BLUE(back) * (255 - a)); ++} ++ + static Image * + obj_image_trans(image, x, y) + Image *image; +@@ -1980,6 +1987,7 @@ obj_image_trans(image, x, y) int trans; u_int bw, bh, bx, by; int inithist; @@ -15,35 +29,27 @@ if (!COMPLEX_BGIMAGE) { if (back_color[caching] != xcol.pixel) { -@@ -1995,10 +1996,25 @@ obj_image_trans(image, x, y) - image->rgb.blue[image->trans] = xcol.blue; - break; - case ITRUE: -- d = image->trans; -- n = RGB_TO_TRUE(xcol.red, xcol.green, xcol.blue); +@@ -1999,6 +2007,19 @@ obj_image_trans(image, x, y) + n = RGB_TO_TRUE(xcol.red, xcol.green, xcol.blue); pl = image->pixlen; p = image->data; + if (image->alpha) { + alpha = image->alpha; + for (j = 0; j < image->height; j++) { + for (i = 0; i < image->width; i++, p += pl) { -+ byte a = *alpha++ - 255; -+ if (!a) ++ byte a = *alpha++; ++ if (a == 255) + continue; -+ n = RGB_TO_TRUE(xcol.red * a / 255, -+ xcol.green * a / 255, -+ xcol.blue * a / 255); -+ valToMem(n, p, pl); ++ d = impose_pixel(memToVal(p, pl), n, a); ++ valToMem(d, p, pl); + } + } + break; + } -+ d = image->trans; -+ n = RGB_TO_TRUE(xcol.red, xcol.green, xcol.blue); for (j = 0; j < image->height; j++) { for (i = 0; i < image->width; i++, p += pl) { if (memToVal(p, pl) == d) -@@ -2024,6 +2040,8 @@ obj_image_trans(image, x, y) +@@ -2024,6 +2045,8 @@ obj_image_trans(image, x, y) } pl = image->pixlen; p = image->data + image->width * j * pl; @@ -52,31 +58,24 @@ bpl = bgpixmap[bgindex].image->pixlen; pd = -1; n = 0; /* for lint */ -@@ -2040,6 +2058,23 @@ obj_image_trans(image, x, y) +@@ -2040,6 +2063,16 @@ obj_image_trans(image, x, y) b = bgpixmap[bgindex].image->data + bgpixmap[bgindex].image->width * by * bpl; } + if (alpha) { + byte a = *alpha++; -+ int n, v; + if (a == 255) + continue; -+ n = memToVal(p, pl); -+ d = memToVal(b, bpl); -+ v = RGB_TO_TRUE((TRUE_RED(n) * a + -+ TRUE_RED(d) * (255 - a)) / 255, -+ (TRUE_GREEN(n) * a + -+ TRUE_RED(d) * (255 - a)) / 255, -+ (TRUE_BLUE(n) * a + -+ TRUE_BLUE(d) * (255 - a)) / 255); -+ valToMem(v, p, pl); ++ d = impose_pixel(memToVal(p, pl), ++ memToVal(b, bpl), a); ++ valToMem(d, p, pl); + continue; + } + if (memToVal(p, pl) != trans) continue; d = memToVal(b, bpl); -@@ -2099,7 +2134,7 @@ obj_draw_image(target, x, y, obj, page) +@@ -2099,7 +2132,7 @@ obj_draw_image(target, x, y, obj, page) } freeImage(timage); } @@ -202,8 +201,8 @@ + a[3] = alpha2[x2]; + } + -+ *adest++ = (a[0] * (1 - xoff) + a[1] * xoff) * (1 - yoff) + -+ (a[2] * (1 - xoff) + a[3] * xoff) * yoff; ++ *adest++ = (byte)((a[0] * (1 - xoff) + a[1] * xoff) * (1 - yoff) + ++ (a[2] * (1 - xoff) + a[3] * xoff) * yoff); + } + cx += xstep;