Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-08-21 03:06:17 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-08-21 03:06:17 +0400
commit77f47799ddff99da672aa58e5d989237403e7707 (patch)
tree951fa8eb0d6853355b697cc262ed92ddd9dd7a83 /source/blender/editors/space_clip
parent94ce9505a9bf07e3d2532c82a0b8396f7c9727b3 (diff)
code cleanup: use BLI_RCT_SIZE macro
Diffstat (limited to 'source/blender/editors/space_clip')
-rw-r--r--source/blender/editors/space_clip/clip_buttons.c3
-rw-r--r--source/blender/editors/space_clip/clip_dopesheet_draw.c3
-rw-r--r--source/blender/editors/space_clip/clip_draw.c8
-rw-r--r--source/blender/editors/space_clip/clip_editor.c9
-rw-r--r--source/blender/editors/space_clip/clip_graph_ops.c6
-rw-r--r--source/blender/editors/space_clip/clip_ops.c9
-rw-r--r--source/blender/editors/space_clip/space_clip.c4
7 files changed, 23 insertions, 19 deletions
diff --git a/source/blender/editors/space_clip/clip_buttons.c b/source/blender/editors/space_clip/clip_buttons.c
index e561b2a9e79..e66faa88b93 100644
--- a/source/blender/editors/space_clip/clip_buttons.c
+++ b/source/blender/editors/space_clip/clip_buttons.c
@@ -41,6 +41,7 @@
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BLI_listbase.h"
+#include "BLI_rect.h"
#include "BKE_context.h"
#include "BKE_depsgraph.h"
@@ -168,7 +169,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, rect.xmax - rect.xmin,
+ uiDefBut(block, TRACKPREVIEW, 0, "", rect.xmin, rect.ymin, BLI_RCT_SIZE_X(&rect),
scopes->track_preview_height, scopes, 0, 0, 0, 0, "");
}
diff --git a/source/blender/editors/space_clip/clip_dopesheet_draw.c b/source/blender/editors/space_clip/clip_dopesheet_draw.c
index 83d895067cc..5d890155e25 100644
--- a/source/blender/editors/space_clip/clip_dopesheet_draw.c
+++ b/source/blender/editors/space_clip/clip_dopesheet_draw.c
@@ -44,6 +44,7 @@
#include "BLI_string.h"
#include "BLI_listbase.h"
#include "BLI_math.h"
+#include "BLI_rect.h"
#include "ED_screen.h"
#include "ED_clip.h"
@@ -273,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 > (v2d->mask.ymax - v2d->mask.ymin)) {
+ if (height > BLI_RCT_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)
*/
diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c
index c24cdab29e5..2353f8f8c12 100644
--- a/source/blender/editors/space_clip/clip_draw.c
+++ b/source/blender/editors/space_clip/clip_draw.c
@@ -958,12 +958,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 / (v2d->cur.xmax - v2d->cur.xmin);
- y = -v2d->cur.ymin / (v2d->cur.ymax - v2d->cur.ymin);
+ x = -v2d->cur.xmin / BLI_RCT_SIZE_X(&v2d->cur);
+ y = -v2d->cur.ymin / BLI_RCT_SIZE_Y(&v2d->cur);
/* convert proportional distances to screen coordinates */
- *regionx = v2d->mask.xmin + x * (v2d->mask.xmax - v2d->mask.xmin);
- *regiony = v2d->mask.ymin + y * (v2d->mask.ymax - v2d->mask.ymin);
+ *regionx = v2d->mask.xmin + x * BLI_RCT_SIZE_X(&v2d->mask);
+ *regiony = v2d->mask.ymin + y * BLI_RCT_SIZE_Y(&v2d->mask);
}
static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip,
diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c
index 5b4849a425f..7a54a39ee48 100644
--- a/source/blender/editors/space_clip/clip_editor.c
+++ b/source/blender/editors/space_clip/clip_editor.c
@@ -44,6 +44,7 @@
#include "BLI_utildefines.h"
#include "BLI_math.h"
+#include "BLI_rect.h"
#include "GPU_extensions.h"
@@ -148,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)(ar->winrct.xmax - ar->winrct.xmin + 1) / (float)((ar->v2d.cur.xmax - ar->v2d.cur.xmin) * width);
- *zoomy = (float)(ar->winrct.ymax - ar->winrct.ymin + 1) / (float)((ar->v2d.cur.ymax - ar->v2d.cur.ymin) * 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);
}
void ED_space_clip_get_aspect(SpaceClip *sc, float *aspx, float *aspy)
@@ -393,8 +394,8 @@ int ED_clip_view_selection(const bContext *C, ARegion *ar, int fit)
ED_space_clip_get_aspect(sc, &aspx, &aspy);
- width = ar->winrct.xmax - ar->winrct.xmin + 1;
- height = ar->winrct.ymax - ar->winrct.ymin + 1;
+ width = BLI_RCT_SIZE_X(&ar->winrct) + 1;
+ height = BLI_RCT_SIZE_Y(&ar->winrct) + 1;
zoomx = (float)width / w / aspx;
zoomy = (float)height / h / aspy;
diff --git a/source/blender/editors/space_clip/clip_graph_ops.c b/source/blender/editors/space_clip/clip_graph_ops.c
index a2cb812d51c..e94b28d22fa 100644
--- a/source/blender/editors/space_clip/clip_graph_ops.c
+++ b/source/blender/editors/space_clip/clip_graph_ops.c
@@ -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 * (v2d->cur.xmax - v2d->cur.xmin);
+ extra = 0.01f * BLI_RCT_SIZE_X(&v2d->cur);
v2d->cur.xmin -= extra;
v2d->cur.xmax += extra;
- extra = 0.01f * (v2d->cur.ymax - v2d->cur.ymin);
+ extra = 0.01f * BLI_RCT_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 = (v2d->cur.xmax - v2d->cur.xmin) / 2.0f;
+ float extra = BLI_RCT_SIZE_X(&v2d->cur) / 2.0f;
/* set extents of view to start/end frames */
v2d->cur.xmin = (float)CFRA - extra;
diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c
index 36199b1908d..20b0ad509d3 100644
--- a/source/blender/editors/space_clip/clip_ops.c
+++ b/source/blender/editors/space_clip/clip_ops.c
@@ -39,6 +39,7 @@
#include "BLI_path_util.h"
#include "BLI_utildefines.h"
#include "BLI_math.h"
+#include "BLI_rect.h"
#include "BKE_context.h"
#include "BKE_global.h"
@@ -89,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 ((ar->winrct.xmax - ar->winrct.xmin) <= sc->zoom)
+ else if (BLI_RCT_SIZE_X(&ar->winrct) <= sc->zoom)
sc->zoom = oldzoom;
- else if ((ar->winrct.ymax - ar->winrct.ymin) <= sc->zoom)
+ else if (BLI_RCT_SIZE_Y(&ar->winrct) <= sc->zoom)
sc->zoom = oldzoom;
}
@@ -725,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 = ar->winrct.xmax - ar->winrct.xmin + 1;
- height = ar->winrct.ymax - ar->winrct.ymin + 1;
+ width = BLI_RCT_SIZE_X(&ar->winrct) + 1;
+ height = BLI_RCT_SIZE_Y(&ar->winrct) + 1;
if (fit_view) {
const int margin = 5; /* margin from border */
diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c
index bf65429b9f4..bb06104d442 100644
--- a/source/blender/editors/space_clip/space_clip.c
+++ b/source/blender/editors/space_clip/space_clip.c
@@ -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 = ar->winrct.xmax - ar->winrct.xmin + 1;
- winy = ar->winrct.ymax - ar->winrct.ymin + 1;
+ winx = BLI_RCT_SIZE_X(&ar->winrct) + 1;
+ winy = BLI_RCT_SIZE_Y(&ar->winrct) + 1;
ar->v2d.tot.xmin = 0;
ar->v2d.tot.ymin = 0;