Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/render/render_internal.c')
-rw-r--r--source/blender/editors/render/render_internal.c57
1 files changed, 12 insertions, 45 deletions
diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c
index 8a580627da3..bff93fea067 100644
--- a/source/blender/editors/render/render_internal.c
+++ b/source/blender/editors/render/render_internal.c
@@ -76,10 +76,10 @@
/* called inside thread! */
void image_buffer_rect_update(Scene *scene, RenderResult *rr, ImBuf *ibuf, volatile rcti *renrect)
{
- float x1, y1, *rectf= NULL;
+ float *rectf= NULL;
int ymin, ymax, xmin, xmax;
- int rymin, rxmin, do_color_management;
- char *rectc;
+ int rymin, rxmin, predivide, profile_from;
+ unsigned char *rectc;
/* if renrect argument, we only refresh scanlines */
if(renrect) {
@@ -136,50 +136,17 @@ void image_buffer_rect_update(Scene *scene, RenderResult *rr, ImBuf *ibuf, volat
imb_addrectImBuf(ibuf);
rectf+= 4*(rr->rectx*ymin + xmin);
- rectc= (char *)(ibuf->rect + ibuf->x*rymin + rxmin);
+ rectc= (unsigned char*)(ibuf->rect + ibuf->x*rymin + rxmin);
- do_color_management = (scene && (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT));
-
- /* XXX make nice consistent functions for this */
- for(y1= 0; y1<ymax; y1++) {
- float *rf= rectf;
- float srgb[3];
- char *rc= rectc;
- const float dither = ibuf->dither / 255.0f;
-
- /* XXX temp. because crop offset */
- if(rectc >= (char *)(ibuf->rect)) {
- for(x1= 0; x1<xmax; x1++, rf += 4, rc+=4) {
- /* color management */
- if(do_color_management) {
- srgb[0]= linearrgb_to_srgb(rf[0]);
- srgb[1]= linearrgb_to_srgb(rf[1]);
- srgb[2]= linearrgb_to_srgb(rf[2]);
- }
- else {
- copy_v3_v3(srgb, rf);
- }
-
- /* dither */
- if(dither != 0.0f) {
- const float d = (BLI_frand()-0.5f)*dither;
-
- srgb[0] += d;
- srgb[1] += d;
- srgb[2] += d;
- }
-
- /* write */
- rc[0]= FTOCHAR(srgb[0]);
- rc[1]= FTOCHAR(srgb[1]);
- rc[2]= FTOCHAR(srgb[2]);
- rc[3]= FTOCHAR(rf[3]);
- }
- }
+ if(scene && (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT))
+ profile_from= IB_PROFILE_LINEAR_RGB;
+ else
+ profile_from= IB_PROFILE_SRGB;
+ predivide= 0;
- rectf += 4*rr->rectx;
- rectc += 4*ibuf->x;
- }
+ IMB_buffer_byte_from_float(rectc, rectf,
+ 4, ibuf->dither, IB_PROFILE_SRGB, profile_from, predivide,
+ xmax, ymax, ibuf->x, rr->rectx);
}
/* ****************************** render invoking ***************** */