[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36926] branches/soc-2011-onion/source/ blender: a few comments plus a null check
Ryakiotakis Antonis
kalast at gmail.com
Thu May 26 16:30:46 CEST 2011
Revision: 36926
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36926
Author: psy-fi
Date: 2011-05-26 14:30:46 +0000 (Thu, 26 May 2011)
Log Message:
-----------
a few comments plus a null check
Modified Paths:
--------------
branches/soc-2011-onion/source/blender/gpu/intern/gpu_draw.c
branches/soc-2011-onion/source/blender/imbuf/IMB_imbuf.h
branches/soc-2011-onion/source/blender/imbuf/intern/divers.c
Modified: branches/soc-2011-onion/source/blender/gpu/intern/gpu_draw.c
===================================================================
--- branches/soc-2011-onion/source/blender/gpu/intern/gpu_draw.c 2011-05-26 13:59:57 UTC (rev 36925)
+++ branches/soc-2011-onion/source/blender/gpu/intern/gpu_draw.c 2011-05-26 14:30:46 UTC (rev 36926)
@@ -706,10 +706,18 @@
glGetIntegerv(GL_UNPACK_SKIP_ROWS, &skip_rows);
if (ibuf->rect_float){
+ /*This case needs a whole new buffer*/
if(ibuf->rect==NULL) {
IMB_rect_from_float(ibuf);
}
else {
+ /*Do partial drawing. 'buffer' holds only the changed part.
+ This approach is better since:
+ a)we avoid sending the whole
+ texture to the driver(bandwidth)
+ b)The driver skips some math when uploading the texture.
+
+ implementation for non-float images will follow*/
float *buffer = (float *)MEM_mallocN(w*h*sizeof(float)*4, "temp_texpaint_float_buf");
IMB_partial_rect_from_float(ibuf, buffer, x, y, w, h);
glBindTexture(GL_TEXTURE_2D, ima->bindcode);
Modified: branches/soc-2011-onion/source/blender/imbuf/IMB_imbuf.h
===================================================================
--- branches/soc-2011-onion/source/blender/imbuf/IMB_imbuf.h 2011-05-26 13:59:57 UTC (rev 36925)
+++ branches/soc-2011-onion/source/blender/imbuf/IMB_imbuf.h 2011-05-26 14:30:46 UTC (rev 36926)
@@ -323,7 +323,8 @@
/*create char buffer, color corrected if necessary, for ImBufs that lack one*/
void IMB_rect_from_float(struct ImBuf *ibuf);
-/*create char buffer for part of the image, color corrected if necessary, for ImBufs that lack one*/
+/*create char buffer for part of the image, color corrected if necessary, for ImBufs that lack one.
+Changed part will be stored in buffer. This is expected to bu used for texure painting updates*/
void IMB_partial_rect_from_float(struct ImBuf *ibuf, float *buffer, int x, int y, int w, int h);
void IMB_float_from_rect(struct ImBuf *ibuf);
void IMB_float_from_rect_simple(struct ImBuf *ibuf); /* no profile conversion */
Modified: branches/soc-2011-onion/source/blender/imbuf/intern/divers.c
===================================================================
--- branches/soc-2011-onion/source/blender/imbuf/intern/divers.c 2011-05-26 13:59:57 UTC (rev 36925)
+++ branches/soc-2011-onion/source/blender/imbuf/intern/divers.c 2011-05-26 14:30:46 UTC (rev 36926)
@@ -224,7 +224,9 @@
if called -only- from GPU_paint_update_image this test will never fail
but leaving it here for better or worse
*/
- if(init_srcFloatPxl==NULL) return;
+ if(init_srcFloatPxl==NULL || (buffer == NULL)){
+ return;
+ }
if(init_dstBytePxl==NULL) {
imb_addrectImBuf(ibuf);
init_dstBytePxl = (unsigned char *) ibuf->rect;
More information about the Bf-blender-cvs
mailing list