[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43246] trunk/blender/source/blender: Camera tracking: fixes for preview widget

Sergey Sharybin sergey.vfx at gmail.com
Mon Jan 9 21:19:08 CET 2012


Revision: 43246
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43246
Author:   nazgul
Date:     2012-01-09 20:19:07 +0000 (Mon, 09 Jan 2012)
Log Message:
-----------
Camera tracking: fixes for preview widget

- Clamping of image on boundaries now happens nicely
- Looks like to prevent dark edges on image boundary when doing
  bicubic interpolation, margin should be 3px. Maybe somebody can verify this?

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

Modified: trunk/blender/source/blender/blenkernel/intern/movieclip.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/movieclip.c	2012-01-09 20:18:57 UTC (rev 43245)
+++ trunk/blender/source/blender/blenkernel/intern/movieclip.c	2012-01-09 20:19:07 UTC (rev 43246)
@@ -861,7 +861,7 @@
 					}
 
 					/* NOTE: margin should be kept in sync with value from ui_draw_but_TRACKPREVIEW */
-					tmpibuf= BKE_tracking_get_pattern_imbuf(ibuf, track, &undist_marker, 2 /* margin */,
+					tmpibuf= BKE_tracking_get_pattern_imbuf(ibuf, track, &undist_marker, 3 /* margin */,
 							1 /* anchor */, scopes->track_pos, NULL);
 
 					if(tmpibuf->rect_float)

Modified: trunk/blender/source/blender/editors/interface/interface_draw.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_draw.c	2012-01-09 20:18:57 UTC (rev 43245)
+++ trunk/blender/source/blender/editors/interface/interface_draw.c	2012-01-09 20:19:07 UTC (rev 43246)
@@ -1511,8 +1511,8 @@
 	else if(scopes->track_preview) {
 		/* additional margin around image */
 		/* NOTE: should be kept in sync with value from BKE_movieclip_update_scopes */
-		const int margin= 2;
-		float zoomx, zoomy, track_pos[2], off_x, off_y;
+		const int margin= 3;
+		float zoomx, zoomy, track_pos[2], off_x, off_y, x0, y0;
 		int a;
 		ImBuf *drawibuf;
 
@@ -1529,11 +1529,11 @@
 
 		off_x= ((int)track_pos[0]-track_pos[0]+0.5)*zoomx;
 		off_y= ((int)track_pos[1]-track_pos[1]+0.5)*zoomy;
+		x0= (int)(off_x+rect.xmin-zoomx*(margin-0.5f))+1;
+		y0= (int)(off_y+rect.ymin-zoomy*(margin-0.5f))+1;
 
 		drawibuf= scale_trackpreview_ibuf(scopes->track_preview, zoomx, zoomy);
-		glaDrawPixelsSafe(off_x+rect.xmin-zoomx*(margin-0.5f), off_y+rect.ymin-zoomy*(margin-0.5f),
-		                  rect.xmax-rect.xmin+2+(int)(zoomx*(margin-0.5f)-off_x),
-		                  rect.ymax-rect.ymin+2+(int)(zoomy*(margin-0.5f)-off_y),
+		glaDrawPixelsSafe(x0, y0, rect.xmax-x0+1, rect.ymax-y0+1,
 		                  drawibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, drawibuf->rect);
 		IMB_freeImBuf(drawibuf);
 



More information about the Bf-blender-cvs mailing list