[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43763] trunk/blender/source/blender/ editors/interface/interface_draw.c: Fix #30020: Movie Clip Editor Crashed with panel size changed

Sergey Sharybin sergey.vfx at gmail.com
Mon Jan 30 10:05:26 CET 2012


Revision: 43763
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43763
Author:   nazgul
Date:     2012-01-30 09:05:26 +0000 (Mon, 30 Jan 2012)
Log Message:
-----------
Fix #30020: Movie Clip Editor Crashed with panel size changed

Modified Paths:
--------------
    trunk/blender/source/blender/editors/interface/interface_draw.c

Modified: trunk/blender/source/blender/editors/interface/interface_draw.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_draw.c	2012-01-30 09:00:54 UTC (rev 43762)
+++ trunk/blender/source/blender/editors/interface/interface_draw.c	2012-01-30 09:05:26 UTC (rev 43763)
@@ -1529,38 +1529,40 @@
 		width= rect.xmax-rect.xmin+1;
 		height = rect.ymax-rect.ymin;
 
-		zoomx= (float)width / (scopes->track_preview->x-2*margin);
-		zoomy= (float)height / (scopes->track_preview->y-2*margin);
+		if(width > 0 && height > 0) {
+			zoomx= (float)width / (scopes->track_preview->x-2*margin);
+			zoomy= (float)height / (scopes->track_preview->y-2*margin);
 
-		off_x= ((int)track_pos[0]-track_pos[0]+0.5)*zoomx;
-		off_y= ((int)track_pos[1]-track_pos[1]+0.5)*zoomy;
+			off_x= ((int)track_pos[0]-track_pos[0]+0.5)*zoomx;
+			off_y= ((int)track_pos[1]-track_pos[1]+0.5)*zoomy;
 
-		drawibuf= scale_trackpreview_ibuf(scopes->track_preview, track_pos, width, height, margin);
+			drawibuf= scale_trackpreview_ibuf(scopes->track_preview, track_pos, width, height, margin);
 
-		glaDrawPixelsSafe(rect.xmin, rect.ymin+1, drawibuf->x, drawibuf->y,
-		                  drawibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, drawibuf->rect);
-		IMB_freeImBuf(drawibuf);
+			glaDrawPixelsSafe(rect.xmin, rect.ymin+1, drawibuf->x, drawibuf->y,
+			                  drawibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, drawibuf->rect);
+			IMB_freeImBuf(drawibuf);
 
-		/* draw cross for pizel position */
-		glTranslatef(off_x+rect.xmin+track_pos[0]*zoomx, off_y+rect.ymin+track_pos[1]*zoomy, 0.f);
-		glScissor(ar->winrct.xmin + rect.xmin, ar->winrct.ymin+rect.ymin, rect.xmax-rect.xmin, rect.ymax-rect.ymin);
+			/* draw cross for pizel position */
+			glTranslatef(off_x+rect.xmin+track_pos[0]*zoomx, off_y+rect.ymin+track_pos[1]*zoomy, 0.f);
+			glScissor(ar->winrct.xmin + rect.xmin, ar->winrct.ymin+rect.ymin, rect.xmax-rect.xmin, rect.ymax-rect.ymin);
 
-		for(a= 0; a< 2; a++) {
-			if(a==1) {
-				glLineStipple(3, 0xaaaa);
-				glEnable(GL_LINE_STIPPLE);
-				UI_ThemeColor(TH_SEL_MARKER);
+			for(a= 0; a< 2; a++) {
+				if(a==1) {
+					glLineStipple(3, 0xaaaa);
+					glEnable(GL_LINE_STIPPLE);
+					UI_ThemeColor(TH_SEL_MARKER);
+				}
+				else {
+					UI_ThemeColor(TH_MARKER_OUTLINE);
+				}
+
+				glBegin(GL_LINES);
+					glVertex2f(-10.0f, 0.0f);
+					glVertex2f(10.0f, 0.0f);
+					glVertex2f(0.0f, -10.0f);
+					glVertex2f(0.0f, 10.0f);
+					glEnd();
 			}
-			else {
-				UI_ThemeColor(TH_MARKER_OUTLINE);
-			}
-
-			glBegin(GL_LINES);
-				glVertex2f(-10.0f, 0.0f);
-				glVertex2f(10.0f, 0.0f);
-				glVertex2f(0.0f, -10.0f);
-				glVertex2f(0.0f, 10.0f);
-			glEnd();
 		}
 
 		glDisable(GL_LINE_STIPPLE);



More information about the Bf-blender-cvs mailing list