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
path: root/source
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2008-03-03 19:38:27 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2008-03-03 19:38:27 +0300
commit13f70b807713834e6ac1089eb9e6c98afe9ec5aa (patch)
treeb8989af8f3eeb95a0266c304f584230a06f18169 /source
parent3aeaccb0d87822cde89c5de282ade0d02d39dde3 (diff)
Fix for bug #8366, render color sampling bugs and inconsistencies:
- renderwindow didn't show values of previous buffer correct. - renderwindow only showed floats and no char values like image editor. - renderwindow didn't show x,y values. - image editor didn't show z values. Patch to fix these problems provided by Rob Hausauer, thanks!
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/image.c2
-rw-r--r--source/blender/src/renderwin.c33
2 files changed, 31 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index d9b76ac210b..094e35d6c8b 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -1770,6 +1770,8 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser)
ibuf->rect_float= rectf;
ibuf->flags |= IB_rectfloat;
ibuf->channels= channels;
+ ibuf->zbuf_float= rres.rectz;
+ ibuf->flags |= IB_zbuffloat;
ima->ok= IMA_OK_LOADED;
return ibuf;
diff --git a/source/blender/src/renderwin.c b/source/blender/src/renderwin.c
index 1bbe3f6d7b4..4510e72e659 100644
--- a/source/blender/src/renderwin.c
+++ b/source/blender/src/renderwin.c
@@ -352,6 +352,7 @@ static void renderwin_draw(RenderWin *rw, int just_clear)
rres.recty= rspare->ibuf->y;
rres.rect32= (int *)rspare->ibuf->rect;
rres.rectf= rspare->ibuf->rect_float;
+ rres.rectz= rspare->ibuf->zbuf_float;
}
else
memset(&rres, 0, sizeof(rres));
@@ -429,11 +430,26 @@ static void renderwin_zoom(RenderWin *rw, int ZoomIn) {
renderwin_queue_redraw(rw);
}
+#define FTOCHAR(val) val<=0.0f? 0 : (val>=(1.0f-0.5f/255.0f)? 255 :(char)((255.0f*val)+0.5f))
+
static void renderwin_mouse_moved(RenderWin *rw)
{
RenderResult rres;
-
- RE_GetResultImage(RE_GetRender(G.scene->id.name), &rres);
+ RenderSpare *rspare= render_spare;
+
+ if(rspare && rspare->showspare) {
+ if(rspare->ibuf) {
+ rres.rectx= rspare->ibuf->x;
+ rres.recty= rspare->ibuf->y;
+ rres.rect32= (int *)rspare->ibuf->rect;
+ rres.rectf= rspare->ibuf->rect_float;
+ rres.rectz= rspare->ibuf->zbuf_float;
+ }
+ else
+ memset(&rres, 0, sizeof(rres));
+ }
+ else
+ RE_GetResultImage(RE_GetRender(G.scene->id.name), &rres);
if (rw->flags & RW_FLAGS_PIXEL_EXAMINING) {
int imgco[2], ofs=0;
@@ -441,12 +457,16 @@ static void renderwin_mouse_moved(RenderWin *rw)
char *pxl;
if (renderwin_win_to_image_co(rw, rw->lmouse, imgco)) {
+ ofs= sprintf(buf, "X: %d Y: %d ", imgco[0], imgco[1]);
if (rres.rect32) {
pxl= (char*) &rres.rect32[rres.rectx*imgco[1] + imgco[0]];
- ofs= sprintf(buf, "R: %d G: %d B: %d A: %d", pxl[0], pxl[1], pxl[2], pxl[3]);
+ ofs+= sprintf(buf+ofs, " | R: %d G: %d B: %d A: %d", pxl[0], pxl[1], pxl[2], pxl[3]);
}
if (rres.rectf) {
float *pxlf= rres.rectf + 4*(rres.rectx*imgco[1] + imgco[0]);
+ if(!rres.rect32){
+ ofs+= sprintf(buf+ofs, " | R: %d G: %d B: %d A: %d", FTOCHAR(pxlf[0]), FTOCHAR(pxlf[1]), FTOCHAR(pxlf[2]), FTOCHAR(pxlf[3]));
+ }
ofs+= sprintf(buf+ofs, " | R: %.3f G: %.3f B: %.3f A: %.3f ", pxlf[0], pxlf[1], pxlf[2], pxlf[3]);
}
if (rres.rectz) {
@@ -1159,11 +1179,16 @@ static int render_store_spare(void)
rspare->ibuf->flags |= IB_rect;
rspare->ibuf->mall |= IB_rect;
}
- else if(rres.rectf) {
+ if(rres.rectf) {
rspare->ibuf->rect_float= MEM_dupallocN(rres.rectf);
rspare->ibuf->flags |= IB_rectfloat;
rspare->ibuf->mall |= IB_rectfloat;
}
+ if(rres.rectz) {
+ rspare->ibuf->zbuf_float= MEM_dupallocN(rres.rectz);
+ rspare->ibuf->flags |= IB_zbuffloat;
+ rspare->ibuf->mall |= IB_zbuffloat;
+ }
return 1;
}