[Bf-blender-cvs] [10b27bd30ab] blender2.8: fix screen layout thumbnails (T51078)

Mike Erwin noreply at git.blender.org
Thu Mar 30 09:03:37 CEST 2017


Commit: 10b27bd30ab8193305b064941c827dd2cda9eeb1
Author: Mike Erwin
Date:   Thu Mar 30 03:01:50 2017 -0400
Branches: blender2.8
https://developer.blender.org/rB10b27bd30ab8193305b064941c827dd2cda9eeb1

fix screen layout thumbnails (T51078)

GPU_framebuffer no longer handles transform matrices, which this code was relying on. Made screen_preview_draw responsible for its own ModelView matrix.

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

M	source/blender/editors/screen/screen_draw.c

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

diff --git a/source/blender/editors/screen/screen_draw.c b/source/blender/editors/screen/screen_draw.c
index 22c6f070ac9..bbcf4eb56a2 100644
--- a/source/blender/editors/screen/screen_draw.c
+++ b/source/blender/editors/screen/screen_draw.c
@@ -433,16 +433,17 @@ static void screen_preview_draw_areas(const bScreen *screen, const float scale[2
 {
 	const float ofs_h = ofs_between_areas * 0.5f;
 	unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT);
-	rctf rect;
 
 	immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
 	immUniformColor4fv(col);
 
 	for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
-		rect.xmin = sa->totrct.xmin * scale[0] + ofs_h;
-		rect.xmax = sa->totrct.xmax * scale[0] - ofs_h;
-		rect.ymin = sa->totrct.ymin * scale[1] + ofs_h;
-		rect.ymax = sa->totrct.ymax * scale[1] - ofs_h;
+		rctf rect = {
+			.xmin = sa->totrct.xmin * scale[0] + ofs_h,
+			.xmax = sa->totrct.xmax * scale[0] - ofs_h,
+			.ymin = sa->totrct.ymin * scale[1] + ofs_h,
+			.ymax = sa->totrct.ymax * scale[1] - ofs_h
+		};
 
 		immBegin(PRIM_TRIANGLE_FAN, 4);
 		immVertex2f(pos, rect.xmin, rect.ymin);
@@ -464,10 +465,13 @@ static void screen_preview_draw(const bScreen *screen, int size_x, int size_y)
 
 	wmOrtho2(0.0f, size_x, 0.0f, size_y);
 	/* center */
+	gpuPushMatrix();
 	gpuTranslate2f(size_x * (1.0f - asp[0]) * 0.5f, size_y * (1.0f - asp[1]) * 0.5f);
 
 	screen_preview_scale_get(screen, size_x, size_y, asp, scale);
 	screen_preview_draw_areas(screen, scale, col, 1.5f);
+
+	gpuPopMatrix();
 }
 
 /**




More information about the Bf-blender-cvs mailing list