Camera tracking: improvements of track preview widget
authorSergey Sharybin <sergey.vfx@gmail.com>
Fri, 30 Dec 2011 10:20:29 +0000 (10:20 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Fri, 30 Dec 2011 10:20:29 +0000 (10:20 +0000)
- Enable bicybic filtering fir image displayed in track preview
- Option to show grayscale content of track preview
- When some channels are disabled, display exactly the same
  content of preview image which is sending to tracker library.

Merged from tomato branch using command:
    svn merge -r42382:42383 -r42384:42385 -r42394:42395 \
    -r42397:42398 -r42398:42399 -r42406:42407 \
-r42410:42411 -r42417:42418 -r42471:42472 \
^/branches/soc-2011-tomato

1  2 
release/scripts/startup/bl_ui/space_clip.py
source/blender/blenkernel/intern/tracking.c
source/blender/editors/interface/interface_draw.c
source/blender/makesdna/DNA_tracking_types.h
source/blender/makesrna/intern/rna_tracking.c

@@@ -1461,32 -1471,6 +1461,32 @@@ void ui_draw_but_CURVE(ARegion *ar, uiB
        fdrawbox(rect->xmin, rect->ymin, rect->xmax, rect->ymax);
  }
  
-                       int pixel= scaleibuf->x*y + x;
-                       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];
-                       rrgb[3]= orig_rrgb[3];
 +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 max_x= ibuf->x-1.0f;
++      const float max_y= ibuf->y-1.0f;
 +      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++) {
++                      float src_x= scalex*x;
++                      float src_y= scaley*y;
++
++                      CLAMP(src_x, 0, max_x);
++                      CLAMP(src_y, 0, max_y);
++
++                      bicubic_interpolation(ibuf, scaleibuf, src_x, src_y, x, y);
 +              }
 +      }
 +
 +      return scaleibuf;
 +}
 +
  void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *recti)
  {
        rctf rect;