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
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2014-04-21 08:30:13 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-04-21 08:30:13 +0400
commitb1e1f86eb7cfe040bd301beb91fb35a1c748667e (patch)
tree14f7cd2701cd6e196a3dc8ebab816882d3643991 /source
parent3a950dc643c39073e573b2e3547701a705ee0808 (diff)
Fix for UI_view2d_to_region_float (was ignoring x,y args)
use this for grease pencil stroke conversion to avoid float->int->float conversion.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/gpencil/gpencil_edit.c4
-rw-r--r--source/blender/editors/interface/view2d.c4
2 files changed, 3 insertions, 5 deletions
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 4c4926f5ae7..4a688f11767 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -456,10 +456,8 @@ static void gp_strokepoint_convertcoords(bContext *C, bGPDstroke *gps, bGPDspoin
/* get screen coordinate */
if (gps->flag & GP_STROKE_2DSPACE) {
- int mvali[2];
View2D *v2d = &ar->v2d;
- UI_view2d_view_to_region(v2d, pt->x, pt->y, mvali, mvali + 1);
- VECCOPY2D(mvalf, mvali);
+ UI_view2d_to_region_float(v2d, pt->x, pt->y, &mvalf[0], &mvalf[1]);
}
else {
if (subrect) {
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index 8f501e226e7..9ce21e70eb4 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -2045,8 +2045,8 @@ void UI_view2d_to_region_no_clip(View2D *v2d, float x, float y, int *regionx, in
void UI_view2d_to_region_float(View2D *v2d, float x, float y, float *regionx, float *regiony)
{
/* express given coordinates as proportional values */
- x = -v2d->cur.xmin / BLI_rctf_size_x(&v2d->cur);
- y = -v2d->cur.ymin / BLI_rctf_size_y(&v2d->cur);
+ x = (x - v2d->cur.xmin) / BLI_rctf_size_x(&v2d->cur);
+ y = (y - v2d->cur.ymin) / BLI_rctf_size_y(&v2d->cur);
/* convert proportional distances to screen coordinates */
*regionx = v2d->mask.xmin + x * BLI_rcti_size_x(&v2d->mask);