Browse Source

* pixels.c: clamp pixels in the float32 -> rgba32 conversion to avoid

artifacts.

git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/libpipi/trunk@2620 92316355-f0b4-4df1-b90c-862c8a59935f
remotes/tiles
sam 16 years ago
parent
commit
caba836e5d
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      pipi/pixels.c

+ 5
- 1
pipi/pixels.c View File

@@ -97,7 +97,11 @@ pipi_pixels_t *pipi_getpixels(pipi_image_t *img, pipi_format_t type)
uint8_t d;

p = src[4 * (y * img->w + x) + i];
d = (int)(255.999 * pow(p, 1. / GAMMA));

if(p < 0.) d = 0.;
else if(p > 1.) d = 255;
else d = (int)(255.999 * pow(p, 1. / GAMMA));

dest[4 * (y * img->w + x) + i] = d;

e = p - u8tof32(d);


Loading…
Cancel
Save