[Bf-blender-cvs] [674c3bf] master: Fix T49996: VSE opengl render crash with grease pencil if current frame is empty

Antonioya noreply at git.blender.org
Fri Nov 11 22:28:08 CET 2016


Commit: 674c3bf89480a3278b3637d1dcfe37532f00711e
Author: Antonioya
Date:   Fri Nov 11 22:27:10 2016 +0100
Branches: master
https://developer.blender.org/rB674c3bf89480a3278b3637d1dcfe37532f00711e

Fix T49996: VSE  opengl render crash with grease pencil if current frame is empty

If the opengl render with grease pencil is run from VSE with the current
frame outside visible frames, the render pass is wrong and the render
must be canceled because nothing to render. Related to #T49975

===================================================================

M	source/blender/editors/render/render_opengl.c

===================================================================

diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index ea53c87..16842ef 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -485,23 +485,24 @@ static void add_gpencil_renderpass(OGLRender *oglrender, RenderResult *rr, Rende
 		/* copy image data from rectf */
 		// XXX: Needs conversion.
 		unsigned char *src = (unsigned char *)RE_RenderViewGetById(rr, oglrender->view_id)->rect32;
-		float *dest = rp->rect;
-
-		int x, y, rectx, recty;
-		rectx = rr->rectx;
-		recty = rr->recty;
-		for (y = 0; y < recty; y++) {
-			for (x = 0; x < rectx; x++) {
-				unsigned char *pixSrc = src + 4 * (rectx * y + x);
-				if (pixSrc[3] > 0) {
-					float *pixDest = dest + 4 * (rectx * y + x);
-					float float_src[4];
-					srgb_to_linearrgb_uchar4(float_src, pixSrc);
-					addAlphaOverFloat(pixDest, float_src);
+		if (src != NULL) {
+			float *dest = rp->rect;
+
+			int x, y, rectx, recty;
+			rectx = rr->rectx;
+			recty = rr->recty;
+			for (y = 0; y < recty; y++) {
+				for (x = 0; x < rectx; x++) {
+					unsigned char *pixSrc = src + 4 * (rectx * y + x);
+					if (pixSrc[3] > 0) {
+						float *pixDest = dest + 4 * (rectx * y + x);
+						float float_src[4];
+						srgb_to_linearrgb_uchar4(float_src, pixSrc);
+						addAlphaOverFloat(pixDest, float_src);
+					}
 				}
 			}
 		}
-
 		/* back layer status */
 		i = 0;
 		for (bGPDlayer *gph = gpd->layers.first; gph; gph = gph->next) {




More information about the Bf-blender-cvs mailing list