summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLauri Kasanen <cand@gmx.com>2014-09-04 07:58:07 +0000
committerLauri Kasanen <cand@gmx.com>2014-09-04 07:58:07 +0000
commit0ed1e8e0f0f29492a53f92bd222fb99e8d6030ae (patch)
tree646757243c21f7870414fe91fbd2efe195e2ed45 /src
parente521c16ab3b4350ee38e41e2be74005c1db8757b (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Image.cxx7
1 files changed, 6 insertions, 1 deletions
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;
+ }
+ }
}
}
}