Skip to content

Commit

Permalink
Small fix in the bilinear formula
Browse files Browse the repository at this point in the history
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
  • Loading branch information
clbr committed Sep 4, 2014
1 parent e521c16 commit 0ed1e8e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Fl_Image.cxx
Expand Up @@ -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++) {
Expand All @@ -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;
}
}
}
}
}
Expand Down

0 comments on commit 0ed1e8e

Please sign in to comment.