Changeset 2620


Ignore:
Timestamp:
08/01/08 00:02:34 (5 years ago)
Author:
sam
Message:
  • pixels.c: clamp pixels in the float32 -> rgba32 conversion to avoid artifacts.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libpipi/trunk/pipi/pixels.c

    r2616 r2620  
    9898 
    9999                    p = src[4 * (y * img->w + x) + i]; 
    100                     d = (int)(255.999 * pow(p, 1. / GAMMA)); 
     100 
     101                    if(p < 0.) d = 0.; 
     102                    else if(p > 1.) d = 255; 
     103                    else d = (int)(255.999 * pow(p, 1. / GAMMA)); 
     104 
    101105                    dest[4 * (y * img->w + x) + i] = d; 
    102106 
Note: See TracChangeset for help on using the changeset viewer.