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')
-rw-r--r--source/blender/editors/include/BIF_glutil.h5
-rw-r--r--source/blender/editors/render/render_internal.c9
-rw-r--r--source/blender/editors/render/render_preview.c27
-rw-r--r--source/blender/editors/screen/glutil.c24
-rw-r--r--source/blender/editors/space_image/image_buttons.c4
-rw-r--r--source/blender/editors/space_node/space_node.c4
6 files changed, 34 insertions, 39 deletions
diff --git a/source/blender/editors/include/BIF_glutil.h b/source/blender/editors/include/BIF_glutil.h
index cd3d87a8979..33e9192a23e 100644
--- a/source/blender/editors/include/BIF_glutil.h
+++ b/source/blender/editors/include/BIF_glutil.h
@@ -136,13 +136,8 @@ void glaDrawPixelsSafe (float x, float y, int img_w, int img_h, int row_w, int
* is expected to be in RGBA byte or float format, and the
* modelview and projection matrices are assumed to define a
* 1-to-1 mapping to screen space.
- * @param gamma_correct Optionally gamma correct float sources to sRGB for display
*/
- /* only for float rects, converts to 32 bits and draws */
-void glaDrawPixelsSafe_to32(float fx, float fy, int img_w, int img_h, int row_w, float *rectf, int gamma_correct);
-
-
void glaDrawPixelsTex (float x, float y, int img_w, int img_h, int format, void *rect);
void glaDrawPixelsTexScaled(float x, float y, int img_w, int img_h, int format, void *rect, float scaleX, float scaleY);
diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c
index bff93fea067..e4597d6afc3 100644
--- a/source/blender/editors/render/render_internal.c
+++ b/source/blender/editors/render/render_internal.c
@@ -138,11 +138,14 @@ void image_buffer_rect_update(Scene *scene, RenderResult *rr, ImBuf *ibuf, volat
rectf+= 4*(rr->rectx*ymin + xmin);
rectc= (unsigned char*)(ibuf->rect + ibuf->x*rymin + rxmin);
- if(scene && (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT))
+ if(scene && (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT)) {
profile_from= IB_PROFILE_LINEAR_RGB;
- else
+ predivide= (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT_PREDIVIDE);
+ }
+ else {
profile_from= IB_PROFILE_SRGB;
- predivide= 0;
+ predivide= 0;
+ }
IMB_buffer_byte_from_float(rectc, rectf,
4, ibuf->dither, IB_PROFILE_SRGB, profile_from, predivide,
diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c
index feff1e05d60..86328ca2a64 100644
--- a/source/blender/editors/render/render_preview.c
+++ b/source/blender/editors/render/render_preview.c
@@ -460,12 +460,15 @@ static int ed_preview_draw_rect(ScrArea *sa, Scene *sce, ID *id, int split, int
Render *re;
RenderResult rres;
char name[32];
- int do_gamma_correct=0;
+ int do_gamma_correct=0, do_predivide=0;
int offx=0, newx= rect->xmax-rect->xmin, newy= rect->ymax-rect->ymin;
if (id && GS(id->name) != ID_TE) {
/* exception: don't color manage texture previews - show the raw values */
- if (sce) do_gamma_correct = sce->r.color_mgt_flag & R_COLOR_MANAGEMENT;
+ if (sce) {
+ do_gamma_correct = sce->r.color_mgt_flag & R_COLOR_MANAGEMENT;
+ do_predivide = sce->r.color_mgt_flag & R_COLOR_MANAGEMENT_PREDIVIDE;
+ }
}
if(!split || first) sprintf(name, "Preview %p", (void *)sa);
@@ -488,10 +491,28 @@ static int ed_preview_draw_rect(ScrArea *sa, Scene *sce, ID *id, int split, int
if(rres.rectf) {
if(ABS(rres.rectx-newx)<2 && ABS(rres.recty-newy)<2) {
+
newrect->xmax= MAX2(newrect->xmax, rect->xmin + rres.rectx + offx);
newrect->ymax= MAX2(newrect->ymax, rect->ymin + rres.recty);
- glaDrawPixelsSafe_to32(rect->xmin+offx, rect->ymin, rres.rectx, rres.recty, rres.rectx, rres.rectf, do_gamma_correct);
+ if(rres.rectx && rres.recty) {
+ /* temporary conversion to byte for drawing */
+ float fx= rect->xmin + offx;
+ float fy= rect->ymin;
+ int profile_from= (do_gamma_correct)? IB_PROFILE_LINEAR_RGB: IB_PROFILE_SRGB;
+ int dither= 0;
+ unsigned char *rect_byte;
+
+ rect_byte= MEM_mallocN(rres.rectx*rres.recty*sizeof(int), "ed_preview_draw_rect");
+
+ IMB_buffer_byte_from_float(rect_byte, rres.rectf,
+ 4, dither, IB_PROFILE_SRGB, profile_from, do_predivide,
+ rres.rectx, rres.recty, rres.rectx, rres.rectx);
+
+ glaDrawPixelsSafe(fx, fy, rres.rectx, rres.recty, rres.rectx, GL_RGBA, GL_UNSIGNED_BYTE, rect_byte);
+
+ MEM_freeN(rect_byte);
+ }
RE_ReleaseResultImage(re);
return 1;
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c
index 8f04940efd6..0b231ee7b96 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -45,9 +45,6 @@
#include "BIF_gl.h"
#include "BIF_glutil.h"
-#include "IMB_imbuf.h"
-#include "IMB_imbuf_types.h"
-
#ifndef GL_CLAMP_TO_EDGE
#define GL_CLAMP_TO_EDGE 0x812F
#endif
@@ -562,27 +559,6 @@ void glaDrawPixelsTex(float x, float y, int img_w, int img_h, int format, void *
glaDrawPixelsTexScaled(x, y, img_w, img_h, format, rect, 1.0f, 1.0f);
}
-/* row_w is unused but kept for completeness */
-void glaDrawPixelsSafe_to32(float fx, float fy, int img_w, int img_h, int UNUSED(row_w), float *rectf, int do_gamma_correct)
-{
- unsigned char *rect32;
- int profile_from= (do_gamma_correct)? IB_PROFILE_LINEAR_RGB: IB_PROFILE_SRGB;
- int predivide= 0;
-
- /* copy imgw-imgh to a temporal 32 bits rect */
- if(img_w<1 || img_h<1) return;
-
- rect32= MEM_mallocN(img_w*img_h*sizeof(int), "temp 32 bits");
-
- IMB_buffer_byte_from_float(rect32, rectf,
- 4, 0, IB_PROFILE_SRGB, profile_from, predivide,
- img_w, img_h, img_w, img_w);
-
- glaDrawPixelsSafe(fx, fy, img_w, img_h, img_w, GL_RGBA, GL_UNSIGNED_BYTE, rect32);
-
- MEM_freeN(rect32);
-}
-
void glaDrawPixelsSafe(float x, float y, int img_w, int img_h, int row_w, int format, int type, void *rect)
{
float xzoom= glaGetOneFloat(GL_ZOOM_X);
diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c
index c647ff3df53..8d8c79386c5 100644
--- a/source/blender/editors/space_image/image_buttons.c
+++ b/source/blender/editors/space_image/image_buttons.c
@@ -750,7 +750,9 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
uiLayoutSetActive(row, RNA_boolean_get(&imaptr, "use_fields"));
uiItemR(row, &imaptr, "field_order", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
- uiItemR(split, &imaptr, "use_premultiply", 0, NULL, ICON_NONE);
+ row= uiLayoutRow(layout, 0);
+ uiItemR(row, &imaptr, "use_premultiply", 0, NULL, ICON_NONE);
+ uiItemR(row, &imaptr, "use_color_unpremultiply", 0, NULL, ICON_NONE);
}
}
diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c
index 1a808e8ee5f..9d4c5705bd1 100644
--- a/source/blender/editors/space_node/space_node.c
+++ b/source/blender/editors/space_node/space_node.c
@@ -248,12 +248,10 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn)
case NC_IMAGE:
if (wmn->action == NA_EDITED) {
if(type==NTREE_COMPOSIT) {
- Scene *scene= wmn->window->screen->scene;
-
/* note that nodeUpdateID is already called by BKE_image_signal() on all
* scenes so really this is just to know if the images is used in the compo else
* painting on images could become very slow when the compositor is open. */
- if(nodeUpdateID(scene->nodetree, wmn->reference))
+ if(nodeUpdateID(snode->nodetree, wmn->reference))
ED_area_tag_refresh(sa);
}
}