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:
authorXavier Thomas <xavier.thomas.1980@gmail.com>2010-06-04 00:25:00 +0400
committerXavier Thomas <xavier.thomas.1980@gmail.com>2010-06-04 00:25:00 +0400
commita87dbe03e71c121f2bb985aa98bdc218b400f990 (patch)
tree41f61034b51c4910853ce00b58df03fe3ad328a8 /source/blender/editors/space_image/image_ops.c
parentb9cb3c91a88bce6b9770617f2caf313ceda9c468 (diff)
Made the sample line tool of the image editor use color management if needed.
Diffstat (limited to 'source/blender/editors/space_image/image_ops.c')
-rw-r--r--source/blender/editors/space_image/image_ops.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 64d24ed578a..8b8b3b11324 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -1663,6 +1663,7 @@ static int sample_line_exec(bContext *C, wmOperator *op)
{
SpaceImage *sima= CTX_wm_space_image(C);
ARegion *ar= CTX_wm_region(C);
+ Scene *scene= CTX_data_scene(C);
int x_start= RNA_int_get(op->ptr, "xstart");
int y_start= RNA_int_get(op->ptr, "ystart");
@@ -1677,6 +1678,7 @@ static int sample_line_exec(bContext *C, wmOperator *op)
int x1, y1, x2, y2;
int i, x, y;
float *fp;
+ float rgb[3];
unsigned char *cp;
if (ibuf == NULL) {
@@ -1710,10 +1712,16 @@ static int sample_line_exec(bContext *C, wmOperator *op)
} else {
if (ibuf->rect_float) {
fp= (ibuf->rect_float + (ibuf->channels)*(y*ibuf->x + x));
- hist->data_r[i] = fp[0];
- hist->data_g[i] = fp[1];
- hist->data_b[i] = fp[2];
- hist->data_luma[i] = (0.299f*fp[0] + 0.587f*fp[1] + 0.114f*fp[2]);
+
+ if (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT)
+ linearrgb_to_srgb_v3_v3(rgb, fp);
+ else
+ copy_v3_v3(rgb, fp);
+
+ hist->data_r[i] = rgb[0];
+ hist->data_g[i] = rgb[1];
+ hist->data_b[i] = rgb[2];
+ hist->data_luma[i] = (0.299f*rgb[0] + 0.587f*rgb[1] + 0.114f*rgb[2]);
}
else if (ibuf->rect) {
cp= (unsigned char *)(ibuf->rect + y*ibuf->x + x);