diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-08-20 19:29:02 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-08-20 19:29:02 +0400 |
commit | 26f073b327ac31d683e1719ce8371b6e28bf01d6 (patch) | |
tree | fecb4fdc3f279436ab3814e60266633ba02de50a /source/blender/editors/gpencil | |
parent | 831eaf2d7feb63ee6df55a2b00e1d76f793c0a5c (diff) |
macros for rectangle center and size
Diffstat (limited to 'source/blender/editors/gpencil')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_edit.c | 4 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_paint.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 949f92c68e9..5d67b63af18 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -422,8 +422,8 @@ static void gp_strokepoint_convertcoords(bContext *C, bGPDstroke *gps, bGPDspoin } else { if (subrect) { - mvalf[0] = (((float)pt->x / 100.0f) * (subrect->xmax - subrect->xmin)) + subrect->xmin; - mvalf[1] = (((float)pt->y / 100.0f) * (subrect->ymax - subrect->ymin)) + subrect->ymin; + 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; } else { mvalf[0] = (float)pt->x / 100.0f * ar->winx; diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index d98f4891dc5..1f317fa4f04 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -300,8 +300,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) / ((p->subrect->xmax - p->subrect->xmin))) * 100; - out[1] = ((mval[1] - p->subrect->ymin) / ((p->subrect->ymax - p->subrect->ymin))) * 100; + 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; } } } |