diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-12-04 22:49:41 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-12-04 22:49:41 +0400 |
commit | 229dd30f37d222845f2902148d50070dcc12246d (patch) | |
tree | 463697ac3580eb627f09671ebc67458f8cad3e61 | |
parent | 937c5494c4933c65635450e66aeacffed74939f2 (diff) |
Slight optimization of track preview widget (the same approach as in tomato branch)
-rw-r--r-- | source/blender/editors/interface/interface_draw.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index da94fd9237a..f3a99ecf6b8 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -1475,14 +1475,18 @@ static ImBuf *scale_trackpreview_ibuf(ImBuf *ibuf, float zoomx, float zoomy) { 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]; |