Color Management: remove unused function and get rid of unneeded float->byte conversion

This commit is contained in:
Sergey Sharybin 2012-10-15 07:47:38 +00:00
parent 27564ed24a
commit abff7cac7e
4 changed files with 8 additions and 64 deletions

View File

@ -88,7 +88,6 @@ int curvemapping_RGBA_does_something(const struct CurveMapping *
void curvemapping_table_RGBA(const struct CurveMapping *cumap, float **array, int *size);
/* non-const, these modify the curve */
void curvemapping_do_ibuf(struct CurveMapping *cumap, struct ImBuf *ibuf);
void curvemapping_premultiply(struct CurveMapping *cumap, int restore);

View File

@ -835,64 +835,6 @@ void curvemapping_evaluate_premulRGB(const CurveMapping *cumap, unsigned char ve
vecout_byte[2] = FTOCHAR(vecout[2]);
}
/* only used for image editor curves */
void curvemapping_do_ibuf(CurveMapping *cumap, ImBuf *ibuf)
{
ImBuf *tmpbuf;
int pixel;
float *pix_in;
float col[3];
int stride = 4;
float *pix_out;
if (ibuf == NULL)
return;
if (ibuf->rect_float == NULL)
IMB_float_from_rect(ibuf);
else if (ibuf->rect == NULL)
imb_addrectImBuf(ibuf);
if (!ibuf->rect || !ibuf->rect_float)
return;
/* work on a temp buffer, so can color manage afterwards.
* No worse off memory wise than comp nodes */
tmpbuf = IMB_dupImBuf(ibuf);
curvemapping_premultiply(cumap, 0);
pix_in = ibuf->rect_float;
pix_out = tmpbuf->rect_float;
if (ibuf->channels)
stride = ibuf->channels;
for (pixel = ibuf->x * ibuf->y; pixel > 0; pixel--, pix_in += stride, pix_out += stride) {
if (stride < 3) {
col[0] = curvemap_evaluateF(cumap->cm, *pix_in);
pix_out[1] = pix_out[2] = pix_out[3] = pix_out[0] = col[0];
}
else {
curvemapping_evaluate_premulRGBF(cumap, col, pix_in);
pix_out[0] = col[0];
pix_out[1] = col[1];
pix_out[2] = col[2];
if (stride > 3)
pix_out[3] = pix_in[3];
else
pix_out[3] = 1.f;
}
}
IMB_rect_from_float(tmpbuf);
SWAP(unsigned int *, tmpbuf->rect, ibuf->rect);
IMB_freeImBuf(tmpbuf);
curvemapping_premultiply(cumap, 1);
}
int curvemapping_RGBA_does_something(const CurveMapping *cumap)
{
int a;

View File

@ -1494,7 +1494,8 @@ ImBuf *BKE_tracking_distortion_exec(MovieDistortion *distortion, MovieTracking *
ibuf->x, ibuf->y, overscan, ibuf->channels);
}
resibuf->userflags |= IB_RECT_INVALID;
if (ibuf->rect)
imb_freerectImBuf(ibuf);
}
else {
if (undistort) {
@ -1512,9 +1513,8 @@ ImBuf *BKE_tracking_distortion_exec(MovieDistortion *distortion, MovieTracking *
(void) overscan;
(void) undistort;
if (ibuf->rect_float) {
resibuf->userflags |= IB_RECT_INVALID;
}
if (ibuf->rect_float && ibuf->rect)
imb_freerectImBuf(ibuf);
#endif
return resibuf;

View File

@ -184,7 +184,10 @@ static void rna_Image_update(Image *image, ReportList *reports)
return;
}
IMB_rect_from_float(ibuf);
if (ibuf->rect)
IMB_rect_from_float(ibuf);
ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID;
}
static void rna_Image_scale(Image *image, ReportList *reports, int width, int height)