diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-08-21 03:06:17 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-08-21 03:06:17 +0400 |
commit | 77f47799ddff99da672aa58e5d989237403e7707 (patch) | |
tree | 951fa8eb0d6853355b697cc262ed92ddd9dd7a83 /source/blender/editors/screen | |
parent | 94ce9505a9bf07e3d2532c82a0b8396f7c9727b3 (diff) |
code cleanup: use BLI_RCT_SIZE macro
Diffstat (limited to 'source/blender/editors/screen')
-rw-r--r-- | source/blender/editors/screen/area.c | 30 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 2 |
2 files changed, 16 insertions, 16 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 2c32295fe36..10bc17ff59e 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -104,8 +104,8 @@ static void region_draw_emboss(ARegion *ar, rcti *scirct) void ED_region_pixelspace(ARegion *ar) { - int width = ar->winrct.xmax - ar->winrct.xmin + 1; - int height = ar->winrct.ymax - ar->winrct.ymin + 1; + int width = BLI_RCT_SIZE_X(&ar->winrct) + 1; + int height = BLI_RCT_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 rect->xmax - rect->xmin - size; + return BLI_RCT_SIZE_X(rect) - size; } - else { // 'v' - return rect->ymax - rect->ymin - size; + else { /* 'v' */ + return BLI_RCT_SIZE_Y(rect) - size; } } @@ -1073,8 +1073,8 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int } /* for speedup */ - ar->winx = ar->winrct.xmax - ar->winrct.xmin + 1; - ar->winy = ar->winrct.ymax - ar->winrct.ymin + 1; + ar->winx = BLI_RCT_SIZE_X(&ar->winrct) + 1; + ar->winy = BLI_RCT_SIZE_Y(&ar->winrct) + 1; /* set winrect for azones */ if (ar->flag & (RGN_FLAG_HIDDEN | RGN_FLAG_TOO_SMALL)) { @@ -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 = sa->totrct.xmax - sa->totrct.xmin + 1; - sa->winy = sa->totrct.ymax - sa->totrct.ymin + 1; + sa->winx = BLI_RCT_SIZE_X(&sa->totrct) + 1; + sa->winy = BLI_RCT_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 = ar->winrct.xmax - ar->winrct.xmin + 1; - ar->winy = ar->winrct.ymax - ar->winrct.ymin + 1; + ar->winx = BLI_RCT_SIZE_X(&ar->winrct) + 1; + ar->winy = BLI_RCT_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 = v2d->cur.xmax - v2d->cur.xmin; + w = BLI_RCT_SIZE_X(&v2d->cur); em = (ar->type->prefsizex) ? UI_UNIT_Y / 2 : UI_UNIT_Y; } else { @@ -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 = ar->winrct.ymax - ar->winrct.ymin - header_height; + rect.ymin = BLI_RCT_SIZE_Y(&ar->winrct) - header_height; if (block) { - rect.xmax = ar->winrct.xmax - ar->winrct.xmin; + rect.xmax = BLI_RCT_SIZE_X(&ar->winrct); } else { rect.xmax = rect.xmin + BLF_width(fontid, text) + 24; } - rect.ymax = ar->winrct.ymax - ar->winrct.ymin; + rect.ymax = BLI_RCT_SIZE_Y(&ar->winrct); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index e92f7b7a3c2..97a63bb0df0 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -1612,7 +1612,7 @@ 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 = sa->totrct.xmax - sa->totrct.xmin; + dist = BLI_RCT_SIZE_X(&sa->totrct); } else { /* AE_BOTTOM_TO_TOPLEFT, AE_TOP_TO_BOTTOMRIGHT */ dist = sa->totrct.ymax - sa->totrct.ymin; |