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-22 00:34:05 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-08-22 00:34:05 +0400
commitc92ab5c3ef2d8339650eb95cd2ebba8c6956b62d (patch)
tree960acc2f94886377a44a7adc03d6afc9239ec640 /source/blender/editors/screen
parentabd031bb4eb2d2e8a1820da5a3338aa79266f6ef (diff)
code cleanup: use rect size macros
Diffstat (limited to 'source/blender/editors/screen')
-rw-r--r--source/blender/editors/screen/area.c6
-rw-r--r--source/blender/editors/screen/glutil.c21
-rw-r--r--source/blender/editors/screen/screen_ops.c2
-rw-r--r--source/blender/editors/screen/screendump.c14
4 files changed, 23 insertions, 20 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 10bc17ff59e..59310f9e675 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -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 = ar->prev->winrct.xmax - ar->prev->winrct.xmin + 1;
- ar->prev->winy = ar->prev->winrct.ymax - ar->prev->winrct.ymin + 1;
+ ar->prev->winx = BLI_RCT_SIZE_X(&ar->prev->winrct) + 1;
+ ar->prev->winy = BLI_RCT_SIZE_Y(&ar->prev->winrct) + 1;
}
}
@@ -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, ar->v2d.tot.ymax - ar->v2d.tot.ymin);
+ UI_view2d_totRect_set(&ar->v2d, maxco + UI_UNIT_X + 80, BLI_RCT_SIZE_Y(&ar->v2d.tot));
/* restore view matrix? */
UI_view2d_view_restore(C);
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c
index a534124d2c0..967c6e85590 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -35,6 +35,7 @@
#include "DNA_vec_types.h"
+#include "BLI_rect.h"
#include "BLI_utildefines.h"
#include "BKE_colortools.h"
@@ -668,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)
{
- int sc_w = screen_rect->xmax - screen_rect->xmin + 1;
- int sc_h = screen_rect->ymax - screen_rect->ymin + 1;
+ const int sc_w = BLI_RCT_SIZE_X(screen_rect) + 1;
+ const int sc_h = BLI_RCT_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);
@@ -713,10 +714,10 @@ void gla2DSetMap(gla2DDrawInfo *di, rctf *rect)
di->world_rect = *rect;
- sc_w = (di->screen_rect.xmax - di->screen_rect.xmin);
- sc_h = (di->screen_rect.ymax - di->screen_rect.ymin);
- wo_w = (di->world_rect.xmax - di->world_rect.xmin);
- wo_h = (di->world_rect.ymax - di->world_rect.ymin);
+ 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);
di->wo_to_sc[0] = sc_w / wo_w;
di->wo_to_sc[1] = sc_h / wo_h;
@@ -744,10 +745,10 @@ gla2DDrawInfo *glaBegin2DDraw(rcti *screen_rect, rctf *world_rect)
di->world_rect.ymax = di->screen_rect.ymax;
}
- sc_w = (di->screen_rect.xmax - di->screen_rect.xmin);
- sc_h = (di->screen_rect.ymax - di->screen_rect.ymin);
- wo_w = (di->world_rect.xmax - di->world_rect.xmin);
- wo_h = (di->world_rect.ymax - di->world_rect.ymin);
+ 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);
di->wo_to_sc[0] = sc_w / wo_w;
di->wo_to_sc[1] = sc_h / wo_h;
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 97a63bb0df0..6b42b2f9de8 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -1615,7 +1615,7 @@ static int area_max_regionsize(ScrArea *sa, ARegion *scalear, AZEdge edge)
dist = BLI_RCT_SIZE_X(&sa->totrct);
}
else { /* AE_BOTTOM_TO_TOPLEFT, AE_TOP_TO_BOTTOMRIGHT */
- dist = sa->totrct.ymax - sa->totrct.ymin;
+ dist = BLI_RCT_SIZE_Y(&sa->totrct);
}
/* subtractwidth of regions on opposite side
diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c
index 41e2f0b16a4..4e71c49465f 100644
--- a/source/blender/editors/screen/screendump.c
+++ b/source/blender/editors/screen/screendump.c
@@ -149,14 +149,16 @@ 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 y, cropw = crop.xmax - crop.xmin, croph = crop.ymax - crop.ymin;
+ int crop_x = BLI_RCT_SIZE_X(&crop);
+ int crop_y = BLI_RCT_SIZE_Y(&crop);
+ int y;
- if (cropw > 0 && croph > 0) {
- for (y = 0; y < croph; y++, to += cropw, from += ibuf->x)
- memmove(to, from, sizeof(unsigned int) * cropw);
+ if (crop_x > 0 && crop_y > 0) {
+ for (y = 0; y < crop_y; y++, to += crop_x, from += ibuf->x)
+ memmove(to, from, sizeof(unsigned int) * crop_x);
- ibuf->x = cropw;
- ibuf->y = croph;
+ ibuf->x = crop_x;
+ ibuf->y = crop_y;
}
}