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:
authorAnthony Edlin <akrashe@gmail.com>2013-11-25 16:40:58 +0400
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2013-11-25 17:26:45 +0400
commite626998a262ebe4f621b88eb09ece1a48c1a3ef8 (patch)
tree70a27361ecee4c639acf17d2c9c8cdde58c72689 /source/blender/editors/screen/area.c
parentab9822eff8865846d3c7ef81ff30cc35cb48ae0c (diff)
UI: fix errors in screen edge drawing, moving and region hiding.
Summary: - Fixes an off-by-one error in screen_test_scale() which causes the areas and regions to draw one pixel bigger on the right and top side of the window, therefor hiding one line of pixels. - Fixes an off-by-one error in rct_fits() which causes regions to incorrectly hide even though it would fit inside the area. - Correctly set the limits for the screen edge move operator so it will always go up to AREAMINX and headery. - Change screen_find_active_scredge() so it doesn't show the arrows cursor on the screen edges along the window border. The import thing to understand is how integer rects are used in this part of the code. They are constructed as a lower left and top right point and are INCLUSIVE. Meaning that if you have a rect's xmin = 10 and xmax = 30 then the total number of pixels is 21. So to get the size of a rect you have to do xmax - xmin + 1, which is easy to forget and result in off-by-one errors. Reviewed By: brecht Differential Revision: http://developer.blender.org/D41
Diffstat (limited to 'source/blender/editors/screen/area.c')
-rw-r--r--source/blender/editors/screen/area.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index fccce0357a4..595f08111ec 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -859,10 +859,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_rcti_size_x(rect) - size;
+ return BLI_rcti_size_x(rect) + 1 - size;
}
else { /* 'v' */
- return BLI_rcti_size_y(rect) - size;
+ return BLI_rcti_size_y(rect) + 1 - size;
}
}
@@ -1157,16 +1157,16 @@ static void region_rect_recursive(wmWindow *win, ScrArea *sa, ARegion *ar, rcti
static void area_calc_totrct(ScrArea *sa, int sizex, int sizey)
{
- short rt = U.pixelsize > 1.0f ? 1 : 0;
+ short rt = (short) U.pixelsize;
- if (sa->v1->vec.x > 0) sa->totrct.xmin = sa->v1->vec.x + 1 + rt;
+ if (sa->v1->vec.x > 0) sa->totrct.xmin = sa->v1->vec.x + rt;
else sa->totrct.xmin = sa->v1->vec.x;
- if (sa->v4->vec.x < sizex - 1) sa->totrct.xmax = sa->v4->vec.x - 1 - rt;
+ if (sa->v4->vec.x < sizex - 1) sa->totrct.xmax = sa->v4->vec.x - rt;
else sa->totrct.xmax = sa->v4->vec.x;
- if (sa->v1->vec.y > 0) sa->totrct.ymin = sa->v1->vec.y + 1 + rt;
+ if (sa->v1->vec.y > 0) sa->totrct.ymin = sa->v1->vec.y + rt;
else sa->totrct.ymin = sa->v1->vec.y;
- if (sa->v2->vec.y < sizey - 1) sa->totrct.ymax = sa->v2->vec.y - 1 - rt;
+ if (sa->v2->vec.y < sizey - 1) sa->totrct.ymax = sa->v2->vec.y - rt;
else sa->totrct.ymax = sa->v2->vec.y;
/* for speedup */