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
This commit is contained in:
Lauri Kasanen 2014-09-04 07:58:07 +00:00
parent e521c16ab3
commit 0ed1e8e0f0
1 changed files with 6 additions and 1 deletions

View File

@ -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;
}
}
}
}
}