code cleanup: replace macro for BLI_rect size/center with inline functions.
authorCampbell Barton <ideasman42@gmail.com>
Sat, 15 Sep 2012 11:48:20 +0000 (11:48 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 15 Sep 2012 11:48:20 +0000 (11:48 +0000)
88 files changed:
source/blender/blenfont/intern/blf_font.c
source/blender/blenfont/intern/blf_glyph.c
source/blender/blenkernel/BKE_colortools.h
source/blender/blenkernel/intern/colortools.c
source/blender/blenkernel/intern/mask_rasterize.c
source/blender/blenlib/BLI_rect.h
source/blender/blenlib/intern/rct.c
source/blender/blenlib/intern/string_cursor_utf8.c
source/blender/compositor/operations/COM_DilateErodeOperation.cpp
source/blender/editors/animation/anim_channels_defines.c
source/blender/editors/animation/anim_markers.c
source/blender/editors/gpencil/gpencil_edit.c
source/blender/editors/gpencil/gpencil_paint.c
source/blender/editors/include/UI_view2d.h
source/blender/editors/interface/interface.c
source/blender/editors/interface/interface_draw.c
source/blender/editors/interface/interface_handlers.c
source/blender/editors/interface/interface_intern.h
source/blender/editors/interface/interface_layout.c
source/blender/editors/interface/interface_panel.c
source/blender/editors/interface/interface_regions.c
source/blender/editors/interface/interface_style.c
source/blender/editors/interface/interface_templates.c
source/blender/editors/interface/interface_widgets.c
source/blender/editors/interface/view2d.c
source/blender/editors/interface/view2d_ops.c
source/blender/editors/mask/mask_draw.c
source/blender/editors/mesh/editface.c
source/blender/editors/render/render_preview.c
source/blender/editors/screen/area.c
source/blender/editors/screen/glutil.c
source/blender/editors/screen/screen_ops.c
source/blender/editors/screen/screendump.c
source/blender/editors/sculpt_paint/paint_cursor.c
source/blender/editors/space_action/action_draw.c
source/blender/editors/space_action/action_edit.c
source/blender/editors/space_action/action_select.c
source/blender/editors/space_buttons/buttons_header.c
source/blender/editors/space_clip/clip_buttons.c
source/blender/editors/space_clip/clip_dopesheet_draw.c
source/blender/editors/space_clip/clip_draw.c
source/blender/editors/space_clip/clip_editor.c
source/blender/editors/space_clip/clip_graph_ops.c
source/blender/editors/space_clip/clip_ops.c
source/blender/editors/space_clip/space_clip.c
source/blender/editors/space_console/space_console.c
source/blender/editors/space_file/filesel.c
source/blender/editors/space_file/space_file.c
source/blender/editors/space_graph/graph_draw.c
source/blender/editors/space_graph/graph_edit.c
source/blender/editors/space_graph/graph_select.c
source/blender/editors/space_image/image_buttons.c
source/blender/editors/space_image/image_draw.c
source/blender/editors/space_image/image_edit.c
source/blender/editors/space_image/image_ops.c
source/blender/editors/space_image/space_image.c
source/blender/editors/space_logic/logic_buttons.c
source/blender/editors/space_nla/nla_edit.c
source/blender/editors/space_nla/nla_select.c
source/blender/editors/space_node/drawnode.c
source/blender/editors/space_node/node_draw.c
source/blender/editors/space_node/node_edit.c
source/blender/editors/space_node/node_select.c
source/blender/editors/space_node/node_view.c
source/blender/editors/space_outliner/outliner_edit.c
source/blender/editors/space_sequencer/sequencer_draw.c
source/blender/editors/space_sequencer/sequencer_edit.c
source/blender/editors/space_text/text_draw.c
source/blender/editors/space_text/text_ops.c
source/blender/editors/space_time/time_ops.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/editors/space_view3d/view3d_edit.c
source/blender/editors/space_view3d/view3d_select.c
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform_conversions.c
source/blender/editors/transform/transform_snap.c
source/blender/nodes/composite/node_composite_util.c
source/blender/render/intern/source/convertblender.c
source/blender/render/intern/source/imagetexture.c
source/blender/render/intern/source/initrender.c
source/blender/render/intern/source/pipeline.c
source/blender/render/intern/source/render_result.c
source/blender/render/intern/source/rendercore.c
source/blender/render/intern/source/shadbuf.c
source/blender/windowmanager/intern/wm_gesture.c
source/blender/windowmanager/intern/wm_subwindow.c
source/blender/windowmanager/intern/wm_window.c
source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp

index 02b6699..6527c5c 100644 (file)
@@ -430,8 +430,8 @@ void blf_font_width_and_height(FontBLF *font, const char *str, float *width, flo
        }
 
        blf_font_boundbox(font, str, &box);
-       *width  = (BLI_RCT_SIZE_X(&box) * xa);
-       *height = (BLI_RCT_SIZE_Y(&box) * ya);
+       *width  = (BLI_rctf_size_x(&box) * xa);
+       *height = (BLI_rctf_size_y(&box) * ya);
 }
 
 float blf_font_width(FontBLF *font, const char *str)
@@ -445,7 +445,7 @@ float blf_font_width(FontBLF *font, const char *str)
                xa = 1.0f;
 
        blf_font_boundbox(font, str, &box);
-       return BLI_RCT_SIZE_X(&box) * xa;
+       return BLI_rctf_size_x(&box) * xa;
 }
 
 float blf_font_height(FontBLF *font, const char *str)
@@ -459,7 +459,7 @@ float blf_font_height(FontBLF *font, const char *str)
                ya = 1.0f;
 
        blf_font_boundbox(font, str, &box);
-       return BLI_RCT_SIZE_Y(&box) * ya;
+       return BLI_rctf_size_y(&box) * ya;
 }
 
 float blf_font_fixed_width(FontBLF *font)
index 6322565..91ecded 100644 (file)
@@ -415,7 +415,7 @@ int blf_glyph_render(FontBLF *font, GlyphBLF *g, float x, float y)
                g->uv[1][1] = ((float)(g->yoff + g->height)) / ((float)gc->p2_height);
 
                /* update the x offset for the next glyph. */
-               gc->x_offs += (int)(BLI_RCT_SIZE_X(&g->box) + gc->pad);
+               gc->x_offs += (int)(BLI_rctf_size_x(&g->box) + gc->pad);
 
                gc->rem_glyphs--;
                g->build_tex = 1;
index cd67059..728f88b 100644 (file)
@@ -61,7 +61,7 @@ void                curvemapping_set_black_white(struct CurveMapping *cumap, con
 
 #define CURVEMAP_SLOPE_NEGATIVE 0
 #define CURVEMAP_SLOPE_POSITIVE 1
-void                    curvemap_reset(struct CurveMap *cuma, struct rctf *clipr, int preset, int slope);
+void                    curvemap_reset(struct CurveMap *cuma, const struct rctf *clipr, int preset, int slope);
 void                    curvemap_remove(struct CurveMap *cuma, const short flag);
 void                    curvemap_remove_point(struct CurveMap *cuma, struct CurveMapPoint *cmp);
 struct CurveMapPoint    *curvemap_insert(struct CurveMap *cuma, float x, float y);
index 19c8c2c..b66bd1f 100644 (file)
@@ -262,7 +262,7 @@ CurveMapPoint *curvemap_insert(CurveMap *cuma, float x, float y)
        return newcmp;
 }
 
-void curvemap_reset(CurveMap *cuma, rctf *clipr, int preset, int slope)
+void curvemap_reset(CurveMap *cuma, const rctf *clipr, int preset, int slope)
 {
        if (cuma->curve)
                MEM_freeN(cuma->curve);
@@ -481,7 +481,7 @@ static float curvemap_calc_extend(const CurveMap *cuma, float x, const float fir
 }
 
 /* only creates a table for a single channel in CurveMapping */
-static void curvemap_make_table(CurveMap *cuma, rctf *clipr)
+static void curvemap_make_table(CurveMap *cuma, const rctf *clipr)
 {
        CurveMapPoint *cmp = cuma->curve;
        BezTriple *bezt;
@@ -679,7 +679,7 @@ void curvemapping_changed(CurveMapping *cumap, int rem_doubles)
        CurveMap *cuma = cumap->cm + cumap->cur;
        CurveMapPoint *cmp = cuma->curve;
        rctf *clipr = &cumap->clipr;
-       float thresh = 0.01f * BLI_RCT_SIZE_X(clipr);
+       float thresh = 0.01f * BLI_rctf_size_x(clipr);
        float dx = 0.0f, dy = 0.0f;
        int a;
 
index 00898b0..1a9ac9d 100644 (file)
@@ -410,8 +410,8 @@ static void layer_bucket_init(MaskRasterLayer *layer, const float pixel_size)
 {
        MemArena *arena = BLI_memarena_new(1 << 16, __func__);
 
-       const float bucket_dim_x = BLI_RCT_SIZE_X(&layer->bounds);
-       const float bucket_dim_y = BLI_RCT_SIZE_Y(&layer->bounds);
+       const float bucket_dim_x = BLI_rctf_size_x(&layer->bounds);
+       const float bucket_dim_y = BLI_rctf_size_y(&layer->bounds);
 
        layer->buckets_x = (bucket_dim_x / pixel_size) / (float)BUCKET_PIXELS_PER_CELL;
        layer->buckets_y = (bucket_dim_y / pixel_size) / (float)BUCKET_PIXELS_PER_CELL;
index eb9915d..e64fb1a 100644 (file)
@@ -75,14 +75,28 @@ void BLI_rctf_rcti_copy(struct rctf *dst, const struct rcti *src);
 void print_rctf(const char *str, const struct rctf *rect);
 void print_rcti(const char *str, const struct rcti *rect);
 
-#define BLI_RCT_SIZE_X(rct)       ((rct)->xmax - (rct)->xmin)
-#define BLI_RCT_SIZE_Y(rct)       ((rct)->ymax - (rct)->ymin)
+/* hrmf, we need to work out this inline stuff */
+#if defined(_MSC_VER)
+#  define BLI_INLINE static __forceinline
+#elif defined(__GNUC__)
+#  define BLI_INLINE static inline __attribute((always_inline))
+#else
+/* #warning "MSC/GNUC defines not found, inline non-functional" */
+#  define BLI_INLINE static
+#endif
 
-#define BLI_RCT_CENTER_X(rct)     (((rct)->xmin + (rct)->xmax) / 2)
-#define BLI_RCT_CENTER_Y(rct)     (((rct)->ymin + (rct)->ymax) / 2)
+#include "DNA_vec_types.h"
+BLI_INLINE float BLI_rcti_cent_x_fl(const struct rcti *rct) { return (float)(rct->xmin + rct->xmax) / 2.0f; }
+BLI_INLINE float BLI_rcti_cent_y_fl(const struct rcti *rct) { return (float)(rct->ymin + rct->ymax) / 2.0f; }
+BLI_INLINE int   BLI_rcti_cent_x(const struct rcti *rct) { return (rct->xmin + rct->xmax) / 2; }
+BLI_INLINE int   BLI_rcti_cent_y(const struct rcti *rct) { return (rct->ymin + rct->ymax) / 2; }
+BLI_INLINE int   BLI_rctf_cent_x(const struct rctf *rct) { return (rct->xmin + rct->xmax) / 2.0f; }
+BLI_INLINE int   BLI_rctf_cent_y(const struct rctf *rct) { return (rct->ymin + rct->ymax) / 2.0f; }
 
-#define BLI_RCT_CENTER_X_FL(rct)  ((float)((rct)->xmin + (rct)->xmax) / 2.0f)
-#define BLI_RCT_CENTER_Y_FL(rct)  ((float)((rct)->ymin + (rct)->ymax) / 2.0f)
+BLI_INLINE int   BLI_rcti_size_x(const struct rcti *rct) { return (rct->xmax - rct->xmin); }
+BLI_INLINE int   BLI_rcti_size_y(const struct rcti *rct) { return (rct->ymax - rct->ymin); }
+BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct) { return (rct->xmax - rct->xmin); }
+BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct) { return (rct->ymax - rct->ymin); }
 
 #ifdef __cplusplus
 }
index 225ede8..fd0dac5 100644 (file)
@@ -252,8 +252,8 @@ void BLI_rctf_translate(rctf *rect, float x, float y)
 /* change width & height around the central location */
 void BLI_rcti_resize(rcti *rect, int x, int y)
 {
-       rect->xmin = rect->xmax = BLI_RCT_CENTER_X(rect);
-       rect->ymin = rect->ymax = BLI_RCT_CENTER_Y(rect);
+       rect->xmin = rect->xmax = BLI_rcti_cent_x(rect);
+       rect->ymin = rect->ymax = BLI_rcti_cent_y(rect);
        rect->xmin -= x / 2;
        rect->ymin -= y / 2;
        rect->xmax = rect->xmin + x;
@@ -262,8 +262,8 @@ void BLI_rcti_resize(rcti *rect, int x, int y)
 
 void BLI_rctf_resize(rctf *rect, float x, float y)
 {
-       rect->xmin = rect->xmax = BLI_RCT_CENTER_X(rect);
-       rect->ymin = rect->ymax = BLI_RCT_CENTER_Y(rect);
+       rect->xmin = rect->xmax = BLI_rctf_cent_x(rect);
+       rect->ymin = rect->ymax = BLI_rctf_cent_y(rect);
        rect->xmin -= x * 0.5f;
        rect->ymin -= y * 0.5f;
        rect->xmax = rect->xmin + x;
@@ -366,9 +366,9 @@ int BLI_rcti_isect(const rcti *src1, const rcti *src2, rcti *dest)
 void BLI_rcti_rctf_copy(rcti *dst, const rctf *src)
 {
        dst->xmin = floorf(src->xmin + 0.5f);
-       dst->xmax = dst->xmin + floorf(BLI_RCT_SIZE_X(src) + 0.5f);
+       dst->xmax = dst->xmin + floorf(BLI_rctf_size_x(src) + 0.5f);
        dst->ymin = floorf(src->ymin + 0.5f);
-       dst->ymax = dst->ymin + floorf(BLI_RCT_SIZE_Y(src) + 0.5f);
+       dst->ymax = dst->ymin + floorf(BLI_rctf_size_y(src) + 0.5f);
 }
 
 void BLI_rctf_rcti_copy(rctf *dst, const rcti *src)
@@ -382,11 +382,11 @@ void BLI_rctf_rcti_copy(rctf *dst, const rcti *src)
 void print_rctf(const char *str, const rctf *rect)
 {
        printf("%s: xmin %.3f, xmax %.3f, ymin %.3f, ymax %.3f (%.3fx%.3f)\n", str,
-              rect->xmin, rect->xmax, rect->ymin, rect->ymax, BLI_RCT_SIZE_X(rect), BLI_RCT_SIZE_Y(rect));
+              rect->xmin, rect->xmax, rect->ymin, rect->ymax, BLI_rctf_size_x(rect), BLI_rctf_size_y(rect));
 }
 
 void print_rcti(const char *str, const rcti *rect)
 {
        printf("%s: xmin %d, xmax %d, ymin %d, ymax %d (%dx%d)\n", str,
-              rect->xmin, rect->xmax, rect->ymin, rect->ymax, BLI_RCT_SIZE_X(rect), BLI_RCT_SIZE_Y(rect));
+              rect->xmin, rect->xmax, rect->ymin, rect->ymax, BLI_rcti_size_x(rect), BLI_rcti_size_y(rect));
 }
index 422a600..bab1442 100644 (file)
@@ -147,7 +147,7 @@ void BLI_str_cursor_step_utf8(const char *str, size_t maxlen,
                               int *pos, strCursorJumpDirection direction,
                               strCursorJumpType jump)
 {
-       const short pos_prev = *pos;
+       const int pos_prev = *pos;
 
        if (direction == STRCUR_DIR_NEXT) {
                BLI_str_cursor_step_next_utf8(str, maxlen, pos);
index c4b4452..9c09c9b 100644 (file)
@@ -79,7 +79,7 @@ void DilateErodeThresholdOperation::executePixel(float output[4], int x, int y,
        const int miny = max(y - this->m_scope, rect->ymin);
        const int maxx = min(x + this->m_scope, rect->xmax);
        const int maxy = min(y + this->m_scope, rect->ymax);
-       const int bufferWidth = BLI_RCT_SIZE_X(rect);
+       const int bufferWidth = BLI_rcti_size_x(rect);
        int offset;
 
        this->m_inputProgram->read(inputValue, x, y, NULL);
@@ -199,7 +199,7 @@ void DilateDistanceOperation::executePixel(float output[4], int x, int y, void *
        const int miny = max(y - this->m_scope, rect->ymin);
        const int maxx = min(x + this->m_scope, rect->xmax);
        const int maxy = min(y + this->m_scope, rect->ymax);
-       const int bufferWidth = BLI_RCT_SIZE_X(rect);
+       const int bufferWidth = BLI_rcti_size_x(rect);
        int offset;
        
        float value = 0.0f;
@@ -273,7 +273,7 @@ void ErodeDistanceOperation::executePixel(float output[4], int x, int y, void *d
        const int miny = max(y - this->m_scope, rect->ymin);
        const int maxx = min(x + this->m_scope, rect->xmax);
        const int maxy = min(y + this->m_scope, rect->ymax);
-       const int bufferWidth = BLI_RCT_SIZE_X(rect);
+       const int bufferWidth = BLI_rcti_size_x(rect);
        int offset;
        
        float value = 1.0f;
index 86f7295..4c24489 100644 (file)
@@ -3068,7 +3068,7 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float
                }
 
                /* check if there's enough space for the toggles if the sliders are drawn too */
-               if (!(draw_sliders) || (BLI_RCT_SIZE_X(&v2d->mask) > ACHANNEL_BUTTON_WIDTH / 2) ) {
+               if (!(draw_sliders) || (BLI_rcti_size_x(&v2d->mask) > ACHANNEL_BUTTON_WIDTH / 2) ) {
                        /* protect... */
                        if (acf->has_setting(ac, ale, ACHANNEL_SETTING_PROTECT))
                                offset += ICON_WIDTH;
@@ -3460,7 +3460,7 @@ void ANIM_channel_draw_widgets(bContext *C, bAnimContext *ac, bAnimListElem *ale
                }
                
                /* check if there's enough space for the toggles if the sliders are drawn too */
-               if (!(draw_sliders) || (BLI_RCT_SIZE_X(&v2d->mask) > ACHANNEL_BUTTON_WIDTH / 2) ) {
+               if (!(draw_sliders) || (BLI_rcti_size_x(&v2d->mask) > ACHANNEL_BUTTON_WIDTH / 2) ) {
                        /* protect... */
                        if (acf->has_setting(ac, ale, ACHANNEL_SETTING_PROTECT)) {
                                offset += ICON_WIDTH; 
index 445b684..270e7fc 100644 (file)
@@ -354,7 +354,7 @@ static void draw_marker(View2D *v2d, TimeMarker *marker, int cfra, int flag)
        xpos = marker->frame;
        
        /* no time correction for framelen! space is drawn with old values */
-       ypixels = BLI_RCT_SIZE_Y(&v2d->mask);
+       ypixels = BLI_rcti_size_y(&v2d->mask);
        UI_view2d_getscale(v2d, &xscale, &yscale);
        
        glScalef(1.0f / xscale, 1.0f, 1.0f);
@@ -773,7 +773,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
                        if (hasNumInput(&mm->num))
                                break;
                        
-                       dx = BLI_RCT_SIZE_X(&v2d->cur) / BLI_RCT_SIZE_X(&v2d->mask);
+                       dx = BLI_rctf_size_x(&v2d->cur) / BLI_rcti_size_x(&v2d->mask);
                        
                        if (evt->x != mm->evtx) {   /* XXX maybe init for first time */
                                int a, offs, totmark = 0;
index 5d67b63..659e996 100644 (file)
@@ -422,8 +422,8 @@ static void gp_strokepoint_convertcoords(bContext *C, bGPDstroke *gps, bGPDspoin
                }
                else {
                        if (subrect) {
-                               mvalf[0] = (((float)pt->x / 100.0f) * BLI_RCT_SIZE_X(subrect)) + subrect->xmin;
-                               mvalf[1] = (((float)pt->y / 100.0f) * BLI_RCT_SIZE_Y(subrect)) + subrect->ymin;
+                               mvalf[0] = (((float)pt->x / 100.0f) * BLI_rctf_size_x(subrect)) + subrect->xmin;
+                               mvalf[1] = (((float)pt->y / 100.0f) * BLI_rctf_size_y(subrect)) + subrect->ymin;
                        }
                        else {
                                mvalf[0] = (float)pt->x / 100.0f * ar->winx;
index 4e281b9..72a4037 100644 (file)
@@ -299,8 +299,8 @@ static void gp_stroke_convertcoords(tGPsdata *p, const int mval[2], float out[3]
                        out[1] = (float)(mval[1]) / (float)(p->ar->winy) * 100;
                }
                else { /* camera view, use subrect */
-                       out[0] = ((mval[0] - p->subrect->xmin) / BLI_RCT_SIZE_X(p->subrect)) * 100;
-                       out[1] = ((mval[1] - p->subrect->ymin) / BLI_RCT_SIZE_Y(p->subrect)) * 100;
+                       out[0] = ((mval[0] - p->subrect->xmin) / BLI_rctf_size_x(p->subrect)) * 100;
+                       out[1] = ((mval[1] - p->subrect->ymin) / BLI_rctf_size_y(p->subrect)) * 100;
                }
        }
 }
@@ -821,8 +821,8 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p,
                                y0 = (int)(gps->points->y / 100 * p->ar->winy);
                        }
                        else { /* camera view, use subrect */
-                               x0 = (int)((gps->points->x / 100) * BLI_RCT_SIZE_X(p->subrect)) + p->subrect->xmin;
-                               y0 = (int)((gps->points->y / 100) * BLI_RCT_SIZE_Y(p->subrect)) + p->subrect->ymin;
+                               x0 = (int)((gps->points->x / 100) * BLI_rctf_size_x(p->subrect)) + p->subrect->xmin;
+                               y0 = (int)((gps->points->y / 100) * BLI_rctf_size_y(p->subrect)) + p->subrect->ymin;
                        }
                }
                
@@ -868,10 +868,10 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p,
                                        y1 = (int)(pt2->y / 100 * p->ar->winy);
                                }
                                else { /* camera view, use subrect */ 
-                                       x0 = (int)((pt1->x / 100) * BLI_RCT_SIZE_X(p->subrect)) + p->subrect->xmin;
-                                       y0 = (int)((pt1->y / 100) * BLI_RCT_SIZE_Y(p->subrect)) + p->subrect->ymin;
-                                       x1 = (int)((pt2->x / 100) * BLI_RCT_SIZE_X(p->subrect)) + p->subrect->xmin;
-                                       y1 = (int)((pt2->y / 100) * BLI_RCT_SIZE_Y(p->subrect)) + p->subrect->ymin;
+                                       x0 = (int)((pt1->x / 100) * BLI_rctf_size_x(p->subrect)) + p->subrect->xmin;
+                                       y0 = (int)((pt1->y / 100) * BLI_rctf_size_y(p->subrect)) + p->subrect->ymin;
+                                       x1 = (int)((pt2->x / 100) * BLI_rctf_size_x(p->subrect)) + p->subrect->xmin;
+                                       y1 = (int)((pt2->y / 100) * BLI_rctf_size_y(p->subrect)) + p->subrect->ymin;
                                }
                        }
                        
index 792c96f..24759fa 100644 (file)
@@ -163,7 +163,8 @@ void UI_view2d_view_orthoSpecial(struct ARegion *ar, struct View2D *v2d, short x
 void UI_view2d_view_restore(const struct bContext *C);
 
 /* grid drawing */
-View2DGrid *UI_view2d_grid_calc(struct Scene *scene, struct View2D *v2d, short xunits, short xclamp, short yunits, short yclamp, int winx, int winy);
+View2DGrid *UI_view2d_grid_calc(struct Scene *scene, struct View2D *v2d,
+                                short xunits, short xclamp, short yunits, short yclamp, int winx, int winy);
 void UI_view2d_grid_draw(struct View2D *v2d, View2DGrid *grid, int flag);
 void UI_view2d_constant_grid_draw(struct View2D *v2d);
 void UI_view2d_multi_grid_draw(struct View2D *v2d, float step, int level_size, int totlevels);
@@ -171,14 +172,21 @@ void UI_view2d_grid_size(View2DGrid *grid, float *r_dx, float *r_dy);
 void UI_view2d_grid_free(View2DGrid *grid);
 
 /* scrollbar drawing */
-View2DScrollers *UI_view2d_scrollers_calc(const struct bContext *C, struct View2D *v2d, short xunits, short xclamp, short yunits, short yclamp);
+View2DScrollers *UI_view2d_scrollers_calc(const struct bContext *C, struct View2D *v2d,
+                                          short xunits, short xclamp, short yunits, short yclamp);
 void UI_view2d_scrollers_draw(const struct bContext *C, struct View2D *v2d, View2DScrollers *scrollers);
 void UI_view2d_scrollers_free(View2DScrollers *scrollers);
 
 /* list view tools */
-void UI_view2d_listview_cell_to_view(struct View2D *v2d, short columnwidth, short rowheight, float startx, float starty, int column, int row, struct rctf *rect);
-void UI_view2d_listview_view_to_cell(struct View2D *v2d, short columnwidth, short rowheight, float startx, float starty, float viewx, float viewy, int *column, int *row);
-void UI_view2d_listview_visible_cells(struct View2D *v2d, short columnwidth, short rowheight, float startx, float starty, int *column_min, int *column_max, int *row_min, int *row_max);
+void UI_view2d_listview_cell_to_view(struct View2D *v2d, short columnwidth, short rowheight,
+                                     float startx, float starty, int column, int row,
+                                     struct rctf *rect);
+void UI_view2d_listview_view_to_cell(struct View2D *v2d, short columnwidth, short rowheight,
+                                     float startx, float starty, float viewx, float viewy,
+                                     int *column, int *row);
+void UI_view2d_listview_visible_cells(struct View2D *v2d, short columnwidth, short rowheight,
+                                      float startx, float starty, int *column_min, int *column_max,
+                                      int *row_min, int *row_max);
 
 /* coordinate conversion */
 void UI_view2d_region_to_view(struct View2D *v2d, int x, int y, float *viewx, float *viewy);
index 742aed4..8a00841 100644 (file)
@@ -106,8 +106,8 @@ void ui_block_to_window_fl(const ARegion *ar, uiBlock *block, float *x, float *y
        float gx, gy;
        int sx, sy, getsizex, getsizey;
 
-       getsizex = BLI_RCT_SIZE_X(&ar->winrct) + 1;
-       getsizey = BLI_RCT_SIZE_Y(&ar->winrct) + 1;
+       getsizex = BLI_rcti_size_x(&ar->winrct) + 1;
+       getsizey = BLI_rcti_size_y(&ar->winrct) + 1;
        sx = ar->winrct.xmin;
        sy = ar->winrct.ymin;
 
@@ -152,8 +152,8 @@ void ui_window_to_block_fl(const ARegion *ar, uiBlock *block, float *x, float *y
        float a, b, c, d, e, f, px, py;
        int sx, sy, getsizex, getsizey;
 
-       getsizex = BLI_RCT_SIZE_X(&ar->winrct) + 1;
-       getsizey = BLI_RCT_SIZE_Y(&ar->winrct) + 1;
+       getsizex = BLI_rcti_size_x(&ar->winrct) + 1;
+       getsizey = BLI_rcti_size_y(&ar->winrct) + 1;
        sx = ar->winrct.xmin;
        sy = ar->winrct.ymin;
 
@@ -279,7 +279,7 @@ void ui_bounds_block(uiBlock *block)
                block->rect.ymax += block->bounds;
        }
 
-       block->rect.xmax = block->rect.xmin + maxf(BLI_RCT_SIZE_X(&block->rect), block->minbounds);
+       block->rect.xmax = block->rect.xmin + maxf(BLI_rctf_size_x(&block->rect), block->minbounds);
 
        /* hardcoded exception... but that one is annoying with larger safety */ 
        bt = block->buttons.first;
@@ -307,8 +307,8 @@ static void ui_centered_bounds_block(const bContext *C, uiBlock *block)
        
        ui_bounds_block(block);
        
-       width  = BLI_RCT_SIZE_X(&block->rect);
-       height = BLI_RCT_SIZE_Y(&block->rect);
+       width  = BLI_rctf_size_x(&block->rect);
+       height = BLI_rctf_size_y(&block->rect);
        
        startx = (xmax * 0.5f) - (width * 0.5f);
        starty = (ymax * 0.5f) - (height * 0.5f);
@@ -332,8 +332,8 @@ static void ui_popup_bounds_block(const bContext *C, uiBlock *block, eBlockBound
        
        wm_window_get_size(window, &xmax, &ymax);
 
-       oldwidth  = BLI_RCT_SIZE_X(&block->rect);
-       oldheight = BLI_RCT_SIZE_Y(&block->rect);
+       oldwidth  = BLI_rctf_size_x(&block->rect);
+       oldheight = BLI_rctf_size_y(&block->rect);
 
        /* first we ensure wide enough text bounds */
        if (bounds_calc == UI_BLOCK_BOUNDS_POPUP_MENU) {
@@ -348,8 +348,8 @@ static void ui_popup_bounds_block(const bContext *C, uiBlock *block, eBlockBound
        ui_bounds_block(block);
 
        /* and we adjust the position to fit within window */
-       width  = BLI_RCT_SIZE_X(&block->rect);
-       height = BLI_RCT_SIZE_Y(&block->rect);
+       width  = BLI_rctf_size_x(&block->rect);
+       height = BLI_rctf_size_y(&block->rect);
 
        /* avoid divide by zero below, caused by calling with no UI, but better not crash */
        oldwidth = oldwidth > 0 ? oldwidth : MAX2(1, width);
@@ -495,10 +495,10 @@ static void ui_draw_linkline(uiLinkLine *line, int highlightActiveLines)
 
        if (line->from == NULL || line->to == NULL) return;
        
-       rect.xmin = BLI_RCT_CENTER_X(&line->from->rect);
-       rect.ymin = BLI_RCT_CENTER_Y(&line->from->rect);
-       rect.xmax = BLI_RCT_CENTER_X(&line->to->rect);
-       rect.ymax = BLI_RCT_CENTER_Y(&line->to->rect);
+       rect.xmin = BLI_rctf_cent_x(&line->from->rect);
+       rect.ymin = BLI_rctf_cent_y(&line->from->rect);
+       rect.xmax = BLI_rctf_cent_x(&line->to->rect);
+       rect.ymax = BLI_rctf_cent_y(&line->to->rect);
        
        if (line->flag & UI_SELECT)
                glColor3ub(100, 100, 100);
@@ -2257,7 +2257,7 @@ void ui_check_but(uiBut *but)
        
        
        /* safety is 4 to enable small number buttons (like 'users') */
-       // okwidth= -4 + (BLI_RCT_SIZE_X(&but->rect)); // UNUSED
+       // okwidth= -4 + (BLI_rcti_size_x(&but->rect)); // UNUSED
        
        /* name: */
        switch (but->type) {
@@ -2265,7 +2265,7 @@ void ui_check_but(uiBut *but)
                case MENU:
                case ICONTEXTROW:
                
-                       if (BLI_RCT_SIZE_X(&but->rect) > 24.0f) {
+                       if (BLI_rctf_size_x(&but->rect) > 24.0f) {
                                UI_GET_BUT_VALUE_INIT(but, value);
                                ui_set_name_menu(but, (int)value);
                        }
index f535c3c..f83116d 100644 (file)
@@ -440,8 +440,8 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(w
        //glColor4f(1.0, 0.f, 0.f, 1.f);
        //fdrawbox(rect->xmin, rect->ymin, rect->xmax, rect->ymax)
 
-       w = BLI_RCT_SIZE_X(rect);
-       h = BLI_RCT_SIZE_Y(rect);
+       w = BLI_rcti_size_x(rect);
+       h = BLI_rcti_size_y(rect);
        /* prevent drawing outside widget area */
        glGetIntegerv(GL_SCISSOR_BOX, scissor);
        glScissor(ar->winrct.xmin + rect->xmin, ar->winrct.ymin + rect->ymin, w, h);
@@ -494,8 +494,8 @@ static void ui_draw_but_CHARTAB(uiBut *but)
                charmax = G.charmax = 0xffff;
 
        /* Calculate the size of the button */
-       width  = abs(BLI_RCT_SIZE_X(rect));
-       height = abs(BLI_RCT_SIZE_Y(rect));
+       width  = abs(BLI_rcti_size_x(rect));
+       height = abs(BLI_rcti_size_y(rect));
        
        butw = floor(width / 12);
        buth = floor(height / 6);
@@ -633,7 +633,7 @@ static void ui_draw_but_CHARTAB(uiBut *but)
 #endif /* WITH_INTERNATIONAL */
 #endif
 
-static void draw_scope_end(rctf *rect, GLint *scissor)
+static void draw_scope_end(const rctf *rect, GLint *scissor)
 {
        float scaler_x1, scaler_x2;
        
@@ -643,8 +643,8 @@ static void draw_scope_end(rctf *rect, GLint *scissor)
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
        
        /* scale widget */
-       scaler_x1 = rect->xmin + BLI_RCT_SIZE_X(rect) / 2 - SCOPE_RESIZE_PAD;
-       scaler_x2 = rect->xmin + BLI_RCT_SIZE_X(rect) / 2 + SCOPE_RESIZE_PAD;
+       scaler_x1 = rect->xmin + BLI_rctf_size_x(rect) / 2 - SCOPE_RESIZE_PAD;
+       scaler_x2 = rect->xmin + BLI_rctf_size_y(rect) / 2 + SCOPE_RESIZE_PAD;
        
        glColor4f(0.f, 0.f, 0.f, 0.25f);
        fdrawline(scaler_x1, rect->ymin - 4, scaler_x2, rect->ymin - 4);
@@ -733,8 +733,8 @@ void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol)
        rect.ymin = (float)recti->ymin + SCOPE_RESIZE_PAD + 2;
        rect.ymax = (float)recti->ymax - 1;
        
-       w = BLI_RCT_SIZE_X(&rect);
-       h = BLI_RCT_SIZE_Y(&rect) * hist->ymax;
+       w = BLI_rctf_size_x(&rect);
+       h = BLI_rctf_size_y(&rect) * hist->ymax;
        
        glEnable(GL_BLEND);
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@@ -806,9 +806,9 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol),
 
        if (scopes->wavefrm_yfac < 0.5f)
                scopes->wavefrm_yfac = 0.98f;
-       w = BLI_RCT_SIZE_X(&rect) - 7;
-       h = BLI_RCT_SIZE_Y(&rect) * scopes->wavefrm_yfac;
-       yofs = rect.ymin + (BLI_RCT_SIZE_Y(&rect) - h) / 2.0f;
+       w = BLI_rctf_size_x(&rect) - 7;
+       h = BLI_rctf_size_y(&rect) * scopes->wavefrm_yfac;
+       yofs = rect.ymin + (BLI_rctf_size_y(&rect) - h) / 2.0f;
        w3 = w / 3.0f;
        
        /* log scale for alpha */
@@ -1034,8 +1034,8 @@ void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wco
        rect.ymin = (float)recti->ymin + SCOPE_RESIZE_PAD + 2;
        rect.ymax = (float)recti->ymax - 1;
        
-       w = BLI_RCT_SIZE_X(&rect);
-       h = BLI_RCT_SIZE_Y(&rect);
+       w = BLI_rctf_size_x(&rect);
+       h = BLI_rctf_size_y(&rect);
        centerx = rect.xmin + w / 2;
        centery = rect.ymin + h / 2;
        diam = (w < h) ? w : h;
@@ -1267,12 +1267,12 @@ void ui_draw_but_NORMAL(uiBut *but, uiWidgetColors *wcol, rcti *rect)
        
        /* transform to button */
        glPushMatrix();
-       glTranslatef(rect->xmin + 0.5f * BLI_RCT_SIZE_X(rect), rect->ymin + 0.5f * BLI_RCT_SIZE_Y(rect), 0.0f);
+       glTranslatef(rect->xmin + 0.5f * BLI_rcti_size_x(rect), rect->ymin + 0.5f * BLI_rcti_size_y(rect), 0.0f);
        
-       if (BLI_RCT_SIZE_X(rect) < BLI_RCT_SIZE_Y(rect))
-               size = BLI_RCT_SIZE_X(rect) / 200.f;
+       if (BLI_rcti_size_x(rect) < BLI_rcti_size_y(rect))
+               size = BLI_rcti_size_x(rect) / 200.f;
        else
-               size = BLI_RCT_SIZE_Y(rect) / 200.f;
+               size = BLI_rcti_size_y(rect) / 200.f;
        
        glScalef(size, size, size);
        
@@ -1378,12 +1378,12 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
        BLI_rcti_isect(&scissor_new, &ar->winrct, &scissor_new);
        glScissor(scissor_new.xmin,
                  scissor_new.ymin,
-                 BLI_RCT_SIZE_X(&scissor_new),
-                 BLI_RCT_SIZE_Y(&scissor_new));
+                 BLI_rcti_size_x(&scissor_new),
+                 BLI_rcti_size_y(&scissor_new));
 
        /* calculate offset and zoom */
-       zoomx = (BLI_RCT_SIZE_X(rect) - 2.0f * but->aspect) / BLI_RCT_SIZE_X(&cumap->curr);
-       zoomy = (BLI_RCT_SIZE_Y(rect) - 2.0f * but->aspect) / BLI_RCT_SIZE_Y(&cumap->curr);
+       zoomx = (BLI_rcti_size_x(rect) - 2.0f * but->aspect) / BLI_rctf_size_x(&cumap->curr);
+       zoomy = (BLI_rcti_size_y(rect) - 2.0f * but->aspect) / BLI_rctf_size_y(&cumap->curr);
        offsx = cumap->curr.xmin - but->aspect / zoomx;
        offsy = cumap->curr.ymin - but->aspect / zoomy;
        
@@ -1561,8 +1561,8 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc
        rect.ymin = (float)recti->ymin + SCOPE_RESIZE_PAD + 2;
        rect.ymax = (float)recti->ymax - 1;
 
-       width  = BLI_RCT_SIZE_X(&rect) + 1;
-       height = BLI_RCT_SIZE_Y(&rect);
+       width  = BLI_rctf_size_x(&rect) + 1;
+       height = BLI_rctf_size_y(&rect);
 
        glEnable(GL_BLEND);
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@@ -1637,8 +1637,8 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc
                        glTranslatef(rect.xmin + track_pos[0], rect.ymin + track_pos[1], 0.f);
                        glScissor(ar->winrct.xmin + rect.xmin,
                                  ar->winrct.ymin + rect.ymin,
-                                 BLI_RCT_SIZE_X(&rect),
-                                 BLI_RCT_SIZE_Y(&rect));
+                                 BLI_rctf_size_x(&rect),
+                                 BLI_rctf_size_y(&rect));
 
                        for (a = 0; a < 2; a++) {
                                if (a == 1) {
@@ -1729,7 +1729,7 @@ void uiDrawBoxShadow(unsigned char alpha, float minx, float miny, float maxx, fl
 }
 
 
-void ui_dropshadow(rctf *rct, float radius, float aspect, float alpha, int UNUSED(select))
+void ui_dropshadow(const rctf *rct, float radius, float aspect, float alpha, int UNUSED(select))
 {
        int i;
        float rad;
@@ -1738,8 +1738,8 @@ void ui_dropshadow(rctf *rct, float radius, float aspect, float alpha, int UNUSE
        
        glEnable(GL_BLEND);
        
-       if (radius > (BLI_RCT_SIZE_Y(rct) - 10.0f) / 2.0f)
-               rad = (BLI_RCT_SIZE_Y(rct) - 10.0f) / 2.0f;
+       if (radius > (BLI_rctf_size_y(rct) - 10.0f) / 2.0f)
+               rad = (BLI_rctf_size_y(rct) - 10.0f) / 2.0f;
        else
                rad = radius;
 
index f7b2209..1ac0295 100644 (file)
@@ -697,10 +697,10 @@ static int ui_but_mouse_inside_icon(uiBut *but, ARegion *ar, wmEvent *event)
        
        if (but->imb) ;  /* use button size itself */
        else if (but->flag & UI_ICON_LEFT) {
-               rect.xmax = rect.xmin + (BLI_RCT_SIZE_Y(&rect));
+               rect.xmax = rect.xmin + (BLI_rcti_size_y(&rect));
        }
        else {
-               int delta = BLI_RCT_SIZE_X(&rect) - BLI_RCT_SIZE_Y(&rect);
+               int delta = BLI_rcti_size_x(&rect) - BLI_rcti_size_y(&rect);
                rect.xmin += delta / 2;
                rect.xmax -= delta / 2;
        }
@@ -721,7 +721,7 @@ static int ui_but_start_drag(bContext *C, uiBut *but, uiHandleButtonData *data,
                
                drag = WM_event_start_drag(C, but->icon, but->dragtype, but->dragpoin, ui_get_but_val(but));
                if (but->imb)
-                       WM_event_drag_image(drag, but->imb, but->imb_scale, BLI_RCT_SIZE_X(&but->rect), BLI_RCT_SIZE_Y(&but->rect));
+                       WM_event_drag_image(drag, but->imb, but->imb_scale, BLI_rctf_size_x(&but->rect), BLI_rctf_size_y(&but->rect));
                return 1;
        }
        
@@ -1309,7 +1309,7 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, sho
        
        /* XXX solve generic */
        if (but->type == NUM || but->type == NUMSLI)
-               startx += (int)(0.5f * (BLI_RCT_SIZE_Y(&but->rect)));
+               startx += (int)(0.5f * (BLI_rctf_size_y(&but->rect)));
        else if (ELEM(but->type, TEX, SEARCH_MENU)) {
                startx += 5;
                if (but->flag & UI_HAS_ICON)
@@ -2639,7 +2639,7 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
                softmax = but->softmax;
 
                if (!ui_is_but_float(but)) {
-                       if (mx < (but->rect.xmin + BLI_RCT_SIZE_X(&but->rect) / 3 - 3)) {
+                       if (mx < (but->rect.xmin + BLI_rctf_size_x(&but->rect) / 3 - 3)) {
                                button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
 
                                temp = (int)data->value - 1;
@@ -2650,7 +2650,7 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
 
                                button_activate_state(C, but, BUTTON_STATE_EXIT);
                        }
-                       else if (mx > (but->rect.xmin + (2 * BLI_RCT_SIZE_X(&but->rect) / 3) + 3)) {
+                       else if (mx > (but->rect.xmin + (2 * BLI_rctf_size_x(&but->rect) / 3) + 3)) {
                                button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
 
                                temp = (int)data->value + 1;
@@ -2665,7 +2665,7 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
                                button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
                }
                else {
-                       if (mx < (but->rect.xmin + BLI_RCT_SIZE_X(&but->rect) / 3 - 3)) {
+                       if (mx < (but->rect.xmin + BLI_rctf_size_x(&but->rect) / 3 - 3)) {
                                button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
 
                                tempf = (float)data->value - 0.01f * but->a1;
@@ -2674,7 +2674,7 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
 
                                button_activate_state(C, but, BUTTON_STATE_EXIT);
                        }
-                       else if (mx > but->rect.xmin + (2 * (BLI_RCT_SIZE_X(&but->rect) / 3) + 3)) {
+                       else if (mx > but->rect.xmin + (2 * (BLI_rctf_size_x(&but->rect) / 3) + 3)) {
                                button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
 
                                tempf = (float)data->value + 0.01f * but->a1;
@@ -2702,14 +2702,14 @@ static int ui_numedit_but_SLI(uiBut *but, uiHandleButtonData *data, const short
        softmax = but->softmax;
        softrange = softmax - softmin;
 
-       if (but->type == NUMSLI) deler = (BLI_RCT_SIZE_X(&but->rect) - 5.0f * but->aspect);
-       else if (but->type == HSVSLI) deler = (BLI_RCT_SIZE_X(&but->rect) / 2.0f - 5.0f * but->aspect);
+       if (but->type == NUMSLI) deler = (BLI_rctf_size_x(&but->rect) - 5.0f * but->aspect);
+       else if (but->type == HSVSLI) deler = (BLI_rctf_size_x(&but->rect) / 2.0f - 5.0f * but->aspect);
        else if (but->type == SCROLL) {
-               int horizontal = (BLI_RCT_SIZE_X(&but->rect) > BLI_RCT_SIZE_Y(&but->rect));
-               float size = (horizontal) ? BLI_RCT_SIZE_X(&but->rect) : -BLI_RCT_SIZE_Y(&but->rect);
+               int horizontal = (BLI_rctf_size_x(&but->rect) > BLI_rctf_size_y(&but->rect));
+               float size = (horizontal) ? BLI_rctf_size_x(&but->rect) : -BLI_rctf_size_y(&but->rect);
                deler = size * (but->softmax - but->softmin) / (but->softmax - but->softmin + but->a1);
        }
-       else deler = (BLI_RCT_SIZE_X(&but->rect) - 5.0f * but->aspect);
+       else deler = (BLI_rctf_size_x(&but->rect) - 5.0f * but->aspect);
 
        f = (float)(mx - data->dragstartx) / deler + data->dragfstart;
        
@@ -2792,7 +2792,7 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
                        }
                        /* alt-click on sides to get "arrows" like in NUM buttons, and match wheel usage above */
                        else if (event->type == LEFTMOUSE && event->alt) {
-                               int halfpos = BLI_RCT_CENTER_X(&but->rect);
+                               int halfpos = BLI_rctf_cent_x(&but->rect);
                                click = 2;
                                if (mx < halfpos)
                                        mx = but->rect.xmin;
@@ -2859,12 +2859,12 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
 
 #if 0
                        if (but->type == SLI) {
-                               f = (float)(mx - but->rect.xmin) / (BLI_RCT_SIZE_X(&but->rect)); /* same as below */
+                               f = (float)(mx - but->rect.xmin) / (BLI_rctf_size_x(&but->rect)); /* same as below */
                        }
                        else
 #endif
                        {
-                               f = (float)(mx - but->rect.xmin) / (BLI_RCT_SIZE_X(&but->rect));
+                               f = (float)(mx - but->rect.xmin) / (BLI_rctf_size_x(&but->rect));
                        }
                        
                        f = softmin + f * softrange;
@@ -2905,7 +2905,7 @@ static int ui_do_but_SCROLL(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
 {
        int mx, my /*, click= 0 */;
        int retval = WM_UI_HANDLER_CONTINUE;
-       int horizontal = (BLI_RCT_SIZE_X(&but->rect) > BLI_RCT_SIZE_Y(&but->rect));
+       int horizontal = (BLI_rctf_size_x(&but->rect) > BLI_rctf_size_y(&but->rect));
        
        mx = event->x;
        my = event->y;
@@ -3063,7 +3063,7 @@ static int ui_numedit_but_NORMAL(uiBut *but, uiHandleButtonData *data, int mx, i
         * else we'll get a harmless but annoying jump when first clicking */
 
        fp = data->origvec;
-       rad = BLI_RCT_SIZE_X(&but->rect);
+       rad = BLI_rctf_size_x(&but->rect);
        radsq = rad * rad;
        
        if (fp[2] > 0.0f) {
@@ -3173,8 +3173,8 @@ static int ui_numedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, int mx,
        rgb_to_hsv_compat_v(rgb, hsv);
 
        /* relative position within box */
-       x = ((float)mx_fl - but->rect.xmin) / BLI_RCT_SIZE_X(&but->rect);
-       y = ((float)my_fl - but->rect.ymin) / BLI_RCT_SIZE_Y(&but->rect);
+       x = ((float)mx_fl - but->rect.xmin) / BLI_rctf_size_x(&but->rect);
+       y = ((float)my_fl - but->rect.ymin) / BLI_rctf_size_y(&but->rect);
        CLAMP(x, 0.0f, 1.0f);
        CLAMP(y, 0.0f, 1.0f);
 
@@ -3575,7 +3575,7 @@ static int ui_numedit_but_COLORBAND(uiBut *but, uiHandleButtonData *data, int mx
        if (data->draglastx == mx)
                return changed;
 
-       dx = ((float)(mx - data->draglastx)) / BLI_RCT_SIZE_X(&but->rect);
+       dx = ((float)(mx - data->draglastx)) / BLI_rctf_size_x(&but->rect);
        data->dragcbd->pos += dx;
        CLAMP(data->dragcbd->pos, 0.0f, 1.0f);
        
@@ -3604,7 +3604,7 @@ static int ui_do_but_COLORBAND(bContext *C, uiBlock *block, uiBut *but, uiHandle
 
                        if (event->ctrl) {
                                /* insert new key on mouse location */
-                               float pos = ((float)(mx - but->rect.xmin)) / BLI_RCT_SIZE_X(&but->rect);
+                               float pos = ((float)(mx - but->rect.xmin)) / BLI_rctf_size_x(&but->rect);
                                colorband_element_add(coba, pos);
                                button_activate_state(C, but, BUTTON_STATE_EXIT);
                        }
@@ -3616,7 +3616,7 @@ static int ui_do_but_COLORBAND(bContext *C, uiBlock *block, uiBut *but, uiHandle
 
                                /* activate new key when mouse is close */
                                for (a = 0, cbd = coba->data; a < coba->tot; a++, cbd++) {
-                                       xco = but->rect.xmin + (cbd->pos * BLI_RCT_SIZE_X(&but->rect));
+                                       xco = but->rect.xmin + (cbd->pos * BLI_rctf_size_x(&but->rect));
                                        xco = ABS(xco - mx);
                                        if (a == coba->cur) xco += 5;  // selected one disadvantage
                                        if (xco < mindist) {
@@ -3657,8 +3657,8 @@ static int ui_numedit_but_CURVE(uiBut *but, uiHandleButtonData *data, int snap,
        float fx, fy, zoomx, zoomy /*, offsx, offsy */ /* UNUSED */;
        int a, changed = 0;
 
-       zoomx = BLI_RCT_SIZE_X(&but->rect) / BLI_RCT_SIZE_X(&cumap->curr);
-       zoomy = BLI_RCT_SIZE_Y(&but->rect) / BLI_RCT_SIZE_Y(&cumap->curr);
+       zoomx = BLI_rctf_size_x(&but->rect) / BLI_rctf_size_x(&cumap->curr);
+       zoomy = BLI_rctf_size_y(&but->rect) / BLI_rctf_size_y(&cumap->curr);
        /* offsx= cumap->curr.xmin; */
        /* offsy= cumap->curr.ymin; */
 
@@ -3753,8 +3753,8 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt
                        float dist, mindist = 200.0f; // 14 pixels radius
                        int sel = -1;
 
-                       zoomx = BLI_RCT_SIZE_X(&but->rect) / BLI_RCT_SIZE_X(&cumap->curr);
-                       zoomy = BLI_RCT_SIZE_Y(&but->rect) / BLI_RCT_SIZE_Y(&cumap->curr);
+                       zoomx = BLI_rctf_size_x(&but->rect) / BLI_rctf_size_x(&cumap->curr);
+                       zoomy = BLI_rctf_size_y(&but->rect) / BLI_rctf_size_y(&cumap->curr);
                        offsx = cumap->curr.xmin;
                        offsy = cumap->curr.ymin;
 
@@ -3899,7 +3899,7 @@ static int ui_numedit_but_HISTOGRAM(uiBut *but, uiHandleButtonData *data, int mx
 
        if (in_scope_resize_zone(but, data->dragstartx, data->dragstarty)) {
                /* resize histogram widget itself */
-               hist->height = BLI_RCT_SIZE_Y(&but->rect) + (data->dragstarty - my);
+               hist->height = BLI_rctf_size_y(&but->rect) + (data->dragstarty - my);
        }
        else {
                /* scale histogram values (dy / 10 for better control) */
@@ -3983,7 +3983,7 @@ static int ui_numedit_but_WAVEFORM(uiBut *but, uiHandleButtonData *data, int mx,
 
        if (in_scope_resize_zone(but, data->dragstartx, data->dragstarty)) {
                /* resize waveform widget itself */
-               scopes->wavefrm_height = BLI_RCT_SIZE_Y(&but->rect) + (data->dragstarty - my);
+               scopes->wavefrm_height = BLI_rctf_size_y(&but->rect) + (data->dragstarty - my);
        }
        else {
                /* scale waveform values */
@@ -4065,7 +4065,7 @@ static int ui_numedit_but_VECTORSCOPE(uiBut *but, uiHandleButtonData *data, int
 
        if (in_scope_resize_zone(but, data->dragstartx, data->dragstarty)) {
                /* resize vectorscope widget itself */
-               scopes->vecscope_height = BLI_RCT_SIZE_Y(&but->rect) + (data->dragstarty - my);
+               scopes->vecscope_height = BLI_rctf_size_y(&but->rect) + (data->dragstarty - my);
        }
 
        data->draglastx = mx;
@@ -4135,8 +4135,8 @@ static int ui_do_but_CHARTAB(bContext *UNUSED(C), uiBlock *UNUSED(block), uiBut
        if (data->state == BUTTON_STATE_HIGHLIGHT) {
                if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) {
                        /* Calculate the size of the button */
-                       width  = abs(BLI_RCT_SIZE_X(&but->rect));
-                       height = abs(BLI_RCT_SIZE_Y(&but->rect));
+                       width  = abs(BLI_rctf_size_x(&but->rect));
+                       height = abs(BLI_rctf_size_y(&but->rect));
 
                        butw = floor(width / 12);
                        buth = floor(height / 6);
@@ -4268,7 +4268,7 @@ static int ui_numedit_but_TRACKPREVIEW(bContext *C, uiBut *but, uiHandleButtonDa
 
        if (in_scope_resize_zone(but, data->dragstartx, data->dragstarty)) {
                /* resize preview widget itself */
-               scopes->track_preview_height = BLI_RCT_SIZE_Y(&but->rect) + (data->dragstarty - my);
+               scopes->track_preview_height = BLI_rctf_size_y(&but->rect) + (data->dragstarty - my);
        }
        else {
                if (!scopes->track_locked) {
@@ -4276,8 +4276,8 @@ static int ui_numedit_but_TRACKPREVIEW(bContext *C, uiBut *but, uiHandleButtonDa
                                scopes->marker = BKE_tracking_marker_ensure(scopes->track, scopes->framenr);
 
                        scopes->marker->flag &= ~(MARKER_DISABLED | MARKER_TRACKED);
-                       scopes->marker->pos[0] += -dx * scopes->slide_scale[0] / BLI_RCT_SIZE_X(&but->block->rect);
-                       scopes->marker->pos[1] += -dy * scopes->slide_scale[1] / BLI_RCT_SIZE_Y(&but->block->rect);
+                       scopes->marker->pos[0] += -dx * scopes->slide_scale[0] / BLI_rctf_size_x(&but->block->rect);
+                       scopes->marker->pos[1] += -dy * scopes->slide_scale[1] / BLI_rctf_size_y(&but->block->rect);
 
                        WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, NULL);
                }
index 928e167..d90d653 100644 (file)
@@ -473,7 +473,7 @@ extern int ui_handler_panel_region(struct bContext *C, struct wmEvent *event);
 extern void ui_draw_aligned_panel(struct uiStyle *style, uiBlock *block, rcti *rect);
 
 /* interface_draw.c */
-extern void ui_dropshadow(rctf *rct, float radius, float aspect, float alpha, int select);
+extern void ui_dropshadow(const rctf *rct, float radius, float aspect, float alpha, int select);
 
 void ui_draw_gradient(rcti *rect, const float hsv[3], const int type, const float alpha);
 
index 803fd92..8ffbcd6 100644 (file)
@@ -239,10 +239,8 @@ static void ui_item_size(uiItem *item, int *r_w, int *r_h)
        if (item->type == ITEM_BUTTON) {
                uiButtonItem *bitem = (uiButtonItem *)item;
 
-
-
-               if (r_w) *r_w = BLI_RCT_SIZE_X(&bitem->but->rect);
-               if (r_h) *r_h = BLI_RCT_SIZE_Y(&bitem->but->rect);
+               if (r_w) *r_w = BLI_rctf_size_x(&bitem->but->rect);
+               if (r_h) *r_h = BLI_rctf_size_y(&bitem->but->rect);
        }
        else {
                uiLayout *litem = (uiLayout *)item;
index fa3e04d..49e96be 100644 (file)
@@ -357,14 +357,14 @@ void UI_DrawTriIcon(float x, float y, char dir)
 }
 
 /* triangle 'icon' inside rect */
-static void ui_draw_tria_rect(rctf *rect, char dir)
+static void ui_draw_tria_rect(const rctf *rect, char dir)
 {
        if (dir == 'h') {
-               float half = 0.5f * BLI_RCT_SIZE_Y(rect);
+               float half = 0.5f * BLI_rctf_size_y(rect);
                ui_draw_anti_tria(rect->xmin, rect->ymin, rect->xmin, rect->ymax, rect->xmax, rect->ymin + half);
        }
        else {
-               float half = 0.5f * BLI_RCT_SIZE_X(rect);
+               float half = 0.5f * BLI_rctf_size_x(rect);
                ui_draw_anti_tria(rect->xmin, rect->ymax, rect->xmax, rect->ymax, rect->xmin + half, rect->ymin);
        }
 }
@@ -479,12 +479,12 @@ static void ui_draw_aligned_panel_header(uiStyle *style, uiBlock *block, rcti *r
        }
 }
 
-static void rectf_scale(rctf *rect, float scale)
+static void rectf_scale(rctf *rect, const float scale)
 {
-       float centx = 0.5f * (rect->xmin + rect->xmax);
-       float centy = 0.5f * (rect->ymin + rect->ymax);
-       float sizex = 0.5f * scale * BLI_RCT_SIZE_X(rect);
-       float sizey = 0.5f * scale * BLI_RCT_SIZE_Y(rect);
+       float centx = BLI_rctf_cent_x(rect);
+       float centy = BLI_rctf_cent_y(rect);
+       float sizex = BLI_rctf_size_x(rect) * 0.5f * scale;
+       float sizey = BLI_rctf_size_y(rect) * 0.5f * scale;
        
        rect->xmin = centx - sizex;
        rect->xmax = centx + sizex;
@@ -547,7 +547,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
                
                /* itemrect smaller */  
                itemrect.xmax = headrect.xmax - 5.0f / block->aspect;
-               itemrect.xmin = itemrect.xmax - BLI_RCT_SIZE_Y(&headrect);
+               itemrect.xmin = itemrect.xmax - BLI_rcti_size_y(&headrect);
                itemrect.ymin = headrect.ymin;
                itemrect.ymax = headrect.ymax;
 
@@ -596,7 +596,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
        
        /* itemrect smaller */  
        itemrect.xmin = headrect.xmin + 5.0f / block->aspect;
-       itemrect.xmax = itemrect.xmin + BLI_RCT_SIZE_Y(&headrect);
+       itemrect.xmax = itemrect.xmin + BLI_rcti_size_y(&headrect);
        itemrect.ymin = headrect.ymin;
        itemrect.ymax = headrect.ymax;
        
@@ -985,8 +985,8 @@ static void ui_do_drag(const bContext *C, wmEvent *event, Panel *panel)
        dx = (event->x - data->startx) & ~(PNL_GRID - 1);
        dy = (event->y - data->starty) & ~(PNL_GRID - 1);
 
-       dx *= (float)BLI_RCT_SIZE_X(&ar->v2d.cur) / (float)BLI_RCT_SIZE_X(&ar->winrct);
-       dy *= (float)BLI_RCT_SIZE_Y(&ar->v2d.cur) / (float)BLI_RCT_SIZE_Y(&ar->winrct);
+       dx *= (float)BLI_rctf_size_x(&ar->v2d.cur) / (float)BLI_rcti_size_x(&ar->winrct);
+       dy *= (float)BLI_rctf_size_y(&ar->v2d.cur) / (float)BLI_rcti_size_y(&ar->winrct);
        
        if (data->state == PANEL_STATE_DRAG_SCALE) {
                panel->sizex = MAX2(data->startsizex + dx, UI_PANEL_MINX);
index dc9347b..d5300bf 100644 (file)
@@ -393,7 +393,7 @@ static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *ar)
        /* draw text */
        uiStyleFontSet(&data->fstyle);
 
-       bbox.ymax = bbox.ymax - 0.5f * (BLI_RCT_SIZE_Y(&bbox) - data->toth);
+       bbox.ymax = bbox.ymax - 0.5f * (BLI_rcti_size_y(&bbox) - data->toth);
        bbox.ymin = bbox.ymax - data->lineh;
 
        for (i = 0; i < data->totline; i++) {
@@ -732,9 +732,9 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
 
        /* widget rect, in region coords */
        data->bbox.xmin = MENU_SHADOW_SIDE;
-       data->bbox.xmax = BLI_RCT_SIZE_X(&rect_i) + MENU_SHADOW_SIDE;
+       data->bbox.xmax = BLI_rcti_size_x(&rect_i) + MENU_SHADOW_SIDE;
        data->bbox.ymin = MENU_SHADOW_BOTTOM;
-       data->bbox.ymax = BLI_RCT_SIZE_Y(&rect_i) + MENU_SHADOW_BOTTOM;
+       data->bbox.ymax = BLI_rcti_size_y(&rect_i) + MENU_SHADOW_BOTTOM;
        
        /* region bigger for shadow */
        ar->winrct.xmin = rect_i.xmin - MENU_SHADOW_SIDE;
@@ -867,8 +867,8 @@ static void ui_searchbox_butrect(rcti *rect, uiSearchboxData *data, int itemnr)
 {
        /* thumbnail preview */
        if (data->preview) {
-               int butw =  BLI_RCT_SIZE_X(&data->bbox)                 / data->prv_cols;
-               int buth = (BLI_RCT_SIZE_Y(&data->bbox) - 2 * MENU_TOP) / data->prv_rows;
+               int butw =  BLI_rcti_size_x(&data->bbox)                 / data->prv_cols;
+               int buth = (BLI_rcti_size_y(&data->bbox) - 2 * MENU_TOP) / data->prv_rows;
                int row, col;
                
                *rect = data->bbox;
@@ -884,7 +884,7 @@ static void ui_searchbox_butrect(rcti *rect, uiSearchboxData *data, int itemnr)
        }
        /* list view */
        else {
-               int buth = (BLI_RCT_SIZE_Y(&data->bbox) - 2 * MENU_TOP) / SEARCH_ITEMS;
+               int buth = (BLI_rcti_size_y(&data->bbox) - 2 * MENU_TOP) / SEARCH_ITEMS;
                
                *rect = data->bbox;
                rect->xmin = data->bbox.xmin + 3.0f;
@@ -1097,13 +1097,13 @@ static void ui_searchbox_region_draw_cb(const bContext *UNUSED(C), ARegion *ar)
                        if (data->items.more) {
                                ui_searchbox_butrect(&rect, data, data->items.maxitem - 1);
                                glEnable(GL_BLEND);
-                               UI_icon_draw((BLI_RCT_SIZE_X(&rect)) / 2, rect.ymin - 9, ICON_TRIA_DOWN);
+                               UI_icon_draw((BLI_rcti_size_x(&rect)) / 2, rect.ymin - 9, ICON_TRIA_DOWN);
                                glDisable(GL_BLEND);
                        }
                        if (data->items.offset) {
                                ui_searchbox_butrect(&rect, data, 0);
                                glEnable(GL_BLEND);
-                               UI_icon_draw((BLI_RCT_SIZE_X(&rect)) / 2, rect.ymax - 7, ICON_TRIA_UP);
+                               UI_icon_draw((BLI_rcti_size_x(&rect)) / 2, rect.ymax - 7, ICON_TRIA_UP);
                                glDisable(GL_BLEND);
                        }
                }
@@ -1178,16 +1178,16 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
                
                /* widget rect, in region coords */
                data->bbox.xmin = MENU_SHADOW_SIDE;
-               data->bbox.xmax = BLI_RCT_SIZE_X(&ar->winrct) - MENU_SHADOW_SIDE;
+               data->bbox.xmax = BLI_rcti_size_x(&ar->winrct) - MENU_SHADOW_SIDE;
                data->bbox.ymin = MENU_SHADOW_BOTTOM;
-               data->bbox.ymax = BLI_RCT_SIZE_Y(&ar->winrct) - MENU_SHADOW_BOTTOM;
+               data->bbox.ymax = BLI_rcti_size_y(&ar->winrct) - MENU_SHADOW_BOTTOM;
                
                /* check if button is lower half */
-               if (but->rect.ymax < BLI_RCT_CENTER_Y(&but->block->rect)) {
-                       data->bbox.ymin += BLI_RCT_SIZE_Y(&but->rect);
+               if (but->rect.ymax < BLI_rctf_cent_y(&but->block->rect)) {
+                       data->bbox.ymin += BLI_rctf_size_y(&but->rect);
                }
                else {
-                       data->bbox.ymax -= BLI_RCT_SIZE_Y(&but->rect);
+                       data->bbox.ymax -= BLI_rctf_size_y(&but->rect);
                }
        }
        else {
@@ -1202,7 +1202,7 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
                BLI_rctf_translate(&rect_fl, ofsx, ofsy);
        
                /* minimal width */
-               if (BLI_RCT_SIZE_X(&rect_fl) < 150) {
+               if (BLI_rctf_size_x(&rect_fl) < 150) {
                        rect_fl.xmax = rect_fl.xmin + 150;  /* XXX arbitrary */
                }
                
@@ -1235,15 +1235,15 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
                        UI_view2d_to_region_no_clip(&butregion->v2d, 0, but->rect.ymax + ofsy, NULL, &newy1);
                        newy1 += butregion->winrct.ymin;
 
-                       rect_i.ymax = BLI_RCT_SIZE_Y(&rect_i) + newy1;
+                       rect_i.ymax = BLI_rcti_size_y(&rect_i) + newy1;
                        rect_i.ymin = newy1;
                }
 
                /* widget rect, in region coords */
                data->bbox.xmin = MENU_SHADOW_SIDE;
-               data->bbox.xmax = BLI_RCT_SIZE_X(&rect_i) + MENU_SHADOW_SIDE;
+               data->bbox.xmax = BLI_rcti_size_x(&rect_i) + MENU_SHADOW_SIDE;
                data->bbox.ymin = MENU_SHADOW_BOTTOM;
-               data->bbox.ymax = BLI_RCT_SIZE_Y(&rect_i) + MENU_SHADOW_BOTTOM;
+               data->bbox.ymax = BLI_rcti_size_y(&rect_i) + MENU_SHADOW_BOTTOM;
                
                /* region bigger for shadow */
                ar->winrct.xmin = rect_i.xmin - MENU_SHADOW_SIDE;
@@ -1358,15 +1358,15 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
                }
        }
        
-       /* aspect = (float)(BLI_RCT_SIZE_X(&block->rect) + 4);*/ /*UNUSED*/
+       /* aspect = (float)(BLI_rcti_size_x(&block->rect) + 4);*/ /*UNUSED*/
        ui_block_to_window_fl(butregion, but->block, &block->rect.xmin, &block->rect.ymin);
        ui_block_to_window_fl(butregion, but->block, &block->rect.xmax, &block->rect.ymax);
 
        //block->rect.xmin -= 2.0; block->rect.ymin -= 2.0;
        //block->rect.xmax += 2.0; block->rect.ymax += 2.0;
        
-       xsize = BLI_RCT_SIZE_X(&block->rect) + 4;  /* 4 for shadow */
-       ysize = BLI_RCT_SIZE_Y(&block->rect) + 4;
+       xsize = BLI_rctf_size_x(&block->rect) + 4;  /* 4 for shadow */
+       ysize = BLI_rctf_size_y(&block->rect) + 4;
        /* aspect /= (float)xsize;*/ /*UNUSED*/
 
        {
@@ -1497,8 +1497,8 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
 
        /* safety calculus */
        {
-               const float midx = BLI_RCT_CENTER_X(&butrct);
-               const float midy = BLI_RCT_CENTER_Y(&butrct);
+               const float midx = BLI_rctf_cent_x(&butrct);
+               const float midy = BLI_rctf_cent_y(&butrct);
                
                /* when you are outside parent button, safety there should be smaller */
                
@@ -2343,7 +2343,7 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi
 
        if (pup->but) {
                /* minimum width to enforece */
-               minwidth = BLI_RCT_SIZE_X(&pup->but->rect);
+               minwidth = BLI_rctf_size_x(&pup->but->rect);
 
                if (pup->but->type == PULLDOWN || pup->but->menu_create_func) {
                        direction = UI_DOWN;
@@ -2385,7 +2385,7 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi
                         * button, so it doesn't overlap the text too much, also note
                         * the offset is negative because we are inverse moving the
                         * block to be under the mouse */
-                       offset[0] = -(bt->rect.xmin + 0.8f * BLI_RCT_SIZE_X(&bt->rect));
+                       offset[0] = -(bt->rect.xmin + 0.8f * BLI_rctf_size_x(&bt->rect));
                        offset[1] = -(bt->rect.ymin + 0.5f * UI_UNIT_Y);
                }
                else {
@@ -2393,7 +2393,7 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi
                         * on the first item */
                        offset[0] = 0;
                        for (bt = block->buttons.first; bt; bt = bt->next)
-                               offset[0] = mini(offset[0], -(bt->rect.xmin + 0.8f * BLI_RCT_SIZE_X(&bt->rect)));
+                               offset[0] = mini(offset[0], -(bt->rect.xmin + 0.8f * BLI_rctf_size_x(&bt->rect)));
 
                        offset[1] = 1.5 * UI_UNIT_Y;
                }
index b162500..acf7712 100644 (file)
@@ -152,17 +152,17 @@ void uiStyleFontDrawExt(uiFontStyle *fs, rcti *rect, const char *str,
        uiStyleFontSet(fs);
 
        height = BLF_ascender(fs->uifont_id);
-       yofs = ceil(0.5f * (BLI_RCT_SIZE_Y(rect) - height));
+       yofs = ceil(0.5f * (BLI_rcti_size_y(rect) - height));
 
        if (fs->align == UI_STYLE_TEXT_CENTER) {
-               xofs = floor(0.5f * (BLI_RCT_SIZE_X(rect) - BLF_width(fs->uifont_id, str)));
+               xofs = floor(0.5f * (BLI_rcti_size_x(rect) - BLF_width(fs->uifont_id, str)));
                /* don't center text if it chops off the start of the text, 2 gives some margin */
                if (xofs < 2) {
                        xofs = 2;
                }
        }
        else if (fs->align == UI_STYLE_TEXT_RIGHT) {
-               xofs = BLI_RCT_SIZE_X(rect) - BLF_width(fs->uifont_id, str) - 1;
+               xofs = BLI_rcti_size_x(rect) - BLF_width(fs->uifont_id, str) - 1;
        }
        
        /* clip is very strict, so we give it some space */
@@ -209,7 +209,7 @@ void uiStyleFontDrawRotated(uiFontStyle *fs, rcti *rect, const char *str)
 
        height = BLF_ascender(fs->uifont_id);
        /* becomes x-offset when rotated */
-       xofs = ceil(0.5f * (BLI_RCT_SIZE_Y(rect) - height));
+       xofs = ceil(0.5f * (BLI_rcti_size_y(rect) - height));
 
        /* ignore UI_STYLE, always aligned to top */
 
@@ -219,8 +219,8 @@ void uiStyleFontDrawRotated(uiFontStyle *fs, rcti *rect, const char *str)
        angle = 90.0f;
 
        /* translate rect to vertical */
-       txtrect.xmin = rect->xmin - BLI_RCT_SIZE_Y(rect);
-       txtrect.ymin = rect->ymin - BLI_RCT_SIZE_X(rect);
+       txtrect.xmin = rect->xmin - BLI_rcti_size_y(rect);
+       txtrect.ymin = rect->ymin - BLI_rcti_size_x(rect);
        txtrect.xmax = rect->xmin;
        txtrect.ymax = rect->ymin;
 
index 79b9d31..6ae653b 100644 (file)
@@ -1379,7 +1379,7 @@ static void colorband_buttons_large(uiLayout *layout, uiBlock *block, ColorBand
 static void colorband_buttons_small(uiLayout *layout, uiBlock *block, ColorBand *coba, rctf *butr, RNAUpdateCb *cb)
 {
        uiBut *bt;
-       float unit = BLI_RCT_SIZE_X(butr) / 14.0f;
+       float unit = BLI_rctf_size_x(butr) / 14.0f;
        float xs = butr->xmin;
 
        uiBlockBeginAlign(block);
@@ -1405,7 +1405,7 @@ static void colorband_buttons_small(uiLayout *layout, uiBlock *block, ColorBand
                       TIP_("Set interpolation between color stops"));
        uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
 
-       bt = uiDefBut(block, BUT_COLORBAND, 0, "", xs, butr->ymin, BLI_RCT_SIZE_X(butr), UI_UNIT_Y, coba, 0, 0, 0, 0, "");
+       bt = uiDefBut(block, BUT_COLORBAND, 0, "", xs, butr->ymin, BLI_rctf_size_x(butr), UI_UNIT_Y, coba, 0, 0, 0, 0, "");
        uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
 
        uiBlockEndAlign(block);
@@ -1480,7 +1480,7 @@ void uiTemplateHistogram(uiLayout *layout, PointerRNA *ptr, const char *propname
 
        hist->height = (hist->height <= UI_UNIT_Y) ? UI_UNIT_Y : hist->height;
 
-       bt = uiDefBut(block, HISTOGRAM, 0, "", rect.xmin, rect.ymin, BLI_RCT_SIZE_X(&rect), hist->height, hist, 0, 0, 0, 0, "");
+       bt = uiDefBut(block, HISTOGRAM, 0, "", rect.xmin, rect.ymin, BLI_rctf_size_x(&rect), hist->height, hist, 0, 0, 0, 0, "");
        uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
 
        MEM_freeN(cb);
@@ -1517,7 +1517,7 @@ void uiTemplateWaveform(uiLayout *layout, PointerRNA *ptr, const char *propname)
        
        scopes->wavefrm_height = (scopes->wavefrm_height <= UI_UNIT_Y) ? UI_UNIT_Y : scopes->wavefrm_height;
 
-       bt = uiDefBut(block, WAVEFORM, 0, "", rect.xmin, rect.ymin, BLI_RCT_SIZE_X(&rect), scopes->wavefrm_height, scopes, 0, 0, 0, 0, "");
+       bt = uiDefBut(block, WAVEFORM, 0, "", rect.xmin, rect.ymin, BLI_rctf_size_x(&rect), scopes->wavefrm_height, scopes, 0, 0, 0, 0, "");
        (void)bt;  /* UNUSED */
        
        MEM_freeN(cb);
@@ -1554,7 +1554,7 @@ void uiTemplateVectorscope(uiLayout *layout, PointerRNA *ptr, const char *propna
 
        scopes->vecscope_height = (scopes->vecscope_height <= UI_UNIT_Y) ? UI_UNIT_Y : scopes->vecscope_height;
        
-       bt = uiDefBut(block, VECTORSCOPE, 0, "", rect.xmin, rect.ymin, BLI_RCT_SIZE_X(&rect), scopes->vecscope_height, scopes, 0, 0, 0, 0, "");
+       bt = uiDefBut(block, VECTORSCOPE, 0, "", rect.xmin, rect.ymin, BLI_rctf_size_x(&rect), scopes->vecscope_height, scopes, 0, 0, 0, 0, "");
        uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
        
        MEM_freeN(cb);
@@ -1569,11 +1569,11 @@ static void curvemap_buttons_zoom_in(bContext *C, void *cumap_v, void *UNUSED(ar
        float d;
 
        /* we allow 20 times zoom */
-       if (BLI_RCT_SIZE_X(&cumap->curr) > 0.04f * BLI_RCT_SIZE_X(&cumap->clipr)) {
-               d = 0.1154f * BLI_RCT_SIZE_X(&cumap->curr);
+       if (BLI_rctf_size_x(&cumap->curr) > 0.04f * BLI_rctf_size_x(&cumap->clipr)) {
+               d = 0.1154f * BLI_rctf_size_x(&cumap->curr);
                cumap->curr.xmin += d;
                cumap->curr.xmax -= d;
-               d = 0.1154f * BLI_RCT_SIZE_Y(&cumap->curr);
+               d = 0.1154f * BLI_rctf_size_y(&cumap->curr);
                cumap->curr.ymin += d;
                cumap->curr.ymax -= d;
        }
@@ -1587,8 +1587,8 @@ static void curvemap_buttons_zoom_out(bContext *C, void *cumap_v, void *UNUSED(u
        float d, d1;
 
        /* we allow 20 times zoom, but don't view outside clip */
-       if (BLI_RCT_SIZE_X(&cumap->curr) < 20.0f * BLI_RCT_SIZE_X(&cumap->clipr)) {
-               d = d1 = 0.15f * BLI_RCT_SIZE_X(&cumap->curr);
+       if (BLI_rctf_size_x(&cumap->curr) < 20.0f * BLI_rctf_size_x(&cumap->clipr)) {
+               d = d1 = 0.15f * BLI_rctf_size_x(&cumap->curr);
 
                if (cumap->flag & CUMA_DO_CLIP) 
                        if (cumap->curr.xmin - d < cumap->clipr.xmin)
@@ -1601,7 +1601,7 @@ static void curvemap_buttons_zoom_out(bContext *C, void *cumap_v, void *UNUSED(u
                                d1 = -cumap->curr.xmax + cumap->clipr.xmax;
                cumap->curr.xmax += d1;
 
-               d = d1 = 0.15f * BLI_RCT_SIZE_Y(&cumap->curr);
+               d = d1 = 0.15f * BLI_rctf_size_y(&cumap->curr);
 
                if (cumap->flag & CUMA_DO_CLIP) 
                        if (cumap->curr.ymin - d < cumap->clipr.ymin)
index 8a7f2d9..6446e7b 100644 (file)
@@ -259,8 +259,8 @@ static int round_box_shadow_edges(float (*vert)[2], rcti *rect, float rad, int r
        
        rad += step;
        
-       if (2.0f * rad > BLI_RCT_SIZE_Y(rect))
-               rad = 0.5f * BLI_RCT_SIZE_Y(rect);
+       if (2.0f * rad > BLI_rcti_size_y(rect))
+               rad = 0.5f * BLI_rcti_size_y(rect);
        
        minx = rect->xmin - step;
        miny = rect->ymin - step;
@@ -345,8 +345,8 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, fl
        const int vnum = ((roundboxalign & (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT)) == (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT) ||
                          (roundboxalign & (UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT)) == (UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT)) ? 1 : 2;
 
-       minsize = mini(BLI_RCT_SIZE_X(rect) * hnum,
-                      BLI_RCT_SIZE_Y(rect) * vnum);
+       minsize = mini(BLI_rcti_size_x(rect) * hnum,
+                      BLI_rcti_size_y(rect) * vnum);
        
        if (2.0f * rad > minsize)
                rad = 0.5f * minsize;
@@ -491,7 +491,7 @@ static void widget_num_tria(uiWidgetTrias *tria, rcti *rect, float triasize, cha
        float centx, centy, sizex, sizey, minsize;
        int a, i1 = 0, i2 = 1;
        
-       minsize = mini(BLI_RCT_SIZE_X(rect), BLI_RCT_SIZE_Y(rect));
+       minsize = mini(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect));
        
        /* center position and size */
        centx = (float)rect->xmin + 0.5f * minsize;
@@ -526,7 +526,7 @@ static void widget_scroll_circle(uiWidgetTrias *tria, rcti *rect, float triasize
        float centx, centy, sizex, sizey, minsize;
        int a, i1 = 0, i2 = 1;
        
-       minsize = mini(BLI_RCT_SIZE_X(rect), BLI_RCT_SIZE_Y(rect));
+       minsize = mini(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect));
        
        /* center position and size */
        centx = (float)rect->xmin + 0.5f * minsize;
@@ -570,14 +570,14 @@ static void widget_menu_trias(uiWidgetTrias *tria, rcti *rect)
        int a;
                
        /* center position and size */
-       centx = rect->xmax - 0.5f * BLI_RCT_SIZE_Y(rect);
-       centy = rect->ymin + 0.5f * BLI_RCT_SIZE_Y(rect);
-       size = 0.4f * BLI_RCT_SIZE_Y(rect);
+       centx = rect->xmax - 0.5f * BLI_rcti_size_y(rect);
+       centy = rect->ymin + 0.5f * BLI_rcti_size_y(rect);
+       size = 0.4f * BLI_rcti_size_y(rect);
        
        /* XXX exception */
-       asp = ((float)BLI_RCT_SIZE_X(rect)) / ((float)BLI_RCT_SIZE_Y(rect));
+       asp = ((float)BLI_rcti_size_x(rect)) / ((float)BLI_rcti_size_y(rect));
        if (asp > 1.2f && asp < 2.6f)
-               centx = rect->xmax - 0.3f * BLI_RCT_SIZE_Y(rect);
+               centx = rect->xmax - 0.3f * BLI_rcti_size_y(rect);
        
        for (a = 0; a < 6; a++) {
                tria->vec[a][0] = size * menu_tria_vert[a][0] + centx;
@@ -594,9 +594,9 @@ static void widget_check_trias(uiWidgetTrias *tria, rcti *rect)
        int a;
        
        /* center position and size */
-       centx = rect->xmin + 0.5f * BLI_RCT_SIZE_Y(rect);
-       centy = rect->ymin + 0.5f * BLI_RCT_SIZE_Y(rect);
-       size = 0.5f * BLI_RCT_SIZE_Y(rect);
+       centx = rect->xmin + 0.5f * BLI_rcti_size_y(rect);
+       centy = rect->ymin + 0.5f * BLI_rcti_size_y(rect);
+       size = 0.5f * BLI_rcti_size_y(rect);
        
        for (a = 0; a < 6; a++) {
                tria->vec[a][0] = size * check_tria_vert[a][0] + centx;
@@ -840,8 +840,8 @@ static void widget_draw_preview(BIFIconID icon, float UNUSED(alpha), rcti *rect)
        if (icon == ICON_NONE)
                return;
 
-       w = BLI_RCT_SIZE_X(rect);
-       h = BLI_RCT_SIZE_Y(rect);
+       w = BLI_rcti_size_x(rect);
+       h = BLI_rcti_size_y(rect);
        size = MIN2(w, h);
        size -= PREVIEW_PAD * 2;  /* padding */
 
@@ -969,7 +969,7 @@ static void ui_text_clip_give_next_off(uiBut *but)
 static void ui_text_leftclip(uiFontStyle *fstyle, uiBut *but, rcti *rect)
 {
        int border = (but->flag & UI_BUT_ALIGN_RIGHT) ? 8 : 10;
-       int okwidth = BLI_RCT_SIZE_X(rect) - border;
+       int okwidth = BLI_rcti_size_x(rect) - border;
        
        if (but->flag & UI_HAS_ICON) okwidth -= UI_DPI_ICON_SIZE;
        
@@ -1032,7 +1032,7 @@ static void ui_text_leftclip(uiFontStyle *fstyle, uiBut *but, rcti *rect)
 static void ui_text_label_rightclip(uiFontStyle *fstyle, uiBut *but, rcti *rect)
 {
        int border = (but->flag & UI_BUT_ALIGN_RIGHT) ? 8 : 10;
-       int okwidth = BLI_RCT_SIZE_X(rect) - border;
+       int okwidth = BLI_rcti_size_x(rect) - border;
        char *cpoin = NULL;
        char *cpend = but->drawstr + strlen(but->drawstr);
        
@@ -1266,7 +1266,7 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB
                }
                else if (but->type == MENU && (but->flag & UI_BUT_NODE_LINK)) {
                        int tmp = rect->xmin;
-                       rect->xmin = rect->xmax - BLI_RCT_SIZE_Y(rect) - 1;
+                       rect->xmin = rect->xmax - BLI_rcti_size_y(rect) - 1;
                        widget_draw_icon(but, ICON_LAYER_USED, 1.0f, rect);
                        rect->xmin = tmp;
                }
@@ -1761,8 +1761,8 @@ static void widget_softshadow(rcti *rect, int roundboxalign, float radin, float
        float quad_strip[WIDGET_SIZE_MAX * 2][2];
        
        /* prevent tooltips to not show round shadow */
-       if (2.0f * radout > 0.2f * BLI_RCT_SIZE_Y(&rect1))
-               rect1.ymax -= 0.2f * BLI_RCT_SIZE_Y(&rect1);
+       if (2.0f * radout > 0.2f * BLI_rcti_size_y(&rect1))
+               rect1.ymax -= 0.2f * BLI_rcti_size_y(&rect1);
        else
                rect1.ymax -= 2.0f * radout;
        
@@ -1844,14 +1844,14 @@ static void ui_hsv_cursor(float x, float y)
 void ui_hsvcircle_vals_from_pos(float *valrad, float *valdist, rcti *rect, float mx, float my)
 {
        /* duplication of code... well, simple is better now */
-       float centx = BLI_RCT_CENTER_X_FL(rect);
-       float centy = BLI_RCT_CENTER_Y_FL(rect);
+       float centx = BLI_rcti_cent_x_fl(rect);
+       float centy = BLI_rcti_cent_y_fl(rect);
        float radius, dist;
        
-       if (BLI_RCT_SIZE_X(rect) > BLI_RCT_SIZE_Y(rect))
-               radius = (float)BLI_RCT_SIZE_Y(rect) / 2;
+       if (BLI_rcti_size_x(rect) > BLI_rcti_size_y(rect))
+               radius = (float)BLI_rcti_size_y(rect) / 2;
        else
-               radius = (float)BLI_RCT_SIZE_X(rect) / 2;
+               radius = (float)BLI_rcti_size_x(rect) / 2;
 
        mx -= centx;
        my -= centy;
@@ -1877,13 +1877,13 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect)
                color_profile = FALSE;
        
        radstep = 2.0f * (float)M_PI / (float)tot;
-       centx = BLI_RCT_CENTER_X_FL(rect);
-       centy = BLI_RCT_CENTER_Y_FL(rect);
+       centx = BLI_rcti_cent_x_fl(rect);
+       centy = BLI_rcti_cent_y_fl(rect);
        
-       if (BLI_RCT_SIZE_X(rect) > BLI_RCT_SIZE_Y(rect))
-               radius = (float)BLI_RCT_SIZE_Y(rect) / 2;
+       if (BLI_rcti_size_x(rect) > BLI_rcti_size_y(rect))
+               radius = (float)BLI_rcti_size_y(rect) / 2;
        else
-               radius = (float)BLI_RCT_SIZE_X(rect) / 2;
+               radius = (float)BLI_rcti_size_x(rect) / 2;
        
        /* color */
        ui_get_but_vectorf(but, rgb);
@@ -2062,10 +2062,10 @@ void ui_draw_gradient(rcti *rect, const float hsv[3], const int type, const floa
                }
                
                /* rect */
-               sx1 = rect->xmin +  dx               * BLI_RCT_SIZE_X(rect);
-               sx2 = rect->xmin + (dx + color_step) * BLI_RCT_SIZE_X(rect);
+               sx1 = rect->xmin +  dx               * BLI_rcti_size_x(rect);
+               sx2 = rect->xmin + (dx + color_step) * BLI_rcti_size_x(rect);
                sy = rect->ymin;
-               dy = BLI_RCT_SIZE_Y(rect) / 3.0;
+               dy = BLI_rcti_size_y(rect) / 3.0;
                
                glBegin(GL_QUADS);
                for (a = 0; a < 3; a++, sy += dy) {
@@ -2120,8 +2120,8 @@ static void ui_draw_but_HSVCUBE(uiBut *but, rcti *rect)
        }
        
        /* cursor */
-       x = rect->xmin + x * BLI_RCT_SIZE_X(rect);
-       y = rect->ymin + y * BLI_RCT_SIZE_Y(rect);
+       x = rect->xmin + x * BLI_rcti_size_x(rect);
+       y = rect->ymin + y * BLI_rcti_size_y(rect);
        CLAMP(x, rect->xmin + 3.0f, rect->xmax - 3.0f);
        CLAMP(y, rect->ymin + 3.0f, rect->ymax - 3.0f);
        
@@ -2136,7 +2136,7 @@ static void ui_draw_but_HSVCUBE(uiBut *but, rcti *rect)
 static void ui_draw_but_HSV_v(uiBut *but, rcti *rect)
 {
        uiWidgetBase wtb;
-       float rad = 0.5f * BLI_RCT_SIZE_X(rect);
+       float rad = 0.5f * BLI_rcti_size_x(rect);
        float x, y;
        float rgb[3], hsv[3], v, range;
        int color_profile = but->block->color_profile;
@@ -2171,8 +2171,8 @@ static void ui_draw_but_HSV_v(uiBut *but, rcti *rect)
        widgetbase_draw(&wtb, &wcol_tmp);
 
        /* cursor */
-       x = rect->xmin + 0.5f * BLI_RCT_SIZE_X(rect);
-       y = rect->ymin + v    * BLI_RCT_SIZE_Y(rect);
+       x = rect->xmin + 0.5f * BLI_rcti_size_x(rect);
+       y = rect->ymin + v    * BLI_rcti_size_y(rect);
        CLAMP(y, rect->ymin + 3.0f, rect->ymax - 3.0f);
        
        ui_hsv_cursor(x, y);
@@ -2183,7 +2183,7 @@ static void ui_draw_but_HSV_v(uiBut *but, rcti *rect)
 /* ************ separator, for menus etc ***************** */
 static void ui_draw_separator(rcti *rect,  uiWidgetColors *wcol)
 {
-       int y = rect->ymin + BLI_RCT_SIZE_Y(rect) / 2 - 1;
+       int y = rect->ymin + BLI_rcti_size_y(rect) / 2 - 1;
        unsigned char col[4];
        
        col[0] = wcol->text[0];
@@ -2202,7 +2202,7 @@ static void ui_draw_separator(rcti *rect,  uiWidgetColors *wcol)
 static void widget_numbut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
 {
        uiWidgetBase wtb;
-       float rad = 0.5f * BLI_RCT_SIZE_Y(rect);
+       float rad = 0.5f * BLI_rcti_size_y(rect);
        float textofs = rad * 0.75f;
 
        if (state & UI_SELECT)
@@ -2283,12 +2283,12 @@ void uiWidgetScrollDraw(uiWidgetColors *wcol, rcti *rect, rcti *slider, int stat
        widget_init(&wtb);
 
        /* determine horizontal/vertical */
-       horizontal = (BLI_RCT_SIZE_X(rect) > BLI_RCT_SIZE_Y(rect));
+       horizontal = (BLI_rcti_size_x(rect) > BLI_rcti_size_y(rect));
        
        if (horizontal)
-               rad = 0.5f * BLI_RCT_SIZE_Y(rect);
+               rad = 0.5f * BLI_rcti_size_y(rect);
        else
-               rad = 0.5f * BLI_RCT_SIZE_X(rect);
+               rad = 0.5f * BLI_rcti_size_x(rect);
        
        wtb.shadedir = (horizontal) ? 1 : 0;
        
@@ -2300,7 +2300,7 @@ void uiWidgetScrollDraw(uiWidgetColors *wcol, rcti *rect, rcti *slider, int stat
        widgetbase_draw(&wtb, wcol);
        
        /* slider */
-       if ((BLI_RCT_SIZE_X(slider) < 2) || (BLI_RCT_SIZE_Y(slider) < 2)) {
+       if ((BLI_rcti_size_x(slider) < 2) || (BLI_rcti_size_y(slider) < 2)) {
                /* pass */
        }
        else {
@@ -2366,17 +2366,17 @@ static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat
        rect1 = *rect;
 
        /* determine horizontal/vertical */
-       horizontal = (BLI_RCT_SIZE_X(rect) > BLI_RCT_SIZE_Y(rect));
+       horizontal = (BLI_rcti_size_x(rect) > BLI_rcti_size_y(rect));
        
        if (horizontal) {
-               fac = BLI_RCT_SIZE_X(rect) / size;
+               fac = BLI_rcti_size_x(rect) / size;
                rect1.xmin = rect1.xmin + ceilf(fac * ((float)value - but->softmin));
                rect1.xmax = rect1.xmin + ceilf(fac * (but->a1 - but->softmin));
 
                /* ensure minimium size */
-               min = BLI_RCT_SIZE_Y(rect);
+               min = BLI_rcti_size_y(rect);
 
-               if (BLI_RCT_SIZE_X(&rect1) < min) {
+               if (BLI_rcti_size_x(&rect1) < min) {
                        rect1.xmax = rect1.xmin + min;
 
                        if (rect1.xmax > rect->xmax) {
@@ -2386,14 +2386,14 @@ static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat
                }
        }
        else {
-               fac = BLI_RCT_SIZE_Y(rect) / size;
+               fac = BLI_rcti_size_y(rect) / size;
                rect1.ymax = rect1.ymax - ceilf(fac * ((float)value - but->softmin));
                rect1.ymin = rect1.ymax - ceilf(fac * (but->a1 - but->softmin));
 
                /* ensure minimium size */
-               min = BLI_RCT_SIZE_X(rect);
+               min = BLI_rcti_size_x(rect);
 
-               if (BLI_RCT_SIZE_Y(&rect1) < min) {
+               if (BLI_rcti_size_y(&rect1) < min) {
                        rect1.ymax = rect1.ymin + min;
 
                        if (rect1.ymax > rect->ymax) {
@@ -2421,10 +2421,10 @@ static void widget_progressbar(uiBut *but, uiWidgetColors *wcol, rcti *rect, int
        rect_prog.ymax = rect_prog.ymin + 4;
        rect_bar.ymax = rect_bar.ymin + 4;
        
-       w = value * BLI_RCT_SIZE_X(&rect_prog);
+       w = value * BLI_rcti_size_x(&rect_prog);
        
        /* ensure minimium size */
-       min = BLI_RCT_SIZE_Y(&rect_prog);
+       min = BLI_rcti_size_y(&rect_prog);
        w = MAX2(w, min);
        
        rect_bar.xmax = rect_bar.xmin + w;
@@ -2444,8 +2444,8 @@ static void widget_link(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect, in
                
                UI_ThemeColor(TH_TEXT_HI);
                
-               rectlink.xmin = BLI_RCT_CENTER_X(rect);
-               rectlink.ymin = BLI_RCT_CENTER_Y(rect);
+               rectlink.xmin = BLI_rcti_cent_x(rect);
+               rectlink.ymin = BLI_rcti_cent_y(rect);
                rectlink.xmax = but->linkto[0];
                rectlink.ymax = but->linkto[1];
                
@@ -2467,7 +2467,7 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s
        /* backdrop first */
        
        /* fully rounded */
-       offs = 0.5f * BLI_RCT_SIZE_Y(rect);
+       offs = 0.5f * BLI_rcti_size_y(rect);
        toffs = offs * 0.75f;
        round_box_edges(&wtb, roundboxalign, rect, offs);
 
@@ -2488,7 +2488,7 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s
                rect1 = *rect;
                
                value = ui_get_but_val(but);
-               fac = ((float)value - but->softmin) * (BLI_RCT_SIZE_X(&rect1) - offs) / (but->softmax - but->softmin);
+               fac = ((float)value - but->softmin) * (BLI_rcti_size_x(&rect1) - offs) / (but->softmax - but->softmin);
                
                /* left part of slider, always rounded */
                rect1.xmax = rect1.xmin + ceil(offs + 1.0f);
@@ -2621,7 +2621,7 @@ static void widget_menubut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state),
        widgetbase_draw(&wtb, wcol);
        
        /* text space */
-       rect->xmax -= BLI_RCT_SIZE_Y(rect);
+       rect->xmax -= BLI_rcti_size_y(rect);
 }
 
 static void widget_menuiconbut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign)
@@ -2664,7 +2664,7 @@ static void widget_pulldownbut(uiWidgetColors *wcol, rcti *rect, int state, int
 {
        if (state & UI_ACTIVE) {
                uiWidgetBase wtb;
-               float rad = 0.5f * BLI_RCT_SIZE_Y(rect);  /* 4.0f */
+               float rad = 0.5f * BLI_rcti_size_y(rect);  /* 4.0f */
                
                widget_init(&wtb);
                
@@ -2710,10 +2710,10 @@ static void widget_optionbut(uiWidgetColors *wcol, rcti *rect, int state, int UN
        widget_init(&wtb);
        
        /* square */
-       recttemp.xmax = recttemp.xmin + BLI_RCT_SIZE_Y(&recttemp);
+       recttemp.xmax = recttemp.xmin + BLI_rcti_size_y(&recttemp);
        
        /* smaller */
-       delta = 1 + BLI_RCT_SIZE_Y(&recttemp) / 8;
+       delta = 1 + BLI_rcti_size_y(&recttemp) / 8;
        recttemp.xmin += delta;
        recttemp.ymin += delta;
        recttemp.xmax -= delta;
@@ -2730,7 +2730,7 @@ static void widget_optionbut(uiWidgetColors *wcol, rcti *rect, int state, int UN
        widgetbase_draw(&wtb, wcol);
        
        /* text space */
-       rect->xmin += BLI_RCT_SIZE_Y(rect) * 0.7 + delta;
+       rect->xmin += BLI_rcti_size_y(rect) * 0.7 + delta;
 }
 
 
@@ -2792,7 +2792,7 @@ static void widget_but(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int
 static void widget_roundbut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign)
 {
        uiWidgetBase wtb;
-       float rad = 5.0f;  /* 0.5f * BLI_RCT_SIZE_Y(rect); */
+       float rad = 5.0f;  /* 0.5f * BLI_rcti_size_y(rect); */
        
        widget_init(&wtb);
        
@@ -3275,12 +3275,12 @@ void ui_draw_menu_back(uiStyle *UNUSED(style), uiBlock *block, rcti *rect)
                if (block->flag & UI_BLOCK_CLIPTOP) {
                        /* XXX no scaling for UI here yet */
                        glColor3ubv((unsigned char *)wt->wcol.text);
-                       UI_DrawTriIcon(BLI_RCT_CENTER_X(rect), rect->ymax - 8, 't');
+                       UI_DrawTriIcon(BLI_rcti_cent_x(rect), rect->ymax - 8, 't');
                }
                if (block->flag & UI_BLOCK_CLIPBOTTOM) {
                        /* XXX no scaling for UI here yet */
                        glColor3ubv((unsigned char *)wt->wcol.text);
-                       UI_DrawTriIcon(BLI_RCT_CENTER_X(rect), rect->ymin + 10, 'v');
+                       UI_DrawTriIcon(BLI_rcti_cent_x(rect), rect->ymin + 10, 'v');
                }
        }       
 }
index 9c71746..3de3f55 100644 (file)
@@ -96,11 +96,11 @@ static void view2d_masks(View2D *v2d)
        /* check size if: */
        if (v2d->scroll & V2D_SCROLL_HORIZONTAL)
                if (!(v2d->scroll & V2D_SCROLL_SCALE_HORIZONTAL))
-                       if (BLI_RCT_SIZE_X(&v2d->tot) <= BLI_RCT_SIZE_X(&v2d->cur))
+                       if (BLI_rctf_size_x(&v2d->tot) <= BLI_rcti_size_x(&v2d->cur))
                                v2d->scroll |= V2D_SCROLL_HORIZONTAL_HIDE;
        if (v2d->scroll & V2D_SCROLL_VERTICAL)
                if (!(v2d->scroll & V2D_SCROLL_SCALE_VERTICAL))
-                       if (BLI_RCT_SIZE_Y(&v2d->tot) <= BLI_RCT_SIZE_Y(&v2d->cur))
+                       if (BLI_rctf_size_y(&v2d->tot) <= BLI_rctf_size_y(&v2d->cur))
                                v2d->scroll |= V2D_SCROLL_VERTICAL_HIDE;
 #endif
        scroll = view2d_scroll_mapped(v2d->scroll);
@@ -328,8 +328,8 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
        rctf *cur, *tot;
        
        /* use mask as size of region that View2D resides in, as it takes into account scrollbars already  */
-       winx = (float)(BLI_RCT_SIZE_X(&v2d->mask) + 1);
-       winy = (float)(BLI_RCT_SIZE_Y(&v2d->mask) + 1);
+       winx = (float)(BLI_rcti_size_x(&v2d->mask) + 1);
+       winy = (float)(BLI_rcti_size_y(&v2d->mask) + 1);
        
        /* get pointers to rcts for less typing */
        cur = &v2d->cur;
@@ -347,10 +347,10 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
         *      - firstly, we calculate the sizes of the rects
         *      - curwidth and curheight are saved as reference... modify width and height values here
         */
-       totwidth  = BLI_RCT_SIZE_X(tot);
-       totheight = BLI_RCT_SIZE_Y(tot);
-       curwidth  = width  = BLI_RCT_SIZE_X(cur);
-       curheight = height = BLI_RCT_SIZE_Y(cur);
+       totwidth  = BLI_rctf_size_x(tot);
+       totheight = BLI_rctf_size_y(tot);
+       curwidth  = width  = BLI_rctf_size_x(cur);
+       curheight = height = BLI_rctf_size_y(cur);
        
        /* if zoom is locked, size on the appropriate axis is reset to mask size */
        if (v2d->keepzoom & V2D_LOCKZOOM_X)
@@ -499,16 +499,16 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
                /* resize from centerpoint, unless otherwise specified */
                if (width != curwidth) {
                        if (v2d->keepofs & V2D_LOCKOFS_X) {
-                               cur->xmax += width - BLI_RCT_SIZE_X(cur);
+                               cur->xmax += width - BLI_rctf_size_x(cur);
                        }
                        else if (v2d->keepofs & V2D_KEEPOFS_X) {
                                if (v2d->align & V2D_ALIGN_NO_POS_X)
-                                       cur->xmin -= width - BLI_RCT_SIZE_X(cur);
+                                       cur->xmin -= width - BLI_rctf_size_x(cur);
                                else
-                                       cur->xmax += width - BLI_RCT_SIZE_X(cur);
+                                       cur->xmax += width - BLI_rctf_size_x(cur);
                        }
                        else {
-                               temp = BLI_RCT_CENTER_X(cur);
+                               temp = BLI_rctf_cent_x(cur);
                                dh = width * 0.5f;
                                
                                cur->xmin = temp - dh;
@@ -517,16 +517,16 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
                }
                if (height != curheight) {
                        if (v2d->keepofs & V2D_LOCKOFS_Y) {
-                               cur->ymax += height - BLI_RCT_SIZE_Y(cur);
+                               cur->ymax += height - BLI_rctf_size_y(cur);
                        }
                        else if (v2d->keepofs & V2D_KEEPOFS_Y) {
                                if (v2d->align & V2D_ALIGN_NO_POS_Y)
-                                       cur->ymin -= height - BLI_RCT_SIZE_Y(cur);
+                                       cur->ymin -= height - BLI_rctf_size_y(cur);
                                else
-                                       cur->ymax += height - BLI_RCT_SIZE_Y(cur);
+                                       cur->ymax += height - BLI_rctf_size_y(cur);
                        }
                        else {
-                               temp = BLI_RCT_CENTER_Y(cur);
+                               temp = BLI_rctf_cent_y(cur);
                                dh = height * 0.5f;
                                
                                cur->ymin = temp - dh;
@@ -540,8 +540,8 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
                float temp, diff;
                
                /* recalculate extents of cur */
-               curwidth  = BLI_RCT_SIZE_X(cur);
-               curheight = BLI_RCT_SIZE_Y(cur);
+               curwidth  = BLI_rctf_size_x(cur);
+               curheight = BLI_rctf_size_y(cur);
                
                /* width */
                if ((curwidth > totwidth) && !(v2d->keepzoom & (V2D_KEEPZOOM | V2D_LOCKZOOM_X | V2D_LIMITZOOM))) {
@@ -592,7 +592,7 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
                         */
                        if ((cur->xmin < tot->xmin) && (cur->xmax > tot->xmax)) {
                                /* outside boundaries on both sides, so take middle-point of tot, and place in balanced way */
-                               temp = BLI_RCT_CENTER_X(tot);
+                               temp = BLI_rctf_cent_x(tot);
                                diff = curheight * 0.5f;
                                
                                cur->xmin = temp - diff;
@@ -642,7 +642,7 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
                         */
                        if ((cur->ymin < tot->ymin) && (cur->ymax > tot->ymax)) {
                                /* outside boundaries on both sides, so take middle-point of tot, and place in balanced way */
-                               temp = BLI_RCT_CENTER_Y(tot);
+                               temp = BLI_rctf_cent_y(tot);
                                diff = curheight * 0.5f;
                                
                                cur->ymin = temp - diff;
@@ -791,8 +791,8 @@ void UI_view2d_curRect_reset(View2D *v2d)
        float width, height;
        
        /* assume width and height of 'cur' rect by default, should be same size as mask */
-       width  = (float)(BLI_RCT_SIZE_X(&v2d->mask) + 1);
-       height = (float)(BLI_RCT_SIZE_Y(&v2d->mask) + 1);
+       width  = (float)(BLI_rcti_size_x(&v2d->mask) + 1);
+       height = (float)(BLI_rcti_size_y(&v2d->mask) + 1);
        
        /* handle width - posx and negx flags are mutually exclusive, so watch out */
        if ((v2d->align & V2D_ALIGN_NO_POS_X) && !(v2d->align & V2D_ALIGN_NO_NEG_X)) {
@@ -958,8 +958,8 @@ static void view2d_map_cur_using_mask(View2D *v2d, rctf *curmasked)
        *curmasked = v2d->cur;
        
        if (view2d_scroll_mapped(v2d->scroll)) {
-               float dx = BLI_RCT_SIZE_X(&v2d->cur) / ((float)(BLI_RCT_SIZE_X(&v2d->mask) + 1));
-               float dy = BLI_RCT_SIZE_Y(&v2d->cur) / ((float)(BLI_RCT_SIZE_Y(&v2d->mask) + 1));
+               float dx = BLI_rctf_size_x(&v2d->cur) / ((float)(BLI_rcti_size_x(&v2d->mask) + 1));
+               float dy = BLI_rctf_size_y(&v2d->cur) / ((float)(BLI_rcti_size_y(&v2d->mask) + 1));
                
                if (v2d->mask.xmin != 0)
                        curmasked->xmin -= dx * (float)v2d->mask.xmin;
@@ -985,8 +985,8 @@ void UI_view2d_view_ortho(View2D *v2d)
         */
        /* XXX brecht: instead of zero at least use a tiny offset, otherwise
         * pixel rounding is effectively random due to float inaccuracy */
-       xofs = 0.001f * BLI_RCT_SIZE_X(&v2d->cur) / BLI_RCT_SIZE_X(&v2d->mask);
-       yofs = 0.001f * BLI_RCT_SIZE_Y(&v2d->cur) / BLI_RCT_SIZE_Y(&v2d->mask);
+       xofs = 0.001f * BLI_rctf_size_x(&v2d->cur) / BLI_rcti_size_x(&v2d->mask);
+       yofs = 0.001f * BLI_rctf_size_y(&v2d->cur) / BLI_rcti_size_y(&v2d->mask);
        
        /* apply mask-based adjustments to cur rect (due to scrollers), to eliminate scaling artifacts */
        view2d_map_cur_using_mask(v2d, &curmasked);
@@ -1044,8 +1044,8 @@ void UI_view2d_view_orthoSpecial(ARegion *ar, View2D *v2d, short xaxis)
 void UI_view2d_view_restore(const bContext *C)
 {
        ARegion *ar = CTX_wm_region(C);
-       int width  = BLI_RCT_SIZE_X(&ar->winrct) + 1;
-       int height = BLI_RCT_SIZE_Y(&ar->winrct) + 1;
+       int width  = BLI_rcti_size_x(&ar->winrct) + 1;
+       int height = BLI_rcti_size_y(&ar->winrct) + 1;
        
        wmOrtho2(0.0f, (float)width, 0.0f, (float)height);
        glLoadIdentity();
@@ -1117,7 +1117,8 @@ static void step_to_grid(float *step, int *power, int unit)
  *     - winx                  = width of region we're drawing to, note: not used but keeping for completeness.
  *     - winy                  = height of region we're drawing into
  */
-View2DGrid *UI_view2d_grid_calc(Scene *scene, View2D *v2d, short xunits, short xclamp, short yunits, short yclamp, int UNUSED(winx), int winy)
+View2DGrid *UI_view2d_grid_calc(Scene *scene, View2D *v2d,
+                                short xunits, short xclamp, short yunits, short yclamp, int UNUSED(winx), int winy)
 {
 
        View2DGrid *grid;
@@ -1140,8 +1141,8 @@ View2DGrid *UI_view2d_grid_calc(Scene *scene, View2D *v2d, short xunits, short x
        
        /* calculate x-axis grid scale (only if both args are valid) */
        if (ELEM(V2D_ARG_DUMMY, xunits, xclamp) == 0) {
-               space = BLI_RCT_SIZE_X(&v2d->cur);
-               pixels = (float)BLI_RCT_SIZE_X(&v2d->mask);
+               space = BLI_rctf_size_x(&v2d->cur);
+               pixels = (float)BLI_rcti_size_x(&v2d->mask);
                
                if (pixels != 0.0f) {
                        grid->dx = (U.v2d_min_gridsize * space) / (seconddiv * pixels);
@@ -1158,7 +1159,7 @@ View2DGrid *UI_view2d_grid_calc(Scene *scene, View2D *v2d, short xunits, short x
        
        /* calculate y-axis grid scale (only if both args are valid) */
        if (ELEM(V2D_ARG_DUMMY, yunits, yclamp) == 0) {
-               space = BLI_RCT_SIZE_Y(&v2d->cur);
+               space = BLI_rctf_size_y(&v2d->cur);
                pixels = (float)winy;
                
                grid->dy = U.v2d_min_gridsize * space / pixels;
@@ -1206,7 +1207,7 @@ void UI_view2d_grid_draw(View2D *v2d, View2DGrid *grid, int flag)
                vec2[1] = v2d->cur.ymax;
                
                /* minor gridlines */
-               step = (BLI_RCT_SIZE_X(&v2d->mask) + 1) / U.v2d_min_gridsize;
+               step = (BLI_rcti_size_x(&v2d->mask) + 1) / U.v2d_min_gridsize;
                UI_ThemeColor(TH_GRID);
                
                for (a = 0; a < step; a++) {
@@ -1240,7 +1241,7 @@ void UI_view2d_grid_draw(View2D *v2d, View2DGrid *grid, int flag)
                vec1[0] = grid->startx;
                vec2[0] = v2d->cur.xmax;
                
-               step = (BLI_RCT_SIZE_Y(&v2d->mask) + 1) / U.v2d_min_gridsize;
+               step = (BLI_rcti_size_y(&v2d->mask) + 1) / U.v2d_min_gridsize;
                
                UI_ThemeColor(TH_GRID);
                for (a = 0; a <= step; a++) {
@@ -1414,7 +1415,8 @@ struct View2DScrollers {
 };
 
 /* Calculate relevant scroller properties */
-View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short xunits, short xclamp, short yunits, short yclamp)
+View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d,
+                                          short xunits, short xclamp, short yunits, short yclamp)
 {
        View2DScrollers *scrollers;
        rcti vert, hor;
@@ -1457,8 +1459,8 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short
        /* horizontal scrollers */
        if (scroll & V2D_SCROLL_HORIZONTAL) {
                /* scroller 'button' extents */
-               totsize = BLI_RCT_SIZE_X(&v2d->tot);
-               scrollsize = (float)BLI_RCT_SIZE_X(&hor);
+               totsize = BLI_rctf_size_x(&v2d->tot);
+               scrollsize = (float)BLI_rcti_size_x(&hor);
                if (totsize == 0.0f) totsize = 1.0f;  /* avoid divide by zero */
 
                fac1 = (v2d->cur.xmin - v2d->tot.xmin) / totsize;
@@ -1498,8 +1500,8 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short
        /* vertical scrollers */
        if (scroll & V2D_SCROLL_VERTICAL) {
                /* scroller 'button' extents */
-               totsize    =        BLI_RCT_SIZE_Y(&v2d->tot);
-               scrollsize = (float)BLI_RCT_SIZE_Y(&vert);
+               totsize    =        BLI_rctf_size_y(&v2d->tot);
+               scrollsize = (float)BLI_rcti_size_y(&vert);
                if (totsize == 0.0f) totsize = 1.0f;  /* avoid divide by zero */
 
                fac1 = (v2d->cur.ymin - v2d->tot.ymin) / totsize;
@@ -1547,7 +1549,7 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short
                
                scrollers->grid = UI_view2d_grid_calc(CTX_data_scene(C), v2d,
                                                      xunits, xclamp, yunits, yclamp,
-                                                     BLI_RCT_SIZE_X(&hor), BLI_RCT_SIZE_Y(&vert));
+                                                     BLI_rcti_size_x(&hor), BLI_rcti_size_y(&vert));
        }
        
        /* return scrollers */
@@ -1631,7 +1633,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
                         */
                        if ((v2d->keepzoom & V2D_LOCKZOOM_X) == 0 &&
                            (v2d->scroll & V2D_SCROLL_SCALE_HORIZONTAL) &&
-                           (BLI_RCT_SIZE_X(&slider) > V2D_SCROLLER_HANDLE_SIZE))
+                           (BLI_rcti_size_x(&slider) > V2D_SCROLLER_HANDLE_SIZE))
                        {
                                state |= UI_SCROLL_ARROWS;
                        }
@@ -1651,11 +1653,11 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
                         *      - fac is x-coordinate to draw to
                         *      - dfac is gap between scale markings
                         */
-                       fac = (grid->startx - v2d->cur.xmin) / BLI_RCT_SIZE_X(&v2d->cur);
-                       fac = (float)hor.xmin + fac * BLI_RCT_SIZE_X(&hor);
+                       fac = (grid->startx - v2d->cur.xmin) / BLI_rctf_size_x(&v2d->cur);
+                       fac = (float)hor.xmin + fac * BLI_rcti_size_x(&hor);
                        
-                       dfac = grid->dx / BLI_RCT_SIZE_X(&v2d->cur);
-                       dfac = dfac * BLI_RCT_SIZE_X(&hor);
+                       dfac = grid->dx / BLI_rctf_size_x(&v2d->cur);
+                       dfac = dfac * BLI_rcti_size_x(&hor);
                        
                        /* set starting value, and text color */
                        UI_ThemeColor(TH_TEXT);
@@ -1742,7 +1744,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
                         */
                        if ((v2d->keepzoom & V2D_LOCKZOOM_Y) == 0 &&
                            (v2d->scroll & V2D_SCROLL_SCALE_VERTICAL) &&
-                           (BLI_RCT_SIZE_Y(&slider) > V2D_SCROLLER_HANDLE_SIZE))
+                           (BLI_rcti_size_y(&slider) > V2D_SCROLLER_HANDLE_SIZE))
                        {
                                state |= UI_SCROLL_ARROWS;
                        }
@@ -1765,11 +1767,11 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
                         *      - these involve a correction for horizontal scrollbar
                         *        NOTE: it's assumed that that scrollbar is there if this is involved!
                         */
-                       fac = (grid->starty - v2d->cur.ymin) / BLI_RCT_SIZE_Y(&v2d->cur);
-                       fac = vert.ymin + fac * BLI_RCT_SIZE_Y(&vert);
+                       fac = (grid->starty - v2d->cur.ymin) / BLI_rctf_size_y(&v2d->cur);
+                       fac = vert.ymin + fac * BLI_rcti_size_y(&vert);
                        
-                       dfac = grid->dy / BLI_RCT_SIZE_Y(&v2d->cur);
-                       dfac = dfac     * BLI_RCT_SIZE_Y(&vert);
+                       dfac = grid->dy / BLI_rctf_size_y(&v2d->cur);
+                       dfac = dfac     * BLI_rcti_size_y(&vert);
                        
                        /* set starting value, and text color */
                        UI_ThemeColor(TH_TEXT);
@@ -1823,7 +1825,9 @@ void UI_view2d_scrollers_free(View2DScrollers *scrollers)
  *     - column, row                           = the 2d-coordinates (in 2D-view / 'tot' rect space) the cell exists at
  *     - rect                                  = coordinates of the cell (passed as single var instead of 4 separate, as it's more useful this way)
  */
-void UI_view2d_listview_cell_to_view(View2D *v2d, short columnwidth, short rowheight, float startx, float starty, int column, int row, rctf *rect)
+void UI_view2d_listview_cell_to_view(View2D *v2d, short columnwidth, short rowheight,
+                                     float startx, float starty,
+                                     int column, int row, rctf *rect)
 {
        /* sanity checks */
        if (ELEM(NULL, v2d, rect)) {
@@ -1927,17 +1931,17 @@ void UI_view2d_region_to_view(View2D *v2d, int x, int y, float *r_viewx, float *
        float div, ofs;
 
        if (r_viewx) {
-               div = (float)BLI_RCT_SIZE_X(&v2d->mask);
+               div = (float)BLI_rcti_size_x(&v2d->mask);
                ofs = (float)v2d->mask.xmin;
                
-               *r_viewx = v2d->cur.xmin + BLI_RCT_SIZE_X(&v2d->cur) * ((float)x - ofs) / div;
+               *r_viewx = v2d->cur.xmin + BLI_rctf_size_x(&v2d->cur) * ((float)x - ofs) / div;
        }
 
        if (r_viewy) {
-               div = (float)BLI_RCT_SIZE_Y(&v2d->mask);
+               div = (float)BLI_rcti_size_y(&v2d->mask);
                ofs = (float)v2d->mask.ymin;
                
-               *r_viewy = v2d->cur.ymin + BLI_RCT_SIZE_Y(&v2d->cur) * ((float)y - ofs) / div;
+               *r_viewy = v2d->cur.ymin + BLI_rctf_size_y(&v2d->cur) * ((float)y - ofs) / div;
        }
 }
 
@@ -1956,15 +1960,15 @@ void UI_view2d_view_to_region(View2D *v2d, float x, float y, int *regionx, int *
                *regiony = V2D_IS_CLIPPED;
        
        /* express given coordinates as proportional values */
-       x = (x - v2d->cur.xmin) / BLI_RCT_SIZE_X(&v2d->cur);
-       y = (y - v2d->cur.ymin) / BLI_RCT_SIZE_Y(&v2d->cur);
+       x = (x - v2d->cur.xmin) / BLI_rctf_size_x(&v2d->cur);
+       y = (y - v2d->cur.ymin) / BLI_rctf_size_y(&v2d->cur);
        
        /* check if values are within bounds */
        if ((x >= 0.0f) && (x <= 1.0f) && (y >= 0.0f) && (y <= 1.0f)) {
                if (regionx)
-                       *regionx = (int)(v2d->mask.xmin + x * BLI_RCT_SIZE_X(&v2d->mask));
+                       *regionx = (int)(v2d->mask.xmin + x * BLI_rcti_size_x(&v2d->mask));
                if (regiony)
-                       *regiony = (int)(v2d->mask.ymin + y * BLI_RCT_SIZE_Y(&v2d->mask));
+                       *regiony = (int)(v2d->mask.ymin + y * BLI_rcti_size_y(&v2d->mask));
        }
 }
 
@@ -1977,12 +1981,12 @@ void UI_view2d_view_to_region(View2D *v2d, float x, float y, int *regionx, int *
 void UI_view2d_to_region_no_clip(View2D *v2d, float x, float y, int *regionx, int *regiony)
 {
        /* step 1: express given coordinates as proportional values */
-       x = (x - v2d->cur.xmin) / BLI_RCT_SIZE_X(&v2d->cur);
-       y = (y - v2d->cur.ymin) / BLI_RCT_SIZE_Y(&v2d->cur);
+       x = (x - v2d->cur.xmin) / BLI_rctf_size_x(&v2d->cur);
+       y = (y - v2d->cur.ymin) / BLI_rctf_size_y(&v2d->cur);
        
        /* step 2: convert proportional distances to screen coordinates  */
-       x = v2d->mask.xmin + x * BLI_RCT_SIZE_X(&v2d->mask);
-       y = v2d->mask.ymin + y * BLI_RCT_SIZE_Y(&v2d->mask);
+       x = v2d->mask.xmin + x * BLI_rcti_size_x(&v2d->mask);
+       y = v2d->mask.ymin + y * BLI_rcti_size_y(&v2d->mask);
        
        /* although we don't clamp to lie within region bounds, we must avoid exceeding size of ints */
        if (regionx) {
@@ -2035,8 +2039,8 @@ View2D *UI_view2d_fromcontext_rwin(const bContext *C)
  */
 void UI_view2d_getscale(View2D *v2d, float *x, float *y) 
 {
-       if (x) *x = BLI_RCT_SIZE_X(&v2d->mask) / BLI_RCT_SIZE_X(&v2d->cur);
-       if (y) *y = BLI_RCT_SIZE_Y(&v2d->mask) / BLI_RCT_SIZE_Y(&v2d->cur);
+       if (x) *x = BLI_rcti_size_x(&v2d->mask) / BLI_rctf_size_x(&v2d->cur);
+       if (y) *y = BLI_rcti_size_y(&v2d->mask) / BLI_rctf_size_y(&v2d->cur);
 }
 
 /* Check if mouse is within scrollers
@@ -2142,7 +2146,7 @@ void UI_view2d_text_cache_draw(ARegion *ar)
                const char *str = (const char *)(v2s + 1);
                int xofs = 0, yofs;
 
-               yofs = ceil(0.5f * (BLI_RCT_SIZE_Y(&v2s->rect) - default_height));
+               yofs = ceil(0.5f * (BLI_rcti_size_y(&v2s->rect) - default_height));
                if (yofs < 1) yofs = 1;
 
                if (col_pack_prev != v2s->col.pack) {
index 99313ed..3d3f309 100644 (file)
@@ -119,10 +119,10 @@ static int view_pan_init(bContext *C, wmOperator *op)
        vpd->ar = ar;
        
        /* calculate translation factor - based on size of view */
-       winx = (float)(BLI_RCT_SIZE_X(&ar->winrct) + 1);
-       winy = (float)(BLI_RCT_SIZE_Y(&ar->winrct) + 1);
-       vpd->facx = (BLI_RCT_SIZE_X(&v2d->cur)) / winx;
-       vpd->facy = (BLI_RCT_SIZE_Y(&v2d->cur)) / winy;
+       winx = (float)(BLI_rcti_size_x(&ar->winrct) + 1);
+       winy = (float)(BLI_rcti_size_y(&ar->winrct) + 1);
+       vpd->facx = (BLI_rctf_size_x(&v2d->cur)) / winx;
+       vpd->facy = (BLI_rctf_size_y(&v2d->cur)) / winy;
        
        return 1;
 }
@@ -471,7 +471,7 @@ static int view_scrollup_exec(bContext *C, wmOperator *op)
        
        if (RNA_boolean_get(op->ptr, "page")) {
                ARegion *ar = CTX_wm_region(C);
-               RNA_int_set(op->ptr, "deltay", BLI_RCT_SIZE_Y(&ar->v2d.mask));
+               RNA_int_set(op->ptr, "deltay", BLI_rcti_size_y(&ar->v2d.mask));
        }
        
        /* apply movement, then we're done */
@@ -590,12 +590,12 @@ static void view_zoomstep_apply(bContext *C, wmOperator *op)
        facy = RNA_float_get(op->ptr, "zoomfacy");
 
        if (facx >= 0.0f) {
-               dx = BLI_RCT_SIZE_X(&v2d->cur) * facx;
-               dy = BLI_RCT_SIZE_Y(&v2d->cur) * facy;
+               dx = BLI_rctf_size_x(&v2d->cur) * facx;
+               dy = BLI_rctf_size_y(&v2d->cur) * facy;
        }
        else {
-               dx = (BLI_RCT_SIZE_X(&v2d->cur) / (1.0f + 2.0f * facx)) * facx;
-               dy = (BLI_RCT_SIZE_Y(&v2d->cur) / (1.0f + 2.0f * facy)) * facy;
+               dx = (BLI_rctf_size_x(&v2d->cur) / (1.0f + 2.0f * facx)) * facx;
+               dy = (BLI_rctf_size_y(&v2d->cur) / (1.0f + 2.0f * facy)) * facy;
        }
 
        /* only resize view on an axis if change is allowed */
@@ -611,7 +611,7 @@ static void view_zoomstep_apply(bContext *C, wmOperator *op)
                }
                else {
                        if (U.uiflag & USER_ZOOM_TO_MOUSEPOS) {
-                               float mval_fac = (vzd->mx_2d - v2d->cur.xmin) / BLI_RCT_SIZE_X(&v2d->cur);
+                               float mval_fac = (vzd->mx_2d - v2d->cur.xmin) / BLI_rctf_size_x(&v2d->cur);
                                float mval_faci = 1.0f - mval_fac;
                                float ofs = (mval_fac * dx) - (mval_faci * dx);
                                
@@ -636,7 +636,7 @@ static void view_zoomstep_apply(bContext *C, wmOperator *op)
                }
                else {
                        if (U.uiflag & USER_ZOOM_TO_MOUSEPOS) {
-                               float mval_fac = (vzd->my_2d - v2d->cur.ymin) / BLI_RCT_SIZE_Y(&v2d->cur);
+                               float mval_fac = (vzd->my_2d - v2d->cur.ymin) / BLI_rctf_size_y(&v2d->cur);
                                float mval_faci = 1.0f - mval_fac;
                                float ofs = (mval_fac * dy) - (mval_faci * dy);
                                
@@ -845,7 +845,7 @@ static void view_zoomdrag_apply(bContext *C, wmOperator *op)
                }
                else {
                        if (U.uiflag & USER_ZOOM_TO_MOUSEPOS) {
-                               float mval_fac = (vzd->mx_2d - v2d->cur.xmin) / BLI_RCT_SIZE_X(&v2d->cur);
+                               float mval_fac = (vzd->mx_2d - v2d->cur.xmin) / BLI_rctf_size_x(&v2d->cur);
                                float mval_faci = 1.0f - mval_fac;
                                float ofs = (mval_fac * dx) - (mval_faci * dx);
                                
@@ -864,7 +864,7 @@ static void view_zoomdrag_apply(bContext *C, wmOperator *op)
                }
                else {
                        if (U.uiflag & USER_ZOOM_TO_MOUSEPOS) {
-                               float mval_fac = (vzd->my_2d - v2d->cur.ymin) / BLI_RCT_SIZE_Y(&v2d->cur);
+                               float mval_fac = (vzd->my_2d - v2d->cur.ymin) / BLI_rctf_size_y(&v2d->cur);
                                float mval_faci = 1.0f - mval_fac;
                                float ofs = (mval_fac * dy) - (mval_faci * dy);
                                
@@ -942,8 +942,8 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, wmEvent *event)
                 * with magnify information that is stored in x axis 
                 */
                fac = 0.01f * (event->x - event->prevx);
-               dx = fac * BLI_RCT_SIZE_X(&v2d->cur) / 10.0f;
-               dy = fac * BLI_RCT_SIZE_Y(&v2d->cur) / 10.0f;
+               dx = fac * BLI_rctf_size_x(&v2d->cur) / 10.0f;
+               dy = fac * BLI_rctf_size_y(&v2d->cur) / 10.0f;
 
                RNA_float_set(op->ptr, "deltax", dx);
                RNA_float_set(op->ptr, "deltay", dy);
@@ -1009,14 +1009,14 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, wmEvent *event)
                        float dist;
                        
                        /* x-axis transform */
-                       dist = BLI_RCT_SIZE_X(&v2d->mask) / 2.0f;
+                       dist = BLI_rcti_size_x(&v2d->mask) / 2.0f;
                        dx = 1.0f - (fabsf(vzd->lastx - dist) + 2.0f) / (fabsf(event->x - dist) + 2.0f);
-                       dx *= 0.5f * BLI_RCT_SIZE_X(&v2d->cur);
+                       dx *= 0.5f * BLI_rctf_size_x(&v2d->cur);
                        
                        /* y-axis transform */
-                       dist = BLI_RCT_SIZE_Y(&v2d->mask) / 2.0f;
+                       dist = BLI_rcti_size_y(&v2d->mask) / 2.0f;
                        dy = 1.0f - (fabsf(vzd->lasty - dist) + 2.0f) / (fabsf(event->y - dist) + 2.0f);
-                       dy *= 0.5f * BLI_RCT_SIZE_Y(&v2d->cur);
+                       dy *= 0.5f * BLI_rctf_size_y(&v2d->cur);
                }
                else {
                        /* 'continuous' or 'dolly' */
@@ -1024,11 +1024,11 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, wmEvent *event)
                        
                        /* x-axis transform */
                        fac = 0.01f * (event->x - vzd->lastx);
-                       dx = fac * BLI_RCT_SIZE_X(&v2d->cur);
+                       dx = fac * BLI_rctf_size_x(&v2d->cur);
                        
                        /* y-axis transform */
                        fac = 0.01f * (event->y - vzd->lasty);
-                       dy = fac * BLI_RCT_SIZE_Y(&v2d->cur);
+                       dy = fac * BLI_rctf_size_y(&v2d->cur);
 #if 0
                        /* continuous zoom shouldn't move that fast... */
                        if (U.viewzoom == USER_ZOOM_CONT) { // XXX store this setting as RNA prop?
@@ -1161,17 +1161,17 @@ static int view_borderzoom_exec(bContext *C, wmOperator *op)
                
                /* TODO: is this zoom factor calculation valid? It seems to produce same results everytime... */
                if ((v2d->keepzoom & V2D_LOCKZOOM_X) == 0) {
-                       size = BLI_RCT_SIZE_X(&cur_new);
-                       zoom = size / BLI_RCT_SIZE_X(&rect);
-                       center = BLI_RCT_CENTER_X(&cur_new);
+                       size = BLI_rctf_size_x(&cur_new);
+                       zoom = size / BLI_rctf_size_x(&rect);
+                       center = BLI_rctf_cent_x(&cur_new);
                        
                        cur_new.xmin = center - (size * zoom);
                        cur_new.xmax = center + (size * zoom);
                }
                if ((v2d->keepzoom & V2D_LOCKZOOM_Y) == 0) {
-                       size = BLI_RCT_SIZE_Y(&cur_new);
-                       zoom = size / BLI_RCT_SIZE_Y(&rect);
-                       center = BLI_RCT_CENTER_Y(&cur_new);
+                       size = BLI_rctf_size_y(&cur_new);
+                       zoom = size / BLI_rctf_size_y(&rect);
+                       center = BLI_rctf_cent_y(&cur_new);
                        
                        cur_new.ymin = center - (size * zoom);
                        cur_new.ymax = center + (size * zoom);
@@ -1221,14 +1221,14 @@ struct SmoothView2DStore {
  */
 static float smooth_view_rect_to_fac(const rctf *rect_a, const rctf *rect_b)
 {
-       float size_a[2] = {BLI_RCT_SIZE_X(rect_a),
-                          BLI_RCT_SIZE_Y(rect_a)};
-       float size_b[2] = {BLI_RCT_SIZE_X(rect_b),
-                          BLI_RCT_SIZE_Y(rect_b)};
-       float cent_a[2] = {BLI_RCT_CENTER_X(rect_a),
-                          BLI_RCT_CENTER_Y(rect_a)};
-       float cent_b[2] = {BLI_RCT_CENTER_X(rect_b),
-                          BLI_RCT_CENTER_Y(rect_b)};
+       float size_a[2] = {BLI_rctf_size_x(rect_a),
+                          BLI_rctf_size_y(rect_a)};
+       float size_b[2] = {BLI_rctf_size_x(rect_b),
+                          BLI_rctf_size_y(rect_b)};
+       float cent_a[2] = {BLI_rctf_cent_x(rect_a),
+                          BLI_rctf_cent_y(rect_a)};
+       float cent_b[2] = {BLI_rctf_cent_x(rect_b),
+                          BLI_rctf_cent_y(rect_b)};
 
        float fac_max = 0.0f;
        float tfac;
@@ -1501,8 +1501,8 @@ static void scroller_activate_init(bContext *C, wmOperator *op, wmEvent *event,
 
        if (in_scroller == 'h') {
                /* horizontal scroller - calculate adjustment factor first */
-               mask_size = (float)BLI_RCT_SIZE_X(&v2d->hor);
-               vsm->fac = BLI_RCT_SIZE_X(&v2d->tot) / mask_size;
+               mask_size = (float)BLI_rcti_size_x(&v2d->hor);
+               vsm->fac = BLI_rctf_size_x(&v2d->tot) / mask_size;
                
                /* get 'zone' (i.e. which part of scroller is activated) */
                vsm->zone = mouse_in_scroller_handle(event->mval[0], v2d->hor.xmin, v2d->hor.xmax, scrollers->hor_min, scrollers->hor_max);
@@ -1517,8 +1517,8 @@ static void scroller_activate_init(bContext *C, wmOperator *op, wmEvent *event,
        }
        else {
                /* vertical scroller - calculate adjustment factor first */
-               mask_size = (float)BLI_RCT_SIZE_Y(&v2d->vert);
-               vsm->fac = BLI_RCT_SIZE_Y(&v2d->tot) / mask_size;
+               mask_size = (float)BLI_rcti_size_y(&v2d->vert);
+               vsm->fac = BLI_rctf_size_y(&v2d->tot) / mask_size;
                
                /* get 'zone' (i.e. which part of scroller is activated) */
                vsm->zone = mouse_in_scroller_handle(event->mval[1], v2d->vert.ymin, v2d->vert.ymax, scrollers->vert_min, scrollers->vert_max);
@@ -1798,8 +1798,8 @@ static int reset_exec(bContext *C, wmOperator *UNUSED(op))
        int winx, winy;
 
        /* zoom 1.0 */
-       winx = (float)(BLI_RCT_SIZE_X(&v2d->mask) + 1);
-       winy = (float)(BLI_RCT_SIZE_Y(&v2d->mask) + 1);
+       winx = (float)(BLI_rcti_size_x(&v2d->mask) + 1);
+       winy = (float)(BLI_rcti_size_y(&v2d->mask) + 1);
 
        v2d->cur.xmax = v2d->cur.xmin + winx;
        v2d->cur.ymax = v2d->cur.ymin + winy;
index 655458b..fe65674 100644 (file)
@@ -520,12 +520,12 @@ void ED_mask_draw_region(Mask *mask, ARegion *ar,
        UI_view2d_to_region_no_clip(&ar->v2d, 0.0f, 0.0f, &x, &y);
 
 
-       /* w = BLI_RCT_SIZE_X(&v2d->tot); */
-       /* h = BLI_RCT_SIZE_Y(&v2d->tot);/*/
+       /* w = BLI_rctf_size_x(&v2d->tot); */
+       /* h = BLI_rctf_size_y(&v2d->tot);/*/
 
 
-       zoomx = (float)(BLI_RCT_SIZE_X(&ar->winrct) + 1) / (float)(BLI_RCT_SIZE_X(&ar->v2d.cur));
-       zoomy = (float)(BLI_RCT_SIZE_Y(&ar->winrct) + 1) / (float)(BLI_RCT_SIZE_Y(&ar->v2d.cur));
+       zoomx = (float)(BLI_rcti_size_x(&ar->winrct) + 1) / BLI_rctf_size_x(&ar->v2d.cur);
+       zoomy = (float)(BLI_rcti_size_y(&ar->winrct) + 1) / BLI_rctf_size_y(&ar->v2d.cur);
 
        if (do_scale_applied) {
                zoomx /= width;
index 94e10b5..a677f12 100644 (file)
@@ -533,8 +533,8 @@ int do_paintface_box_select(ViewContext *vc, rcti *rect, int select, int extend)
        unsigned int *rt;
        char *selar;
        int a, index;
-       int sx = BLI_RCT_SIZE_X(rect) + 1;
-       int sy = BLI_RCT_SIZE_Y(rect) + 1;
+       int sx = BLI_rcti_size_x(rect) + 1;
+       int sy = BLI_rcti_size_y(rect) + 1;
        
        me = BKE_mesh_from_object(ob);
 
index a829ef5..6b6018e 100644 (file)
@@ -485,8 +485,8 @@ static int ed_preview_draw_rect(ScrArea *sa, Scene *sce, ID *id, int split, int
        char name[32];
        int do_gamma_correct = FALSE, do_predivide = FALSE;
        int offx = 0;
-       int newx = BLI_RCT_SIZE_X(rect);
-       int newy = BLI_RCT_SIZE_Y(rect);
+       int newx = BLI_rcti_size_x(rect);
+       int newy = BLI_rcti_size_y(rect);
 
        if (id && GS(id->name) != ID_TE) {
                /* exception: don't color manage texture previews - show the raw values */
@@ -569,8 +569,8 @@ void ED_preview_draw(const bContext *C, void *idp, void *parentp, void *slotp, r
                SpaceButs *sbuts = sa->spacedata.first;
                rcti newrect;
                int ok;
-               int newx = BLI_RCT_SIZE_X(rect);
-               int newy = BLI_RCT_SIZE_Y(rect);
+               int newx = BLI_rcti_size_x(rect);
+               int newy = BLI_rcti_size_y(rect);
 
                newrect.xmin = rect->xmin;
                newrect.xmax = rect->xmin;
index 0bfe5d0..d145145 100644 (file)
@@ -104,8 +104,8 @@ static void region_draw_emboss(ARegion *ar, rcti *scirct)
 
 void ED_region_pixelspace(ARegion *ar)
 {
-       int width  = BLI_RCT_SIZE_X(&ar->winrct) + 1;
-       int height = BLI_RCT_SIZE_Y(&ar->winrct) + 1;
+       int width  = BLI_rcti_size_x(&ar->winrct) + 1;
+       int height = BLI_rcti_size_y(&ar->winrct) + 1;
        
        wmOrtho2(-GLA_PIXEL_OFS, (float)width - GLA_PIXEL_OFS, -GLA_PIXEL_OFS, (float)height - GLA_PIXEL_OFS);
        glLoadIdentity();
@@ -901,10 +901,10 @@ static void region_azone_add(ScrArea *sa, ARegion *ar, int alignment)
 static int rct_fits(rcti *rect, char dir, int size)
 {
        if (dir == 'h') {
-               return BLI_RCT_SIZE_X(rect) - size;
+               return BLI_rcti_size_x(rect) - size;
        }
        else {  /* 'v' */
-               return BLI_RCT_SIZE_Y(rect) - size;
+               return BLI_rcti_size_y(rect) - size;
        }
 }
 
@@ -1010,7 +1010,7 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int
                
                if (alignment == RGN_ALIGN_HSPLIT) {
                        if (rct_fits(remainder, 'h', prefsizex) > 4) {
-                               ar->winrct.xmax = BLI_RCT_CENTER_X(remainder);
+                               ar->winrct.xmax = BLI_rcti_cent_x(remainder);
                                remainder->xmin = ar->winrct.xmax + 1;
                        }
                        else {
@@ -1019,7 +1019,7 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int
                }
                else {
                        if (rct_fits(remainder, 'v', prefsizey) > 4) {
-                               ar->winrct.ymax = BLI_RCT_CENTER_Y(remainder);
+                               ar->winrct.ymax = BLI_rcti_cent_y(remainder);
                                remainder->ymin = ar->winrct.ymax + 1;
                        }
                        else {
@@ -1051,20 +1051,20 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int
                }
                if (quad) {
                        if (quad == 1) { /* left bottom */
-                               ar->winrct.xmax = BLI_RCT_CENTER_X(remainder);
-                               ar->winrct.ymax = BLI_RCT_CENTER_Y(remainder);
+                               ar->winrct.xmax = BLI_rcti_cent_x(remainder);
+                               ar->winrct.ymax = BLI_rcti_cent_y(remainder);
                        }
                        else if (quad == 2) { /* left top */
-                               ar->winrct.xmax = BLI_RCT_CENTER_X(remainder);
-                               ar->winrct.ymin = BLI_RCT_CENTER_Y(remainder) + 1;
+                               ar->winrct.xmax = BLI_rcti_cent_x(remainder);
+                               ar->winrct.ymin = BLI_rcti_cent_y(remainder) + 1;
                        }
                        else if (quad == 3) { /* right bottom */
-                               ar->winrct.xmin = BLI_RCT_CENTER_X(remainder) + 1;
-                               ar->winrct.ymax = BLI_RCT_CENTER_Y(remainder);
+                               ar->winrct.xmin = BLI_rcti_cent_x(remainder) + 1;
+                               ar->winrct.ymax = BLI_rcti_cent_y(remainder);
                        }
                        else {  /* right top */
-                               ar->winrct.xmin = BLI_RCT_CENTER_X(remainder) + 1;
-                               ar->winrct.ymin = BLI_RCT_CENTER_Y(remainder) + 1;
+                               ar->winrct.xmin = BLI_rcti_cent_x(remainder) + 1;
+                               ar->winrct.ymin = BLI_rcti_cent_y(remainder) + 1;
                                BLI_rcti_init(remainder, 0, 0, 0, 0);
                        }
 
@@ -1073,8 +1073,8 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int
        }
        
        /* for speedup */
-       ar->winx = BLI_RCT_SIZE_X(&ar->winrct) + 1;
-       ar->winy = BLI_RCT_SIZE_Y(&ar->winrct) + 1;
+       ar->winx = BLI_rcti_size_x(&ar->winrct) + 1;
+       ar->winy = BLI_rcti_size_y(&ar->winrct) + 1;
        
        /* set winrect for azones */
        if (ar->flag & (RGN_FLAG_HIDDEN | RGN_FLAG_TOO_SMALL)) {
@@ -1096,8 +1096,8 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int
        if (ar->alignment & RGN_SPLIT_PREV) {
                if (ar->prev) {
                        remainder = remainder_prev;
-                       ar->prev->winx = BLI_RCT_SIZE_X(&ar->prev->winrct) + 1;
-                       ar->prev->winy = BLI_RCT_SIZE_Y(&ar->prev->winrct) + 1;
+                       ar->prev->winx = BLI_rcti_size_x(&ar->prev->winrct) + 1;
+                       ar->prev->winy = BLI_rcti_size_y(&ar->prev->winrct) + 1;
                }
        }
        
@@ -1133,8 +1133,8 @@ static void area_calc_totrct(ScrArea *sa, int sizex, int sizey)
        else sa->totrct.ymax = sa->v2->vec.y;
        
        /* for speedup */
-       sa->winx = BLI_RCT_SIZE_X(&sa->totrct) + 1;
-       sa->winy = BLI_RCT_SIZE_Y(&sa->totrct) + 1;
+       sa->winx = BLI_rcti_size_x(&sa->totrct) + 1;
+       sa->winy = BLI_rcti_size_y(&sa->totrct) + 1;
 }
 
 
@@ -1268,8 +1268,8 @@ void ED_region_init(bContext *C, ARegion *ar)
        /* refresh can be called before window opened */
        region_subwindow(CTX_wm_window(C), ar);
        
-       ar->winx = BLI_RCT_SIZE_X(&ar->winrct) + 1;
-       ar->winy = BLI_RCT_SIZE_Y(&ar->winrct) + 1;
+       ar->winx = BLI_rcti_size_x(&ar->winrct) + 1;
+       ar->winy = BLI_rcti_size_y(&ar->winrct) + 1;
        
        /* UI convention */
        wmOrtho2(-0.01f, ar->winx - 0.01f, -0.01f, ar->winy - 0.01f);
@@ -1574,7 +1574,7 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char *
                newcontext = UI_view2d_tab_set(v2d, contextnr);
 
        if (vertical) {
-               w = BLI_RCT_SIZE_X(&v2d->cur);
+               w = BLI_rctf_size_x(&v2d->cur);
                em = (ar->type->prefsizex) ? UI_UNIT_Y / 2 : UI_UNIT_Y;
        }
        else {
@@ -1769,7 +1769,7 @@ void ED_region_header(const bContext *C, ARegion *ar)
        }
 
        /* always as last  */
-       UI_view2d_totRect_set(&ar->v2d, maxco + UI_UNIT_X + 80, BLI_RCT_SIZE_Y(&ar->v2d.tot));
+       UI_view2d_totRect_set(&ar->v2d, maxco + UI_UNIT_X + 80, BLI_rctf_size_y(&ar->v2d.tot));
 
        /* restore view matrix? */
        UI_view2d_view_restore(C);
@@ -1798,16 +1798,16 @@ void ED_region_info_draw(ARegion *ar, const char *text, int block, float alpha)
        /* background box */
        rect = ar->winrct;
        rect.xmin = 0;
-       rect.ymin = BLI_RCT_SIZE_Y(&ar->winrct) - header_height;
+       rect.ymin = BLI_rcti_size_y(&ar->winrct) - header_height;
 
        if (block) {
-               rect.xmax = BLI_RCT_SIZE_X(&ar->winrct);
+               rect.xmax = BLI_rcti_size_x(&ar->winrct);
        }
        else {
                rect.xmax = rect.xmin + BLF_width(fontid, text) + 24;
        }
 
-       rect.ymax = BLI_RCT_SIZE_Y(&ar->winrct);
+       rect.ymax = BLI_rcti_size_y(&ar->winrct);
 
        glEnable(GL_BLEND);
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
index c93f415..24053d7 100644 (file)
@@ -669,8 +669,8 @@ void glaDrawPixelsSafe(float x, float y, int img_w, int img_h, int row_w, int fo
 
 void glaDefine2DArea(rcti *screen_rect)
 {
-       const int sc_w = BLI_RCT_SIZE_X(screen_rect) + 1;
-       const int sc_h = BLI_RCT_SIZE_Y(screen_rect) + 1;
+       const int sc_w = BLI_rcti_size_x(screen_rect) + 1;
+       const int sc_h = BLI_rcti_size_y(screen_rect) + 1;
 
        glViewport(screen_rect->xmin, screen_rect->ymin, sc_w, sc_h);
        glScissor(screen_rect->xmin, screen_rect->ymin, sc_w, sc_h);
@@ -714,10 +714,10 @@ void gla2DSetMap(gla2DDrawInfo *di, rctf *rect)
 
        di->world_rect = *rect;
        
-       sc_w = BLI_RCT_SIZE_X(&di->screen_rect);
-       sc_h = BLI_RCT_SIZE_Y(&di->screen_rect);
-       wo_w = BLI_RCT_SIZE_X(&di->world_rect);
-       wo_h = BLI_RCT_SIZE_Y(&di->world_rect);
+       sc_w = BLI_rcti_size_x(&di->screen_rect);
+       sc_h = BLI_rcti_size_y(&di->screen_rect);
+       wo_w = BLI_rcti_size_x(&di->world_rect);
+       wo_h = BLI_rcti_size_y(&di->world_rect);
        
        di->wo_to_sc[0] = sc_w / wo_w;
        di->wo_to_sc[1] = sc_h / wo_h;
@@ -745,10 +745,10 @@ gla2DDrawInfo *glaBegin2DDraw(rcti *screen_rect, rctf *world_rect)
                di->world_rect.ymax = di->screen_rect.ymax;
        }
 
-       sc_w = BLI_RCT_SIZE_X(&di->screen_rect);
-       sc_h = BLI_RCT_SIZE_Y(&di->screen_rect);
-       wo_w = BLI_RCT_SIZE_X(&di->world_rect);
-       wo_h = BLI_RCT_SIZE_Y(&di->world_rect);
+       sc_w = BLI_rcti_size_x(&di->screen_rect);
+       sc_h = BLI_rcti_size_y(&di->screen_rect);
+       wo_w = BLI_rcti_size_x(&di->world_rect);
+       wo_h = BLI_rcti_size_y(&di->world_rect);
 
        di->wo_to_sc[0] = sc_w / wo_w;
        di->wo_to_sc[1] = sc_h / wo_h;
index 50a210e..f7f1c28 100644 (file)
@@ -1635,10 +1635,10 @@ static int area_max_regionsize(ScrArea *sa, ARegion *scalear, AZEdge edge)
        int dist;
        
        if (edge == AE_RIGHT_TO_TOPLEFT || edge == AE_LEFT_TO_TOPRIGHT) {
-               dist = BLI_RCT_SIZE_X(&sa->totrct);
+               dist = BLI_rcti_size_x(&sa->totrct);
        }
        else {  /* AE_BOTTOM_TO_TOPLEFT, AE_TOP_TO_BOTTOMRIGHT */
-               dist = BLI_RCT_SIZE_Y(&sa->totrct);
+               dist = BLI_rcti_size_y(&sa->totrct);
        }
        
        /* subtractwidth of regions on opposite side 
index 5e54119..301df71 100644 (file)
@@ -149,8 +149,8 @@ static void screenshot_crop(ImBuf *ibuf, rcti crop)
 {
        unsigned int *to = ibuf->rect;
        unsigned int *from = ibuf->rect + crop.ymin * ibuf->x + crop.xmin;
-       int crop_x = BLI_RCT_SIZE_X(&crop);
-       int crop_y = BLI_RCT_SIZE_Y(&crop);
+       int crop_x = BLI_rcti_size_x(&crop);
+       int crop_y = BLI_rcti_size_y(&crop);
        int y;
 
        if (crop_x > 0 && crop_y > 0) {
index 8616d4e..dec75aa 100644 (file)
@@ -441,8 +441,8 @@ static void paint_draw_alpha_overlay(Sculpt *sd, Brush *brush,
                else {
                        quad.xmin = 0;
                        quad.ymin = 0;
-                       quad.xmax = BLI_RCT_SIZE_X(&vc->ar->winrct);
-                       quad.ymax = BLI_RCT_SIZE_Y(&vc->ar->winrct);
+                       quad.xmax = BLI_rcti_size_x(&vc->ar->winrct);
+                       quad.ymax = BLI_rcti_size_y(&vc->ar->winrct);
                }
 
                /* set quad color */
index 878fd20..10adeb3 100644 (file)
@@ -89,7 +89,7 @@ void draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar)
         *        start of list offset, and the second is as a correction for the scrollers.
         */
        height = ((items * ACHANNEL_STEP) + (ACHANNEL_HEIGHT * 2));
-       if (height > BLI_RCT_SIZE_Y(&v2d->mask)) {
+       if (height > BLI_rcti_size_y(&v2d->mask)) {
                /* don't use totrect set, as the width stays the same 
                 * (NOTE: this is ok here, the configuration is pretty straightforward) 
                 */
index c95f1db..7635f85 100644 (file)
@@ -365,13 +365,13 @@ static int actkeys_viewall(bContext *C, const short onlySel)
        /* set the horizontal range, with an extra offset so that the extreme keys will be in view */
        get_keyframe_extents(&ac, &v2d->cur.xmin, &v2d->cur.xmax, onlySel);
        
-       extra = 0.1f * BLI_RCT_SIZE_X(&v2d->cur);
+       extra = 0.1f * BLI_rctf_size_x(&v2d->cur);
        v2d->cur.xmin -= extra;
        v2d->cur.xmax += extra;
        
        /* set vertical range */
        v2d->cur.ymax = 0.0f;
-       v2d->cur.ymin = (float)-BLI_RCT_SIZE_Y(&v2d->mask);
+       v2d->cur.ymin = (float)-BLI_rcti_size_y(&v2d->mask);
        
        /* do View2D syncing */
        UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY);
index 9ab79d7..ab2b473 100644 (file)
@@ -309,7 +309,7 @@ static int actkeys_borderselect_exec(bContext *C, wmOperator *op)
                 *      - the frame-range select option is favored over the channel one (x over y), as frame-range one is often
                 *        used for tweaking timing when "blocking", while channels is not that useful...
                 */
-               if (BLI_RCT_SIZE_X(&rect) >= BLI_RCT_SIZE_Y(&rect))
+               if (BLI_rcti_size_x(&rect) >= BLI_rcti_size_y(&rect))
                        mode = ACTKEYS_BORDERSEL_FRAMERANGE;
                else
                        mode = ACTKEYS_BORDERSEL_CHANNELS;
index 4bcd4a9..ebba7d9 100644 (file)
@@ -148,7 +148,7 @@ void buttons_header_buttons(const bContext *C, ARegion *ar)
        uiBlockEndAlign(block);
        
        /* always as last  */
-       UI_view2d_totRect_set(&ar->v2d, xco + (UI_UNIT_X / 2), BLI_RCT_SIZE_Y(&ar->v2d.tot));
+       UI_view2d_totRect_set(&ar->v2d, xco + (UI_UNIT_X / 2), BLI_rctf_size_y(&ar->v2d.tot));
        
        uiEndBlock(C, block);
        uiDrawBlock(C, block);
index 0a1e1d7..969b0e2 100644 (file)
@@ -174,7 +174,7 @@ void uiTemplateTrack(uiLayout *layout, PointerRNA *ptr, const char *propname)
        scopes->track_preview_height =
                (scopes->track_preview_height <= UI_UNIT_Y) ? UI_UNIT_Y : scopes->track_preview_height;
 
-       uiDefBut(block, TRACKPREVIEW, 0, "", rect.xmin, rect.ymin, BLI_RCT_SIZE_X(&rect),
+       uiDefBut(block, TRACKPREVIEW, 0, "", rect.xmin, rect.ymin, BLI_rctf_size_x(&rect),
                 scopes->track_preview_height, scopes, 0, 0, 0, 0, "");
 }
 
index 5d89015..cc1b8d4 100644 (file)
@@ -274,7 +274,7 @@ void clip_draw_dopesheet_channels(const bContext *C, ARegion *ar)
        dopesheet = &tracking->dopesheet;
        height = (dopesheet->tot_channel * CHANNEL_STEP) + (CHANNEL_HEIGHT * 2);
 
-       if (height > BLI_RCT_SIZE_Y(&v2d->mask)) {
+       if (height > BLI_rcti_size_y(&v2d->mask)) {
                /* don't use totrect set, as the width stays the same
                 * (NOTE: this is ok here, the configuration is pretty straightforward)
                 */
index d486cae..b22c9a6 100644 (file)
@@ -957,12 +957,12 @@ static void draw_marker_texts(SpaceClip *sc, MovieTrackingTrack *track, MovieTra
 static void view2d_to_region_float(View2D *v2d, float x, float y, float *regionx, float *regiony)
 {
        /* express given coordinates as proportional values */
-       x = -v2d->cur.xmin / BLI_RCT_SIZE_X(&v2d->cur);
-       y = -v2d->cur.ymin / BLI_RCT_SIZE_Y(&v2d->cur);
+       x = -v2d->cur.xmin / BLI_rctf_size_x(&v2d->cur);
+       y = -v2d->cur.ymin / BLI_rctf_size_y(&v2d->cur);
 
        /* convert proportional distances to screen coordinates */
-       *regionx = v2d->mask.xmin + x * BLI_RCT_SIZE_X(&v2d->mask);
-       *regiony = v2d->mask.ymin + y * BLI_RCT_SIZE_Y(&v2d->mask);
+       *regionx = v2d->mask.xmin + x * BLI_rcti_size_x(&v2d->mask);
+       *regiony = v2d->mask.ymin + y * BLI_rcti_size_y(&v2d->mask);
 }
 
 static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip,
index f2a48f2..32f9167 100644 (file)
@@ -149,8 +149,8 @@ void ED_space_clip_get_zoom(SpaceClip *sc, ARegion *ar, float *zoomx, float *zoo
 
        ED_space_clip_get_size(sc, &width, &height);
 
-       *zoomx = (float)(BLI_RCT_SIZE_X(&ar->winrct) + 1) / (float)(BLI_RCT_SIZE_X(&ar->v2d.cur) * width);
-       *zoomy = (float)(BLI_RCT_SIZE_Y(&ar->winrct) + 1) / (float)(BLI_RCT_SIZE_Y(&ar->v2d.cur) * height);
+       *zoomx = (float)(BLI_rcti_size_x(&ar->winrct) + 1) / (BLI_rctf_size_x(&ar->v2d.cur) * width);
+       *zoomy = (float)(BLI_rcti_size_y(&ar->winrct) + 1) / (BLI_rctf_size_y(&ar->v2d.cur) * height);
 }
 
 void ED_space_clip_get_aspect(SpaceClip *sc, float *aspx, float *aspy)
@@ -388,8 +388,8 @@ int ED_clip_view_selection(const bContext *C, ARegion *ar, int fit)
 
                ED_space_clip_get_aspect(sc, &aspx, &aspy);
 
-               width  = BLI_RCT_SIZE_X(&ar->winrct) + 1;
-               height = BLI_RCT_SIZE_Y(&ar->winrct) + 1;
+               width  = BLI_rcti_size_x(&ar->winrct) + 1;
+               height = BLI_rcti_size_y(&ar->winrct) + 1;
 
                zoomx = (float)width / w / aspx;
                zoomy = (float)height / h / aspy;
index f48d4e8..fa235bd 100644 (file)
@@ -580,11 +580,11 @@ static int view_all_exec(bContext *C, wmOperator *UNUSED(op))
        }
 
        /* we need an extra "buffer" factor on either side so that the endpoints are visible */
-       extra = 0.01f * BLI_RCT_SIZE_X(&v2d->cur);
+       extra = 0.01f * BLI_rctf_size_x(&v2d->cur);
        v2d->cur.xmin -= extra;
        v2d->cur.xmax += extra;
 
-       extra = 0.01f * BLI_RCT_SIZE_Y(&v2d->cur);
+       extra = 0.01f * BLI_rctf_size_y(&v2d->cur);
        v2d->cur.ymin -= extra;
        v2d->cur.ymax += extra;
 
@@ -610,7 +610,7 @@ void CLIP_OT_graph_view_all(wmOperatorType *ot)
 void ED_clip_graph_center_current_frame(Scene *scene, ARegion *ar)
 {
        View2D *v2d = &ar->v2d;
-       float extra = BLI_RCT_SIZE_X(&v2d->cur) / 2.0f;
+       float extra = BLI_rctf_size_x(&v2d->cur) / 2.0f;
 
        /* set extents of view to start/end frames */
        v2d->cur.xmin = (float)CFRA - extra;
index aa2cadb..5c338f3 100644 (file)
@@ -90,9 +90,9 @@ static void sclip_zoom_set(const bContext *C, float zoom, float location[2])
 
                if ((width < 4) && (height < 4))
                        sc->zoom = oldzoom;
-               else if (BLI_RCT_SIZE_X(&ar->winrct) <= sc->zoom)
+               else if (BLI_rcti_size_x(&ar->winrct) <= sc->zoom)
                        sc->zoom = oldzoom;
-               else if (BLI_RCT_SIZE_Y(&ar->winrct) <= sc->zoom)
+               else if (BLI_rcti_size_y(&ar->winrct) <= sc->zoom)
                        sc->zoom = oldzoom;
        }
 
@@ -726,8 +726,8 @@ static int view_all_exec(bContext *C, wmOperator *op)
        h = h * aspy;
 
        /* check if the image will fit in the image with zoom == 1 */
-       width  = BLI_RCT_SIZE_X(&ar->winrct) + 1;
-       height = BLI_RCT_SIZE_Y(&ar->winrct) + 1;
+       width  = BLI_rcti_size_x(&ar->winrct) + 1;
+       height = BLI_rcti_size_y(&ar->winrct) + 1;
 
        if (fit_view) {
                const int margin = 5; /* margin from border */
index 7f43c40..3f925df 100644 (file)
@@ -1036,8 +1036,8 @@ static void movieclip_main_area_set_view2d(const bContext *C, ARegion *ar)
        if (clip)
                h *= clip->aspy / clip->aspx / clip->tracking.camera.pixel_aspect;
 
-       winx = BLI_RCT_SIZE_X(&ar->winrct) + 1;
-       winy = BLI_RCT_SIZE_Y(&ar->winrct) + 1;
+       winx = BLI_rcti_size_x(&ar->winrct) + 1;
+       winy = BLI_rcti_size_y(&ar->winrct) + 1;
 
        ar->v2d.tot.xmin = 0;
        ar->v2d.tot.ymin = 0;
index a4f7e30..b7ef278 100644 (file)
@@ -142,7 +142,7 @@ static void console_main_area_init(wmWindowManager *wm, ARegion *ar)
 
        /* always keep the bottom part of the view aligned, less annoying */
        if (prev_y_min != ar->v2d.cur.ymin) {
-               const float cur_y_range = BLI_RCT_SIZE_Y(&ar->v2d.cur);
+               const float cur_y_range = BLI_rctf_size_y(&ar->v2d.cur);
                ar->v2d.cur.ymin = prev_y_min;
                ar->v2d.cur.ymax = prev_y_min + cur_y_range;
        }
index 09231ef..1fa89e5 100644 (file)
@@ -270,12 +270,12 @@ int ED_fileselect_layout_numfiles(FileLayout *layout, ARegion *ar)
        int numfiles;
 
        if (layout->flag & FILE_LAYOUT_HOR) {
-               int width = (int)(BLI_RCT_SIZE_X(&ar->v2d.cur) - 2 * layout->tile_border_x);
+               int width = (int)(BLI_rctf_size_x(&ar->v2d.cur) - 2 * layout->tile_border_x);
                numfiles = (int)((float)width / (float)layout->tile_w + 0.5f);
                return numfiles * layout->rows;
        }
        else {
-               int height = (int)(BLI_RCT_SIZE_Y(&ar->v2d.cur) - 2 * layout->tile_border_y);
+               int height = (int)(BLI_rctf_size_y(&ar->v2d.cur) - 2 * layout->tile_border_y);
                numfiles = (int)((float)height / (float)layout->tile_h + 0.5f);
                return numfiles * layout->columns;
        }
@@ -503,7 +503,7 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, ARegion *ar)
                layout->prv_border_y = 6;
                layout->tile_w = layout->prv_w + 2 * layout->prv_border_x;
                layout->tile_h = layout->prv_h + 2 * layout->prv_border_y + textheight;
-               layout->width = (int)(BLI_RCT_SIZE_X(&v2d->cur) - 2 * layout->tile_border_x);
+               layout->width = (int)(BLI_rctf_size_x(&v2d->cur) - 2 * layout->tile_border_x);
                layout->columns = layout->width / (layout->tile_w + 2 * layout->tile_border_x);
                if (layout->columns > 0)
                        layout->rows = numfiles / layout->columns + 1;  // XXX dirty, modulo is zero
@@ -522,7 +522,7 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, ARegion *ar)
                layout->prv_border_x = 0;
                layout->prv_border_y = 0;
                layout->tile_h = textheight * 3 / 2;
-               layout->height = (int)(BLI_RCT_SIZE_Y(&v2d->cur) - 2 * layout->tile_border_y);
+               layout->height = (int)(BLI_rctf_size_y(&v2d->cur) - 2 * layout->tile_border_y);
                layout->rows = layout->height / (layout->tile_h + 2 * layout->tile_border_y);
 
                column_widths(sfile->files, layout);
index 4b568b4..509a4f0 100644 (file)
@@ -537,7 +537,7 @@ static void file_ui_area_draw(const bContext *C, ARegion *ar)
        glClear(GL_COLOR_BUFFER_BIT);
 
        /* scrolling here is just annoying, disable it */
-       ar->v2d.cur.ymax = BLI_RCT_SIZE_Y(&ar->v2d.cur);
+       ar->v2d.cur.ymax = BLI_rctf_size_y(&ar->v2d.cur);
        ar->v2d.cur.ymin = 0;
 
        /* set view2d view matrix for scrolling (without scrollers) */
index e4bda15..ef2e56a 100644 (file)
@@ -88,7 +88,7 @@ static void draw_fcurve_modifier_controls_envelope(FModifier *fcm, View2D *v2d)
 {
        FMod_Envelope *env = (FMod_Envelope *)fcm->data;
        FCM_EnvelopeData *fed;
-       const float fac = 0.05f * BLI_RCT_SIZE_X(&v2d->cur);
+       const float fac = 0.05f * BLI_rctf_size_x(&v2d->cur);
        int i;
        
        /* draw two black lines showing the standard reference levels */
@@ -137,7 +137,7 @@ static void draw_fcurve_modifier_controls_envelope(FModifier *fcm, View2D *v2d)
 static void draw_fcurve_vertices_keyframes(FCurve *fcu, SpaceIpo *UNUSED(sipo), View2D *v2d, short edit, short sel)
 {
        BezTriple *bezt = fcu->bezt;
-       const float fac = 0.05f * BLI_RCT_SIZE_X(&v2d->cur);
+       const float fac = 0.05f * BLI_rctf_size_x(&v2d->cur);
        int i;
        
        /* we use bgl points not standard gl points, to workaround vertex 
index f01d64b..7107a6a 100644 (file)
@@ -229,11 +229,11 @@ static int graphkeys_viewall(bContext *C, const short do_sel_only, const short i
                                   &cur_new.ymin, &cur_new.ymax,
                                   do_sel_only, include_handles);
 
-       extra = 0.1f * BLI_RCT_SIZE_X(&cur_new);
+       extra = 0.1f * BLI_rctf_size_x(&cur_new);
        cur_new.xmin -= extra;
        cur_new.xmax += extra;
 
-       extra = 0.1f * BLI_RCT_SIZE_Y(&cur_new);
+       extra = 0.1f * BLI_rctf_size_y(&cur_new);
        cur_new.ymin -= extra;
        cur_new.ymax += extra;
 
index 633f2b7..e2fc165 100644 (file)
@@ -325,7 +325,7 @@ static int graphkeys_borderselect_exec(bContext *C, wmOperator *op)
                 *      - the frame-range select option is favored over the channel one (x over y), as frame-range one is often
                 *        used for tweaking timing when "blocking", while channels is not that useful...
                 */
-               if ((BLI_RCT_SIZE_X(&rect)) >= (BLI_RCT_SIZE_Y(&rect)))
+               if ((BLI_rcti_size_x(&rect)) >= (BLI_rcti_size_y(&rect)))
                        mode = BEZT_OK_FRAMERANGE;
                else
                        mode = BEZT_OK_VALUERANGE;
index c372973..3728d68 100644 (file)
@@ -228,13 +228,13 @@ static void preview_cb(ScrArea *sa, struct uiBlock *block)
        int mval[2];
        
        if (G.scene->r.mode & R_BORDER) {
-               winx *= BLI_RCT_SIZE_X(&G.scene->r.border);
-               winy *= BLI_RCT_SIZE_Y(&G.scene->r.border);
+               winx *= BLI_rcti_size_x(&G.scene->r.border);
+               winy *= BLI_rctf_size_y(&G.scene->r.border);
        }
        
        /* while dragging we need to update the rects, otherwise it doesn't end with correct one */
 
-       BLI_rctf_init(&dispf, 15.0f, BLI_RCT_SIZE_X(&block->rect) - 15.0f, 15.0f, (BLI_RCT_SIZE_Y(&block->rect)) - 15.0f);
+       BLI_rctf_init(&dispf, 15.0f, BLI_rcti_size_x(&block->rect) - 15.0f, 15.0f, (BLI_rctf_size_y(&block->rect)) - 15.0f);
        ui_graphics_to_window_rct(sa->win, &dispf, disprect);
        
        /* correction for gla draw */
index 638a2ac..52bb44d 100644 (file)
@@ -118,7 +118,7 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, int color_manage, int use_def
 
        /* noisy, high contrast make impossible to read if lower alpha is used. */
        glColor4ub(0, 0, 0, 190);
-       glRecti(0.0, 0.0, BLI_RCT_SIZE_X(&ar->winrct) + 1, 20);
+       glRecti(0.0, 0.0, BLI_rcti_size_x(&ar->winrct) + 1, 20);
        glDisable(GL_BLEND);
 
        BLF_size(blf_mono_font, 11, 72);
index 79d0149..9243344 100644 (file)
@@ -161,8 +161,8 @@ void ED_space_image_get_size(SpaceImage *sima, int *width, int *height)
                *height = (scene->r.ysch * scene->r.size) / 100;
 
                if ((scene->r.mode & R_BORDER) && (scene->r.mode & R_CROP)) {
-                       *width  *= BLI_RCT_SIZE_X(&scene->r.border);
-                       *height *= BLI_RCT_SIZE_Y(&scene->r.border);
+                       *width  *= BLI_rctf_size_x(&scene->r.border);
+                       *height *= BLI_rctf_size_y(&scene->r.border);
                }
 
        }
@@ -204,8 +204,8 @@ void ED_space_image_get_zoom(SpaceImage *sima, ARegion *ar, float *zoomx, float
 
        ED_space_image_get_size(sima, &width, &height);
 
-       *zoomx = (float)(BLI_RCT_SIZE_X(&ar->winrct) + 1) / (float)(BLI_RCT_SIZE_X(&ar->v2d.cur) * width);
-       *zoomy = (float)(BLI_RCT_SIZE_Y(&ar->winrct) + 1) / (float)(BLI_RCT_SIZE_Y(&ar->v2d.cur) * height);
+       *zoomx = (float)(BLI_rcti_size_x(&ar->winrct) + 1) / (float)(BLI_rctf_size_x(&ar->v2d.cur) * width);
+       *zoomy = (float)(BLI_rcti_size_y(&ar->winrct) + 1) / (float)(BLI_rctf_size_y(&ar->v2d.cur) * height);
 }
 
 void ED_space_image_get_uv_aspect(SpaceImage *sima, float *aspx, float *aspy)
index 16804c5..096ae0d 100644 (file)
@@ -99,9 +99,9 @@ static void sima_zoom_set(SpaceImage *sima, ARegion *ar, float zoom, float locat
 
                if ((width < 4) && (height < 4))
                        sima->zoom = oldzoom;
-               else if (BLI_RCT_SIZE_X(&ar->winrct) <= sima->zoom)
+               else if (BLI_rcti_size_x(&ar->winrct) <= sima->zoom)
                        sima->zoom = oldzoom;
-               else if (BLI_RCT_SIZE_Y(&ar->winrct) <= sima->zoom)
+               else if (BLI_rcti_size_y(&ar->winrct) <= sima->zoom)
                        sima->zoom = oldzoom;
        }
 
@@ -582,8 +582,8 @@ static int image_view_all_exec(bContext *C, wmOperator *UNUSED(op))
        h = height * aspy;
        
        /* check if the image will fit in the image with (zoom == 1) */
-       width  = BLI_RCT_SIZE_X(&ar->winrct) + 1;
-       height = BLI_RCT_SIZE_Y(&ar->winrct) + 1;
+       width  = BLI_rcti_size_x(&ar->winrct) + 1;
+       height = BLI_rcti_size_y(&ar->winrct) + 1;
 
        if ((w >= width || h >= height) && (width > 0 && height > 0)) {
                /* find the zoom value that will fit the image in the image space */
index 5b288bd..4d4129b 100644 (file)
@@ -558,8 +558,8 @@ static void image_main_area_set_view2d(SpaceImage *sima, ARegion *ar)
        if (ima)
                h *= ima->aspy / ima->aspx;
 
-       winx = BLI_RCT_SIZE_X(&ar->winrct) + 1;
-       winy = BLI_RCT_SIZE_Y(&ar->winrct) + 1;
+       winx = BLI_rcti_size_x(&ar->winrct) + 1;
+       winy = BLI_rcti_size_y(&ar->winrct) + 1;
                
        ar->v2d.tot.xmin = 0;
        ar->v2d.tot.ymin = 0;
index abffb95..abdfa0e 100644 (file)
@@ -84,10 +84,10 @@ static int cut_links_intersect(uiLinkLine *line, float mcoords[][2], int tot)
        int i, b;
        rcti rectlink;
 
-       rectlink.xmin = (int)BLI_RCT_CENTER_X(&line->from->rect);
-       rectlink.ymin = (int)BLI_RCT_CENTER_Y(&line->from->rect);
-       rectlink.xmax = (int)BLI_RCT_CENTER_X(&line->to->rect);
-       rectlink.ymax = (int)BLI_RCT_CENTER_Y(&line->to->rect);
+       rectlink.xmin = (int)BLI_rctf_cent_x(&line->from->rect);
+       rectlink.ymin = (int)BLI_rctf_cent_y(&line->from->rect);
+       rectlink.xmax = (int)BLI_rctf_cent_x(&line->to->rect);
+       rectlink.ymax = (int)BLI_rctf_cent_y(&line->to->rect);
 
        if (ui_link_bezier_points(&rectlink, coord_array, LINK_RESOL)) {
                for (i=0; i<tot-1; i++)
index 2861d17..403a8e0 100644 (file)
@@ -304,13 +304,13 @@ static int nlaedit_viewall(bContext *C, const short onlySel)
        /* set the horizontal range, with an extra offset so that the extreme keys will be in view */
        get_nlastrip_extents(&ac, &v2d->cur.xmin, &v2d->cur.xmax, onlySel);
        
-       extra = 0.1f * BLI_RCT_SIZE_X(&v2d->cur);
+       extra = 0.1f * BLI_rctf_size_x(&v2d->cur);
        v2d->cur.xmin -= extra;
        v2d->cur.xmax += extra;
        
        /* set vertical range */
        v2d->cur.ymax = 0.0f;
-       v2d->cur.ymin = (float)-BLI_RCT_SIZE_Y(&v2d->mask);
+       v2d->cur.ymin = (float)-BLI_rcti_size_y(&v2d->mask);
        
        /* do View2D syncing */
        UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY);
index 222c241..79be0d0 100644 (file)
@@ -309,7 +309,7 @@ static int nlaedit_borderselect_exec(bContext *C, wmOperator *op)
                 *      - the frame-range select option is favored over the channel one (x over y), as frame-range one is often
                 *        used for tweaking timing when "blocking", while channels is not that useful...
                 */
-               if (BLI_RCT_SIZE_X(&rect) >= BLI_RCT_SIZE_Y(&rect))
+               if (BLI_rcti_size_x(&rect) >= BLI_rcti_size_y(&rect))
                        mode = NLA_BORDERSEL_FRAMERANGE;
                else
                        mode = NLA_BORDERSEL_CHANNELS;
index 1f266c9..5c3cbf4 100644 (file)
@@ -70,7 +70,7 @@
 #include "node_intern.h"  /* own include */
 
 /* XXX interface.h */
-extern void ui_dropshadow(rctf *rct, float radius, float aspect, float alpha, int select);
+extern void ui_dropshadow(const rctf *rct, float radius, float aspect, float alpha, int select);
 
 /* ****************** SOCKET BUTTON DRAW FUNCTIONS ***************** */
 
@@ -387,7 +387,7 @@ static void node_buts_normal(uiLayout *layout, bContext *UNUSED(C), PointerRNA *
        
        bt = uiDefButF(block, BUT_NORMAL, B_NODE_EXEC, "",
                       (int)butr->xmin, (int)butr->xmin,
-                      (short)BLI_RCT_SIZE_X(butr), (short)BLI_RCT_SIZE_X(butr),
+                      (short)BLI_rctf_size_x(butr), (short)BLI_rctf_size_x(butr),
                       nor, 0.0f, 1.0f, 0, 0, "");
        uiButSetFunc(bt, node_normal_cb, ntree, node);
 }
@@ -523,7 +523,7 @@ static void node_update_group(const bContext *C, bNodeTree *ntree, bNode *gnode)
                rect->ymax += NODE_DY;
                
                /* input sockets */
-               dy = BLI_RCT_CENTER_Y(rect) + (NODE_DY * (BLI_countlist(&gnode->inputs) - 1));
+               dy = BLI_rctf_cent_y(rect) + (NODE_DY * (BLI_countlist(&gnode->inputs) - 1));
                gsock = ngroup->inputs.first;
                sock = gnode->inputs.first;
                while (gsock || sock) {
@@ -571,7 +571,7 @@ static void node_update_group(const bContext *C, bNodeTree *ntree, bNode *gnode)
                }
                
                /* output sockets */
-               dy = BLI_RCT_CENTER_Y(rect) + (NODE_DY * (BLI_countlist(&gnode->outputs) - 1));
+               dy = BLI_rctf_cent_y(rect) + (NODE_DY * (BLI_countlist(&gnode->outputs) - 1));
                gsock = ngroup->outputs.first;
                sock = gnode->outputs.first;
                while (gsock || sock) {
@@ -837,7 +837,7 @@ static void node_draw_group(const bContext *C, ARegion *ar, SpaceNode *snode, bN
        
                layout = uiBlockLayout(gnode->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL,
                                       (int)(rect.xmin + NODE_MARGIN_X), (int)(rect.ymax + (group_header - (2.5f * dpi_fac))),
-                                      mini((int)(BLI_RCT_SIZE_X(&rect) - 18.0f), node_group_frame + 20), group_header, UI_GetStyle());
+                                      mini((int)(BLI_rctf_size_x(&rect) - 18.0f), node_group_frame + 20), group_header, UI_GetStyle());
                RNA_pointer_create(&ntree->id, &RNA_Node, gnode, &ptr);
                uiTemplateIDBrowse(layout, (bContext *)C, &ptr, "node_tree", NULL, NULL, NULL);
                uiBlockLayoutResolve(gnode->block, NULL, NULL);
@@ -979,7 +979,7 @@ static void node_draw_frame_label(bNode *node, const float aspect)
        ascender = BLF_ascender(fontid);
        
        /* 'x' doesn't need aspect correction */
-       x = BLI_RCT_CENTER_X(rct) - (0.5f * width);
+       x = BLI_rctf_cent_x(rct) - (0.5f * width);
        y = rct->ymax - (((NODE_DY / 4) / aspect) + (ascender * aspect));
 
        BLF_position(fontid, x, y, 0);
index 7d35f56..fd14cf1 100644 (file)
@@ -65,7 +65,7 @@
 /* width of socket columns in group display */
 #define NODE_GROUP_FRAME  120
 /* XXX interface.h */
-extern void ui_dropshadow(rctf *rct, float radius, float aspect, float alpha, int select);
+extern void ui_dropshadow(const rctf *rct, float radius, float aspect, float alpha, int select);
 
 /* XXX update functions for node editor are a mess, needs a clear concept */
 void ED_node_tree_update(SpaceNode *snode, Scene *scene)
@@ -343,7 +343,7 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
                        if (node->prvr.ymax < node->prvr.ymin) SWAP(float, node->prvr.ymax, node->prvr.ymin);
                }
                else {
-                       float oldh = BLI_RCT_SIZE_Y(&node->prvr);
+                       float oldh = BLI_rctf_size_y(&node->prvr);
                        if (oldh == 0.0f)
                                oldh = 0.6f * node->width - NODE_DY;
                        dy -= NODE_DYS / 2;
@@ -584,9 +584,9 @@ void node_socket_circle_draw(bNodeTree *UNUSED(ntree), bNodeSocket *sock, float
 /* not a callback */
 static void node_draw_preview(bNodePreview *preview, rctf *prv)
 {
-       float xscale = BLI_RCT_SIZE_X(prv) / ((float)preview->xsize);
-       float yscale = BLI_RCT_SIZE_Y(prv) / ((float)preview->ysize);
-       float tile   = BLI_RCT_SIZE_X(prv) / 10.0f;
+       float xscale = BLI_rctf_size_x(prv) / ((float)preview->xsize);
+       float yscale = BLI_rctf_size_y(prv) / ((float)preview->ysize);
+       float tile   = BLI_rctf_size_x(prv) / 10.0f;
        float x, y;
        
        /* draw checkerboard backdrop to show alpha */
@@ -852,8 +852,8 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
 {
        bNodeSocket *sock;
        rctf *rct = &node->totr;
-       float dx, centy = BLI_RCT_CENTER_Y(rct);
-       float hiddenrad = BLI_RCT_SIZE_Y(rct) / 2.0f;
+       float dx, centy = BLI_rctf_cent_y(rct);
+       float hiddenrad = BLI_rctf_size_y(rct) / 2.0f;
        float socket_size = NODE_SOCKSIZE * U.dpi / 72;
        int color_id = node_get_colorid(node);
        char showname[128]; /* 128 is used below */
@@ -932,7 +932,7 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
 
                uiDefBut(node->block, LABEL, 0, showname,
                         (int)(rct->xmin + (NODE_MARGIN_X / snode->aspect_sqrt)), (int)(centy - 10),
-                        (short)(BLI_RCT_SIZE_X(rct) - 18.0f - 12.0f), (short)NODE_DY,
+                        (short)(BLI_rctf_size_x(rct) - 18.0f - 12.0f), (short)NODE_DY,
                         NULL, 0, 0, 0, 0, "");
        }       
 
@@ -1108,7 +1108,7 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
        glEnable(GL_MAP1_VERTEX_3);
 
        /* aspect+font, set each time */
-       snode->aspect = BLI_RCT_SIZE_X(&v2d->cur) / (float)ar->winx;
+       snode->aspect = BLI_rctf_size_x(&v2d->cur) / (float)ar->winx;
        snode->aspect_sqrt = sqrtf(snode->aspect);
        // XXX snode->curfont= uiSetCurFont_ext(snode->aspect);
 
index cc386da..64a8d96 100644 (file)
@@ -2067,8 +2067,8 @@ static int node_clipboard_paste_exec(bContext *C, wmOperator *op)
        /* calculate "barycenter" for placing on mouse cursor */
        zero_v2(center);
        for (node = clipboard_nodes_lb->first, num_nodes = 0; node; node = node->next, num_nodes++) {
-               center[0] += BLI_RCT_CENTER_X(&node->totr);
-               center[1] += BLI_RCT_CENTER_Y(&node->totr);
+               center[0] += BLI_rctf_cent_x(&node->totr);
+               center[1] += BLI_rctf_cent_y(&node->totr);
        }
        mul_v2_fl(center, 1.0 / num_nodes);
 
index a56d76a..f7757ce 100644 (file)
@@ -555,8 +555,8 @@ static int do_lasso_select_node(bContext *C, int mcords[][2], short moves, short
        /* do actual selection */
        for (node = snode->edittree->nodes.first; node; node = node->next) {
                int screen_co[2];
-               const float cent[2] = {BLI_RCT_CENTER_X(&node->totr),
-                                      BLI_RCT_CENTER_Y(&node->totr)};
+               const float cent[2] = {BLI_rctf_cent_x(&node->totr),
+                                      BLI_rctf_cent_y(&node->totr)};
 
                /* marker in screen coords */
                UI_view2d_view_to_region(&ar->v2d,
index 8e38247..747ccfe 100644 (file)
@@ -72,8 +72,8 @@ static int space_node_view_flag(bContext *C, SpaceNode *snode, ARegion *ar, cons
        int tot = 0;
        int has_frame = FALSE;
        
-       oldwidth  = BLI_RCT_SIZE_X(&ar->v2d.cur);
-       oldheight = BLI_RCT_SIZE_Y(&ar->v2d.cur);
+       oldwidth  = BLI_rctf_size_x(&ar->v2d.cur);
+       oldheight = BLI_rctf_size_y(&ar->v2d.cur);
 
        BLI_rctf_init_minmax(&cur_new);
 
@@ -91,8 +91,8 @@ static int space_node_view_flag(bContext *C, SpaceNode *snode, ARegion *ar, cons
        }
 
        if (tot) {
-               width  = BLI_RCT_SIZE_X(&cur_new);
-               height = BLI_RCT_SIZE_Y(&cur_new);
+               width  = BLI_rctf_size_x(&cur_new);
+               height = BLI_rctf_size_y(&cur_new);
 
                /* for single non-frame nodes, don't zoom in, just pan view,
                 * but do allow zooming out, this allows for big nodes to be zoomed out */
index 0874ddc..d7e180f 100644 (file)
@@ -579,11 +579,11 @@ static int outliner_show_active_exec(bContext *C, wmOperator *UNUSED(op))
        te = outliner_find_id(so, &so->tree, (ID *)OBACT);
        if (te) {
                /* make te->ys center of view */
-               ytop = (int)(te->ys + BLI_RCT_SIZE_Y(&v2d->mask) / 2);
+               ytop = (int)(te->ys + BLI_rcti_size_y(&v2d->mask) / 2);
                if (ytop > 0) ytop = 0;
                
                v2d->cur.ymax = (float)ytop;
-               v2d->cur.ymin = (float)(ytop - BLI_RCT_SIZE_Y(&v2d->mask));
+               v2d->cur.ymin = (float)(ytop - BLI_rcti_size_y(&v2d->mask));
                
                /* make te->xs ==> te->xend center of view */
                xdelta = (int)(te->xs - v2d->cur.xmin);
@@ -615,7 +615,7 @@ void OUTLINER_OT_show_active(wmOperatorType *ot)
 static int outliner_scroll_page_exec(bContext *C, wmOperator *op)
 {
        ARegion *ar = CTX_wm_region(C);
-       int dy = BLI_RCT_SIZE_Y(&ar->v2d.mask);
+       int dy = BLI_rcti_size_y(&ar->v2d.mask);
        int up = 0;
        
        if (RNA_boolean_get(op->ptr, "up"))
@@ -760,10 +760,10 @@ static void outliner_find_panel(Scene *UNUSED(scene), ARegion *ar, SpaceOops *so
                        tselem->flag |= TSE_SELECTED;
                        
                        /* make te->ys center of view */
-                       ytop = (int)(te->ys + BLI_RCT_SIZE_Y(&ar->v2d.mask) / 2);
+                       ytop = (int)(te->ys + BLI_rctf_size_y(&ar->v2d.mask) / 2);
                        if (ytop > 0) ytop = 0;
                        ar->v2d.cur.ymax = (float)ytop;
-                       ar->v2d.cur.ymin = (float)(ytop - BLI_RCT_SIZE_Y(&ar->v2d.mask));
+                       ar->v2d.cur.ymin = (float)(ytop - BLI_rctf_size_y(&ar->v2d.mask));
                        
                        /* make te->xs ==> te->xend center of view */
                        xdelta = (int)(te->xs - ar->v2d.cur.xmin);
index 7363bf2..f927e83 100644 (file)
@@ -432,7 +432,7 @@ static void draw_seq_extensions(Scene *scene, ARegion *ar, Sequence *seq)
        y1 = seq->machine + SEQ_STRIP_OFSBOTTOM;
        y2 = seq->machine + SEQ_STRIP_OFSTOP;
 
-       pixely = BLI_RCT_SIZE_Y(&v2d->cur) / BLI_RCT_SIZE_Y(&v2d->mask);
+       pixely = BLI_rctf_size_y(&v2d->cur) / BLI_rcti_size_y(&v2d->mask);
        
        if (pixely <= 0) return;  /* can happen when the view is split/resized */
        
@@ -725,7 +725,7 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline
        
        /* draw sound wave */
        if (seq->type == SEQ_TYPE_SOUND_RAM) {
-               drawseqwave(scene, seq, x1, y1, x2, y2, BLI_RCT_SIZE_X(&ar->v2d.cur) / ar->winx);
+               drawseqwave(scene, seq, x1, y1, x2, y2, BLI_rctf_size_x(&ar->v2d.cur) / ar->winx);
        }
 
        /* draw lock */
@@ -1032,10 +1032,10 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
        if (draw_overlay) {
                if (sseq->overlay_type == SEQ_DRAW_OVERLAY_RECT) {
                        rctf tot_clip;
-                       tot_clip.xmin = v2d->tot.xmin + (ABS(BLI_RCT_SIZE_X(&v2d->tot)) * scene->ed->over_border.xmin);
-                       tot_clip.ymin = v2d->tot.ymin + (ABS(BLI_RCT_SIZE_Y(&v2d->tot)) * scene->ed->over_border.ymin);
-                       tot_clip.xmax = v2d->tot.xmin + (ABS(BLI_RCT_SIZE_X(&v2d->tot)) * scene->ed->over_border.xmax);
-                       tot_clip.ymax = v2d->tot.ymin + (ABS(BLI_RCT_SIZE_Y(&v2d->tot)) * scene->ed->over_border.ymax);
+                       tot_clip.xmin = v2d->tot.xmin + (fabsf(BLI_rctf_size_x(&v2d->tot)) * scene->ed->over_border.xmin);
+                       tot_clip.ymin = v2d->tot.ymin + (fabsf(BLI_rctf_size_y(&v2d->tot)) * scene->ed->over_border.ymin);
+                       tot_clip.xmax = v2d->tot.xmin + (fabsf(BLI_rctf_size_x(&v2d->tot)) * scene->ed->over_border.xmax);
+                       tot_clip.ymax = v2d->tot.ymin + (fabsf(BLI_rctf_size_y(&v2d->tot)) * scene->ed->over_border.ymax);
 
                        glTexCoord2f(scene->ed->over_border.xmin, scene->ed->over_border.ymin); glVertex2f(tot_clip.xmin, tot_clip.ymin);
                        glTexCoord2f(scene->ed->over_border.xmin, scene->ed->over_border.ymax); glVertex2f(tot_clip.xmin, tot_clip.ymax);
@@ -1222,7 +1222,7 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *ar)
        View2D *v2d = &ar->v2d;
        Sequence *last_seq = BKE_sequencer_active_get(scene);
        int sel = 0, j;
-       float pixelx = BLI_RCT_SIZE_X(&v2d->cur) / BLI_RCT_SIZE_X(&v2d->mask);
+       float pixelx = BLI_rctf_size_x(&v2d->cur) / BLI_rcti_size_x(&v2d->mask);
        
        /* loop through twice, first unselected, then selected */
        for (j = 0; j < 2; j++) {
index f47eb33..e7d964b 100644 (file)
@@ -372,7 +372,7 @@ Sequence *find_nearest_seq(Scene *scene, View2D *v2d, int *hand, const int mval[
        
        if (ed == NULL) return NULL;
        
-       pixelx = BLI_RCT_SIZE_X(&v2d->cur) / BLI_RCT_SIZE_X(&v2d->mask);
+       pixelx = BLI_rctf_size_x(&v2d->cur) / BLI_rcti_size_x(&v2d->mask);
 
        UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, &y);
        
@@ -2164,8 +2164,8 @@ static int sequencer_view_zoom_ratio_exec(bContext *C, wmOperator *op)
        float winx = (int)(rd->size * rd->xsch) / 100;
        float winy = (int)(rd->size * rd->ysch) / 100;
 
-       float facx = BLI_RCT_SIZE_X(&v2d->mask) / winx;
-       float facy = BLI_RCT_SIZE_Y(&v2d->mask) / winy;
+       float facx = BLI_rcti_size_x(&v2d->mask) / winx;
+       float facy = BLI_rcti_size_y(&v2d->mask) / winy;
 
        BLI_rctf_resize(&v2d->cur, (int)(winx * facx * ratio) + 1, (int)(winy * facy * ratio) + 1);
 
@@ -2268,7 +2268,7 @@ static int sequencer_view_selected_exec(bContext *C, wmOperator *UNUSED(op))
                ymax += ymargin;
                ymin -= ymargin;
 
-               orig_height = BLI_RCT_SIZE_Y(&cur_new);
+               orig_height = BLI_rctf_size_y(&cur_new);
 
                cur_new.xmin = xmin;
                cur_new.xmax = xmax;
@@ -2277,8 +2277,8 @@ static int sequencer_view_selected_exec(bContext *C, wmOperator *UNUSED(op))
                cur_new.ymax = ymax;
 
                /* only zoom out vertically */
-               if (orig_height > BLI_RCT_SIZE_Y(&cur_new)) {
-                       ymid = BLI_RCT_CENTER_Y(&cur_new);
+               if (orig_height > BLI_rctf_size_y(&cur_new)) {
+                       ymid = BLI_rctf_cent_y(&cur_new);
 
                        cur_new.ymin = ymid - (orig_height / 2);
                        cur_new.ymax = ymid + (orig_height / 2);
@@ -2800,11 +2800,11 @@ static int view_ghost_border_exec(bContext *C, wmOperator *op)
        if (ed == NULL)
                return OPERATOR_CANCELLED;
 
-       rect.xmin /=  (float)(ABS(BLI_RCT_SIZE_X(&v2d->tot)));
-       rect.ymin /=  (float)(ABS(BLI_RCT_SIZE_Y(&v2d->tot)));
+       rect.xmin /=  fabsf(BLI_rctf_size_x(&v2d->tot));
+       rect.ymin /=  fabsf(BLI_rctf_size_y(&v2d->tot));
 
-       rect.xmax /=  (float)(ABS(BLI_RCT_SIZE_X(&v2d->tot)));
-       rect.ymax /=  (float)(ABS(BLI_RCT_SIZE_Y(&v2d->tot)));
+       rect.xmax /=  fabsf(BLI_rctf_size_x(&v2d->tot));
+       rect.ymax /=  fabsf(BLI_rctf_size_y(&v2d->tot));
 
        rect.xmin += 0.5f;
        rect.xmax += 0.5f;
index 97eb5b4..5111d20 100644 (file)
@@ -1232,7 +1232,7 @@ static void draw_textscroll(SpaceText *st, rcti *scroll, rcti *back)
        uiWidgetScrollDraw(&wcol, scroll, &st->txtbar, (st->flags & ST_SCROLL_SELECT) ? UI_SCROLL_PRESSED : 0);
 
        uiSetRoundBox(UI_CNR_ALL);
-       rad = 0.4f * mini(BLI_RCT_SIZE_X(&st->txtscroll), BLI_RCT_SIZE_Y(&st->txtscroll));
+       rad = 0.4f * mini(BLI_rcti_size_x(&st->txtscroll), BLI_rcti_size_y(&st->txtscroll));
        UI_GetThemeColor3ubv(TH_HILITE, col);
        col[3] = 48;
        glColor4ubv(col);
index 5af44f9..2dd6599 100644 (file)
@@ -2409,8 +2409,8 @@ static int text_scroll_bar_invoke(bContext *C, wmOperator *op, wmEvent *event)
 
        /* jump scroll, works in v2d but needs to be added here too :S */
        if (event->type == MIDDLEMOUSE) {
-               tsc->old[0] = ar->winrct.xmin + BLI_RCT_CENTER_X(&st->txtbar);
-               tsc->old[1] = ar->winrct.ymin + BLI_RCT_CENTER_Y(&st->txtbar);
+               tsc->old[0] = ar->winrct.xmin + BLI_rcti_cent_x(&st->txtbar);
+               tsc->old[1] = ar->winrct.ymin + BLI_rcti_cent_y(&st->txtbar);
 
                tsc->delta[0] = 0;
                tsc->delta[1] = 0;
index 733fd27..9067fb6 100644 (file)
@@ -151,7 +151,7 @@ static int time_view_all_exec(bContext *C, wmOperator *UNUSED(op))
        v2d->cur.xmax = (float)PEFRA;
        
        /* we need an extra "buffer" factor on either side so that the endpoints are visible */
-       extra = 0.01f * BLI_RCT_SIZE_X(&v2d->cur);
+       extra = 0.01f * BLI_rctf_size_x(&v2d->cur);
        v2d->cur.xmin -= extra;
        v2d->cur.xmax += extra;
        
index 5fbf197..2ee9fdd 100644 (file)
@@ -973,10 +973,10 @@ static void view3d_camera_border(Scene *scene, ARegion *ar, View3D *v3d, RegionV
        rect_camera = params.viewplane;
 
        /* get camera border within viewport */
-       viewborder_r->xmin = ((rect_camera.xmin - rect_view.xmin) / BLI_RCT_SIZE_X(&rect_view)) * ar->winx;
-       viewborder_r->xmax = ((rect_camera.xmax - rect_view.xmin) / BLI_RCT_SIZE_X(&rect_view)) * ar->winx;
-       viewborder_r->ymin = ((rect_camera.ymin - rect_view.ymin) / BLI_RCT_SIZE_Y(&rect_view)) * ar->winy;
-       viewborder_r->ymax = ((rect_camera.ymax - rect_view.ymin) / BLI_RCT_SIZE_Y(&rect_view)) * ar->winy;
+       viewborder_r->xmin = ((rect_camera.xmin - rect_view.xmin) / BLI_rctf_size_x(&rect_view)) * ar->winx;
+       viewborder_r->xmax = ((rect_camera.xmax - rect_view.xmin) / BLI_rctf_size_x(&rect_view)) * ar->winx;
+       viewborder_r->ymin = ((rect_camera.ymin - rect_view.ymin) / BLI_rctf_size_y(&rect_view)) * ar->winy;
+       viewborder_r->ymax = ((rect_camera.ymax - rect_view.ymin) / BLI_rctf_size_y(&rect_view)) * ar->winy;
 }
 
 void ED_view3d_calc_camera_border_size(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d, float size_r[2])
@@ -984,8 +984,8 @@ void ED_view3d_calc_camera_border_size(Scene *scene, ARegion *ar, View3D *v3d, R
        rctf viewborder;
 
        view3d_camera_border(scene, ar, v3d, rv3d, &viewborder, TRUE, TRUE);
-       size_r[0] = BLI_RCT_SIZE_X(&viewborder);
-       size_r[1] = BLI_RCT_SIZE_Y(&viewborder);
+       size_r[0] = BLI_rctf_size_x(&viewborder);
+       size_r[1] = BLI_rctf_size_y(&viewborder);
 }
 
 void ED_view3d_calc_camera_border(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d,
@@ -1341,7 +1341,7 @@ static void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d)
                glDisable(GL_MULTISAMPLE_ARB);
 
        region_scissor_winrct(ar, &winrct);
-       glScissor(winrct.xmin, winrct.ymin, BLI_RCT_SIZE_X(&winrct), BLI_RCT_SIZE_Y(&winrct));
+       glScissor(winrct.xmin, winrct.ymin, BLI_rcti_size_x(&winrct), BLI_rcti_size_y(&winrct));
 
        glClearColor(0.0, 0.0, 0.0, 0.0); 
        if (v3d->zbuf) {
@@ -2045,8 +2045,8 @@ void view3d_update_depths_rect(ARegion *ar, ViewDepths *d, rcti *rect)
        x = rect->xmin;
        y = rect->ymin;
 
-       w = BLI_RCT_SIZE_X(rect);
-       h = BLI_RCT_SIZE_Y(rect);
+       w = BLI_rcti_size_x(rect);
+       h = BLI_rcti_size_y(rect);
 
        if (w <= 0 || h <= 0) {
                if (d->depths)
@@ -2879,10 +2879,10 @@ static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar, int draw
 
                ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &viewborder, FALSE);
 
-               cliprct.xmin = viewborder.xmin + scene->r.border.xmin * BLI_RCT_SIZE_X(&viewborder);
-               cliprct.ymin = viewborder.ymin + scene->r.border.ymin * BLI_RCT_SIZE_Y(&viewborder);
-               cliprct.xmax = viewborder.xmin + scene->r.border.xmax * BLI_RCT_SIZE_X(&viewborder);
-               cliprct.ymax = viewborder.ymin + scene->r.border.ymax * BLI_RCT_SIZE_Y(&viewborder);
+               cliprct.xmin = viewborder.xmin + scene->r.border.xmin * BLI_rctf_size_x(&viewborder);
+               cliprct.ymin = viewborder.ymin + scene->r.border.ymin * BLI_rctf_size_y(&viewborder);
+               cliprct.xmax = viewborder.xmin + scene->r.border.xmax * BLI_rctf_size_x(&viewborder);
+               cliprct.ymax = viewborder.ymin + scene->r.border.ymax * BLI_rctf_size_y(&viewborder);
 
                cliprct.xmin += ar->winrct.xmin;
                cliprct.xmax += ar->winrct.xmin;
@@ -2896,7 +2896,7 @@ static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar, int draw
 
                if (cliprct.xmax > cliprct.xmin && cliprct.ymax > cliprct.ymin) {
                        glGetIntegerv(GL_SCISSOR_BOX, scissor);
-                       glScissor(cliprct.xmin, cliprct.ymin, BLI_RCT_SIZE_X(&cliprct), BLI_RCT_SIZE_Y(&cliprct));
+                       glScissor(cliprct.xmin, cliprct.ymin, BLI_rcti_size_x(&cliprct), BLI_rcti_size_y(&cliprct));
                }
                else
                        return 0;
index 7accdb0..726d95c 100644 (file)
@@ -375,17 +375,17 @@ typedef struct ViewOpsData {
 
 #define TRACKBALLSIZE  (1.1)
 
-static void calctrackballvec(rcti *rect, int mx, int my, float vec[3])
+static void calctrackballvec(const rcti *rect, int mx, int my, float vec[3])
 {
        float x, y, radius, d, z, t;
 
        radius = TRACKBALLSIZE;
 
        /* normalize x and y */
-       x = BLI_RCT_CENTER_X(rect) - mx;
-       x /= (float)(BLI_RCT_SIZE_X(rect) / 4);
-       y = BLI_RCT_CENTER_Y(rect) - my;
-       y /= (float)(BLI_RCT_SIZE_Y(rect) / 2);
+       x = BLI_rcti_cent_x(rect) - mx;
+       x /= (float)(BLI_rcti_size_x(rect) / 4);
+       y = BLI_rcti_cent_y(rect) - my;
+       y /= (float)(BLI_rcti_size_y(rect) / 2);
 
        d = sqrt(x * x + y * y);
        if (d < radius * (float)M_SQRT1_2) { /* Inside sphere */
@@ -1666,8 +1666,8 @@ static void viewzoom_apply(ViewOpsData *vod, int x, int y, const short viewzoom,
                int ctr[2], len1, len2;
                /* method which zooms based on how far you move the mouse */
 
-               ctr[0] = BLI_RCT_CENTER_X(&vod->ar->winrct);
-               ctr[1] = BLI_RCT_CENTER_Y(&vod->ar->winrct);
+               ctr[0] = BLI_rcti_cent_x(&vod->ar->winrct);
+               ctr[1] = BLI_rcti_cent_y(&vod->ar->winrct);
 
                len1 = (int)sqrt((ctr[0] - x) * (ctr[0] - x) + (ctr[1] - y) * (ctr[1] - y)) + 5;
                len2 = (int)sqrt((ctr[0] - vod->origx) * (ctr[0] - vod->origx) + (ctr[1] - vod->origy) * (ctr[1] - vod->origy)) + 5;
@@ -2619,10 +2619,10 @@ static int render_border_exec(bContext *C, wmOperator *op)
        /* calculate range */
        ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &vb, FALSE);
 
-       scene->r.border.xmin = ((float)rect.xmin - vb.xmin) / BLI_RCT_SIZE_X(&vb);
-       scene->r.border.ymin = ((float)rect.ymin - vb.ymin) / BLI_RCT_SIZE_Y(&vb);
-       scene->r.border.xmax = ((float)rect.xmax - vb.xmin) / BLI_RCT_SIZE_X(&vb);
-       scene->r.border.ymax = ((float)rect.ymax - vb.ymin) / BLI_RCT_SIZE_Y(&vb);
+       scene->r.border.xmin = ((float)rect.xmin - vb.xmin) / BLI_rctf_size_x(&vb);
+       scene->r.border.ymin = ((float)rect.ymin - vb.ymin) / BLI_rctf_size_y(&vb);
+       scene->r.border.xmax = ((float)rect.xmax - vb.xmin) / BLI_rctf_size_x(&vb);
+       scene->r.border.ymax = ((float)rect.ymax - vb.ymin) / BLI_rctf_size_y(&vb);
 
        /* actually set border */
        CLAMP(scene->r.border.xmin, 0.0f, 1.0f);
@@ -2786,8 +2786,8 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
                }
 
                /* work out the ratios, so that everything selected fits when we zoom */
-               xscale = (BLI_RCT_SIZE_X(&rect) / vb[0]);
-               yscale = (BLI_RCT_SIZE_Y(&rect) / vb[1]);
+               xscale = (BLI_rcti_size_x(&rect) / vb[0]);
+               yscale = (BLI_rcti_size_y(&rect) / vb[1]);
                new_dist *= maxf(xscale, yscale);
 
                /* zoom in as required, or as far as we can go */
index 166a625..a10cc38 100644 (file)
@@ -654,8 +654,8 @@ static int do_paintvert_box_select(ViewContext *vc, rcti *rect, int select, int
        unsigned int *rt;
        int a, index;
        char *selar;
-       int sx = BLI_RCT_SIZE_X(rect) + 1;
-       int sy = BLI_RCT_SIZE_Y(rect) + 1;
+       int sx = BLI_rcti_size_x(rect) + 1;
+       int sy = BLI_rcti_size_y(rect) + 1;
 
        me = vc->obact->data;
 
index a3fb4e8..d067e8a 100644 (file)
@@ -126,11 +126,11 @@ static void convertViewVec2D(View2D *v2d, float r_vec[3], int dx, int dy)
 {
        float divx, divy;
        
-       divx = BLI_RCT_SIZE_X(&v2d->mask);
-       divy = BLI_RCT_SIZE_Y(&v2d->mask);
+       divx = BLI_rcti_size_x(&v2d->mask);
+       divy = BLI_rcti_size_y(&v2d->mask);
 
-       r_vec[0] = BLI_RCT_SIZE_X(&v2d->cur) * dx / divx;
-       r_vec[1] = BLI_RCT_SIZE_Y(&v2d->cur) * dy / divy;
+       r_vec[0] = BLI_rctf_size_x(&v2d->cur) * dx / divx;
+       r_vec[1] = BLI_rctf_size_y(&v2d->cur) * dy / divy;
        r_vec[2] = 0.0f;
 }
 
@@ -139,11 +139,11 @@ static void convertViewVec2D_mask(View2D *v2d, float r_vec[3], int dx, int dy)
        float divx, divy;
        float mulx, muly;
 
-       divx = BLI_RCT_SIZE_X(&v2d->mask);
-       divy = BLI_RCT_SIZE_Y(&v2d->mask);
+       divx = BLI_rcti_size_x(&v2d->mask);
+       divy = BLI_rcti_size_y(&v2d->mask);
 
-       mulx = BLI_RCT_SIZE_X(&v2d->cur);
-       muly = BLI_RCT_SIZE_Y(&v2d->cur);
+       mulx = BLI_rctf_size_x(&v2d->cur);
+       muly = BLI_rctf_size_y(&v2d->cur);
 
        /* difference with convertViewVec2D */
        /* clamp w/h, mask only */
index 181f9fe..2e001cd 100644 (file)
@@ -5554,8 +5554,8 @@ static void createTransObject(bContext *C, TransInfo *t)
 static void NodeToTransData(TransData *td, TransData2D *td2d, bNode *node)
 {
        /* hold original location */
-       float locxy[2] = {BLI_RCT_CENTER_X(&node->totr),
-                         BLI_RCT_CENTER_Y(&node->totr)};
+       float locxy[2] = {BLI_rctf_cent_x(&node->totr),
+                         BLI_rctf_cent_y(&node->totr)};
 
        copy_v2_v2(td2d->loc, locxy);
        td2d->loc[2] = 0.0f;
index b88ae68..6e371e5 100644 (file)
@@ -960,8 +960,8 @@ static void TargetSnapOffset(TransInfo *t, TransData *td)
        if (t->spacetype == SPACE_NODE && td != NULL) {
                bNode *node = td->extra;
                char border = t->tsnap.snapNodeBorder;
-               float width  = BLI_RCT_SIZE_X(&node->totr);
-               float height = BLI_RCT_SIZE_Y(&node->totr);
+               float width  = BLI_rctf_size_x(&node->totr);
+               float height = BLI_rctf_size_y(&node->totr);
                
                if (border & NODE_LEFT)
                        t->tsnap.snapTarget[0] -= 0.5f * width;
index fe4eebc..8f01408 100644 (file)
@@ -146,7 +146,7 @@ CompBuf *get_cropped_compbuf(rcti *drect, float *rectf, int rectx, int recty, in
        if (disprect.xmin>= disprect.xmax) return NULL;
        if (disprect.ymin>= disprect.ymax) return NULL;
        
-       cbuf= alloc_compbuf(BLI_RCT_SIZE_X(&disprect), BLI_RCT_SIZE_Y(&disprect), type, 1);
+       cbuf= alloc_compbuf(BLI_rcti_size_x(&disprect), BLI_rcti_size_y(&disprect), type, 1);
        outfp= cbuf->rect;
        rectf += type*(disprect.ymin*rectx + disprect.xmin);
        dx= type*cbuf->x;
index 51e5b30..81697cc 100644 (file)
@@ -5242,11 +5242,11 @@ static void speedvector_project(Render *re, float zco[2], const float co[3], con
                        /* size of 1 pixel mapped to viewplane coords */
                        float psize;
 
-                       psize = BLI_RCT_SIZE_X(&re->viewplane) / (float)re->winx;
+                       psize = BLI_rctf_size_x(&re->viewplane) / (float)re->winx;
                        /* x angle of a pixel */
                        pixelphix = atan(psize / re->clipsta);
                        
-                       psize = BLI_RCT_SIZE_Y(&re->viewplane) / (float)re->winy;
+                       psize = BLI_rctf_size_y(&re->viewplane) / (float)re->winy;
                        /* y angle of a pixel */
                        pixelphiy = atan(psize / re->clipsta);
                }
index 7f0484c..7a9df51 100644 (file)
@@ -396,8 +396,8 @@ static float square_rctf(rctf *rf)
 {
        float x, y;
 
-       x = BLI_RCT_SIZE_X(rf);
-       y = BLI_RCT_SIZE_Y(rf);
+       x = BLI_rctf_size_x(rf);
+       y = BLI_rctf_size_y(rf);
        return x * y;
 }
 
@@ -405,7 +405,7 @@ static float clipx_rctf(rctf *rf, float x1, float x2)
 {
        float size;
 
-       size = BLI_RCT_SIZE_X(rf);
+       size = BLI_rctf_size_x(rf);
 
        if (rf->xmin<x1) {
                rf->xmin = x1;
@@ -417,8 +417,8 @@ static float clipx_rctf(rctf *rf, float x1, float x2)
                rf->xmin = rf->xmax;
                return 0.0;
        }
-       else if (size!=0.0f) {
-               return BLI_RCT_SIZE_X(rf) / size;
+       else if (size != 0.0f) {
+               return BLI_rctf_size_x(rf) / size;
        }
        return 1.0;
 }
@@ -427,7 +427,7 @@ static float clipy_rctf(rctf *rf, float y1, float y2)
 {
        float size;
 
-       size = BLI_RCT_SIZE_Y(rf);
+       size = BLI_rctf_size_y(rf);
 
        if (rf->ymin<y1) {
                rf->ymin = y1;
@@ -441,7 +441,7 @@ static float clipy_rctf(rctf *rf, float y1, float y2)
                return 0.0;
        }
        else if (size != 0.0f) {
-               return BLI_RCT_SIZE_Y(rf) / size;
+               return BLI_rctf_size_y(rf) / size;
        }
        return 1.0;
 
index 66f230a..88c64b4 100644 (file)
@@ -610,8 +610,8 @@ void initparts(Render *re, int do_crop)
                }
                else disprect.ymax = ymaxb;
                
-               rectx = BLI_RCT_SIZE_X(&disprect);
-               recty = BLI_RCT_SIZE_Y(&disprect);
+               rectx = BLI_rcti_size_x(&disprect);
+               recty = BLI_rcti_size_y(&disprect);
                
                /* so, now can we add this part? */
                if (rectx > 0 && recty > 0) {
index 599d913..1ce66dd 100644 (file)
@@ -437,8 +437,8 @@ void RE_InitState(Render *re, Render *source, RenderData *rd, SceneRenderLayer *
        re->winy = winy;
        if (disprect) {
                re->disprect = *disprect;
-               re->rectx = BLI_RCT_SIZE_X(disprect);
-               re->recty = BLI_RCT_SIZE_Y(disprect);
+               re->rectx = BLI_rcti_size_x(disprect);
+               re->recty = BLI_rcti_size_y(disprect);
        }
        else {
                re->disprect.xmin = re->disprect.ymin = 0;
@@ -670,15 +670,15 @@ static void *do_part_thread(void *pa_v)
 float panorama_pixel_rot(Render *re)
 {
        float psize, phi, xfac;
-       float borderfac = (float)BLI_RCT_SIZE_X(&re->disprect) / (float)re->winx;
+       float borderfac = (float)BLI_rcti_size_x(&re->disprect) / (float)re->winx;
        
        /* size of 1 pixel mapped to viewplane coords */
-       psize = BLI_RCT_SIZE_X(&re->viewplane) / (float)re->winx;
+       psize = BLI_rctf_size_x(&re->viewplane) / (float)re->winx;
        /* angle of a pixel */
        phi = atan(psize / re->clipsta);
        
        /* correction factor for viewplane shifting, first calculate how much the viewplane angle is */
-       xfac = borderfac * BLI_RCT_SIZE_X(&re->viewplane) / (float)re->xparts;
+       xfac = borderfac * BLI_rctf_size_x(&re->viewplane) / (float)re->xparts;
        xfac = atan(0.5f * xfac / re->clipsta);
        /* and how much the same viewplane angle is wrapped */
        psize = 0.5f * phi * ((float)re->partx);
@@ -711,7 +711,7 @@ static RenderPart *find_next_pano_slice(Render *re, int *minx, rctf *viewplane)
                float phi = panorama_pixel_rot(re);
 
                R.panodxp = (re->winx - (best->disprect.xmin + best->disprect.xmax) ) / 2;
-               R.panodxv = (BLI_RCT_SIZE_X(viewplane) * R.panodxp) / (float)(re->winx);
+               R.panodxv = (BLI_rctf_size_x(viewplane) * R.panodxp) / (float)(re->winx);
 
                /* shift viewplane */
                R.viewplane.xmin = viewplane->xmin + R.panodxv;
@@ -738,8 +738,8 @@ static RenderPart *find_next_part(Render *re, int minx)
        /* find center of rendered parts, image center counts for 1 too */
        for (pa = re->parts.first; pa; pa = pa->next) {
                if (pa->ready) {
-                       centx += BLI_RCT_CENTER_X(&pa->disprect);
-                       centy += BLI_RCT_CENTER_Y(&pa->disprect);
+                       centx += BLI_rcti_cent_x(&pa->disprect);
+                       centy += BLI_rcti_cent_y(&pa->disprect);
                        tot++;
                }
        }
@@ -749,8 +749,8 @@ static RenderPart *find_next_part(Render *re, int minx)
        /* closest of the non-rendering parts */
        for (pa = re->parts.first; pa; pa = pa->next) {
                if (pa->ready == 0 && pa->nr == 0) {
-                       long long int distx = centx - BLI_RCT_CENTER_X(&pa->disprect);
-                       long long int disty = centy - BLI_RCT_CENTER_Y(&pa->disprect);
+                       long long int distx = centx - BLI_rcti_cent_x(&pa->disprect);
+                       long long int disty = centy - BLI_rcti_cent_y(&pa->disprect);
                        distx = (long long int)sqrt(distx * distx + disty * disty);
                        if (distx < mindist) {
                                if (re->r.mode & R_PANORAMA) {
index f11f84c..2d680bf 100644 (file)
@@ -422,8 +422,8 @@ RenderResult *render_result_new(Render *re, rcti *partrct, int crop, int savebuf
        SceneRenderLayer *srl;
        int rectx, recty, nr;
        
-       rectx = BLI_RCT_SIZE_X(partrct);
-       recty = BLI_RCT_SIZE_Y(partrct);
+       rectx = BLI_rcti_size_x(partrct);
+       recty = BLI_rcti_size_y(partrct);
        
        if (rectx <= 0 || recty <= 0)
                return NULL;
@@ -569,8 +569,8 @@ RenderResult *render_result_new(Render *re, rcti *partrct, int crop, int savebuf
        }
        
        /* border render; calculate offset for use in compositor. compo is centralized coords */
-       rr->xof = re->disprect.xmin + BLI_RCT_CENTER_X(&re->disprect) - (re->winx / 2);
-       rr->yof = re->disprect.ymin + BLI_RCT_CENTER_Y(&re->disprect) - (re->winy / 2);
+       rr->xof = re->disprect.xmin + BLI_rcti_cent_x(&re->disprect) - (re->winx / 2);
+       rr->yof = re->disprect.ymin + BLI_rcti_cent_y(&re->disprect) - (re->winy / 2);
        
        return rr;
 }
index 97a05e6..2161449 100644 (file)
@@ -109,10 +109,10 @@ void calc_view_vector(float *view, float x, float y)
                
                /* move x and y to real viewplane coords */
                x = (x / (float)R.winx);
-               view[0] = R.viewplane.xmin + x * BLI_RCT_SIZE_X(&R.viewplane);
+               view[0] = R.viewplane.xmin + x * BLI_rctf_size_x(&R.viewplane);
                
                y = (y / (float)R.winy);
-               view[1] = R.viewplane.ymin + y * BLI_RCT_SIZE_Y(&R.viewplane);
+               view[1] = R.viewplane.ymin + y * BLI_rctf_size_y(&R.viewplane);
                
 //             if (R.flag & R_SEC_FIELD) {
 //                     if (R.r.mode & R_ODDFIELD) view[1]= (y+R.ystart)*R.ycor;
index 2d7a64b..bed3fb5 100644 (file)
@@ -72,6 +72,9 @@
 #  define ACOMP        3
 #endif
 
+#define RCT_SIZE_X(rct)       ((rct)->xmax - (rct)->xmin)
+#define RCT_SIZE_Y(rct)       ((rct)->ymax - (rct)->ymin)
+
 /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
 /* defined in pipeline.c, is hardcopy of active dynamic allocated Render */
 /* only to be used here in this file, it's for speed */
@@ -1506,7 +1509,7 @@ static void isb_bsp_split_init(ISBBranch *root, MemArena *mem, int level)
                root->divider[1]= 0.5f*(root->box.ymin+root->box.ymax);
                
                /* find best splitpoint */
-               if (BLI_RCT_SIZE_X(&root->box) > BLI_RCT_SIZE_Y(&root->box))
+               if (RCT_SIZE_X(&root->box) > RCT_SIZE_Y(&root->box))
                        i = root->index = 0;
                else
                        i = root->index = 1;
@@ -1551,7 +1554,7 @@ static void isb_bsp_split(ISBBranch *root, MemArena *mem)
        root->divider[1]/= BSPMAX_SAMPLE;
        
        /* find best splitpoint */
-       if (BLI_RCT_SIZE_X(&root->box) > BLI_RCT_SIZE_Y(&root->box))
+       if (RCT_SIZE_X(&root->box) > RCT_SIZE_Y(&root->box))
                i = root->index = 0;
        else
                i = root->index = 1;
index 2928ba0..b3ffb80 100644 (file)
@@ -130,8 +130,8 @@ int wm_gesture_evaluate(wmGesture *gesture)
 {
        if (gesture->type == WM_GESTURE_TWEAK) {
                rcti *rect = gesture->customdata;
-               int dx = BLI_RCT_SIZE_X(rect);
-               int dy = BLI_RCT_SIZE_Y(rect);
+               int dx = BLI_rcti_size_x(rect);
+               int dy = BLI_rcti_size_y(rect);
                if (ABS(dx) + ABS(dy) > U.tweak_threshold) {
                        int theta = (int)floor(4.0f * atan2f((float)dy, (float)dx) / (float)M_PI + 0.5f);
                        int val = EVT_GESTURE_W;
index adf54af..4078a88 100644 (file)
@@ -116,8 +116,8 @@ void wm_subwindow_getsize(wmWindow *win, int swinid, int *x, int *y)
        wmSubWindow *swin = swin_from_swinid(win, swinid);
 
        if (swin) {
-               *x = BLI_RCT_SIZE_X(&swin->winrct) + 1;
-               *y = BLI_RCT_SIZE_Y(&swin->winrct) + 1;
+               *x = BLI_rcti_size_x(&swin->winrct) + 1;
+               *y = BLI_rcti_size_y(&swin->winrct) + 1;
        }
 }
 
@@ -256,13 +256,13 @@ void wmSubWindowScissorSet(wmWindow *win, int swinid, rcti *srct)
        win->curswin = _curswin;
        _curwindow = win;
        
-       width  = BLI_RCT_SIZE_X(&_curswin->winrct) + 1;
-       height = BLI_RCT_SIZE_Y(&_curswin->winrct) + 1;
+       width  = BLI_rcti_size_x(&_curswin->winrct) + 1;
+       height = BLI_rcti_size_y(&_curswin->winrct) + 1;
        glViewport(_curswin->winrct.xmin, _curswin->winrct.ymin, width, height);
 
        if (srct) {
-               width  = BLI_RCT_SIZE_X(srct) + 1;
-               height = BLI_RCT_SIZE_Y(srct) + 1;
+               width  = BLI_rcti_size_x(srct) + 1;
+               height = BLI_rcti_size_y(srct) + 1;
                glScissor(srct->xmin, srct->ymin, width, height);
        }
        else
index 59c8235..18072d8 100644 (file)
@@ -458,8 +458,8 @@ wmWindow *WM_window_open(bContext *C, rcti *rect)
        
        win->posx = rect->xmin;
        win->posy = rect->ymin;
-       win->sizex = BLI_RCT_SIZE_X(rect);
-       win->sizey = BLI_RCT_SIZE_Y(rect);
+       win->sizex = BLI_rcti_size_x(rect);
+       win->sizey = BLI_rcti_size_y(rect);
 
        win->drawmethod = -1;
        win->drawdata = NULL;
@@ -494,8 +494,8 @@ void WM_window_open_temp(bContext *C, rcti *position, int type)
                win->posy = position->ymin;
        }
        
-       win->sizex = BLI_RCT_SIZE_X(position);
-       win->sizey = BLI_RCT_SIZE_Y(position);
+       win->sizex = BLI_rcti_size_x(position);
+       win->sizey = BLI_rcti_size_y(position);
        
        if (win->ghostwin) {
                wm_window_set_size(win, win->sizex, win->sizey);
index 3a06fe9..c819407 100644 (file)
@@ -143,7 +143,7 @@ int BL_KetsjiNextFrame(KX_KetsjiEngine *ketsjiengine, bContext *C, wmWindow *win
                        // itself is unaware of the extra space, so we clear the whole region for it.
                        glClearColor(scene->gm.framing.col[0], scene->gm.framing.col[1], scene->gm.framing.col[2], 1.0f);
                        glViewport(ar->winrct.xmin, ar->winrct.ymin,
-                                  BLI_RCT_SIZE_X(&ar->winrct), BLI_RCT_SIZE_Y(&ar->winrct));
+                                  BLI_rcti_size_x(&ar->winrct), BLI_rcti_size_y(&ar->winrct));
                        glClear(GL_COLOR_BUFFER_BIT);
                }