From 0ed1e8e0f0f29492a53f92bd222fb99e8d6030ae Mon Sep 17 00:00:00 2001 From: Lauri Kasanen Date: Thu, 4 Sep 2014 07:58:07 +0000 Subject: Small fix in the bilinear formula After consulting Gimp again, the formula was missing a final divide. This takes care of the 1:1 discrepancy. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10270 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_Image.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Fl_Image.cxx b/src/Fl_Image.cxx index 7d1643f56..08e539288 100644 --- a/src/Fl_Image.cxx +++ b/src/Fl_Image.cxx @@ -316,7 +316,6 @@ Fl_Image *Fl_RGB_Image::copy(int W, int H) { memcpy(downleft, array + dlefty * line_d + dleftx * d(), d()); memcpy(downright, array + drighty * line_d + drightx * d(), d()); - // TODO: how to check if it's premultiplied alpha? int i; if (d() == 4) { for (i = 0; i < 3; i++) { @@ -338,6 +337,12 @@ Fl_Image *Fl_RGB_Image::copy(int W, int H) { (downleft[i] * leftf + downright[i] * rightf) * downf; } + + if (d() == 4) { + for (i = 0; i < 3; i++) { + new_ptr[i] /= new_ptr[3] / 255.0f; + } + } } } } -- cgit v1.2.3