[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42420] trunk/blender/source/blender/ editors/interface/interface_draw.c: Slight optimization of track preview widget ( the same approach as in tomato branch)
Sergey Sharybin
sergey.vfx at gmail.com
Sun Dec 4 19:49:42 CET 2011
Revision: 42420
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42420
Author: nazgul
Date: 2011-12-04 18:49:41 +0000 (Sun, 04 Dec 2011)
Log Message:
-----------
Slight optimization of track preview widget (the same approach as in tomato branch)
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 2011-12-04 18:41:41 UTC (rev 42419)
+++ trunk/blender/source/blender/editors/interface/interface_draw.c 2011-12-04 18:49:41 UTC (rev 42420)
@@ -1475,14 +1475,18 @@
{
ImBuf *scaleibuf;
int x, y, w= ibuf->x*zoomx, h= ibuf->y*zoomy;
+ const float scalex= 1.0f/zoomx;
+ const float scaley= 1.0f/zoomy;
+
scaleibuf= IMB_allocImBuf(w, h, 32, IB_rect);
for(y= 0; y<scaleibuf->y; y++) {
for (x= 0; x<scaleibuf->x; x++) {
int pixel= scaleibuf->x*y + x;
- int orig_pixel= ibuf->x*(int)(((float)y)/zoomy) + (int)(((float)x)/zoomx);
+ int orig_pixel= ibuf->x*(int)(scaley*(float)y) + (int)(scalex*(float)x);
char *rrgb= (char*)scaleibuf->rect + pixel*4;
char *orig_rrgb= (char*)ibuf->rect + orig_pixel*4;
+
rrgb[0]= orig_rrgb[0];
rrgb[1]= orig_rrgb[1];
rrgb[2]= orig_rrgb[2];
More information about the Bf-blender-cvs
mailing list