[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37245] trunk/blender/source/blender/ editors/sculpt_paint/paint_image.c: fix for 2D paint being off by 1 pixel on x/y axis, most obvious when zoomed in.
Campbell Barton
ideasman42 at gmail.com
Mon Jun 6 12:08:27 CEST 2011
Revision: 37245
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37245
Author: campbellbarton
Date: 2011-06-06 10:08:27 +0000 (Mon, 06 Jun 2011)
Log Message:
-----------
fix for 2D paint being off by 1 pixel on x/y axis, most obvious when zoomed in.
Modified Paths:
--------------
trunk/blender/source/blender/editors/sculpt_paint/paint_image.c
Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_image.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_image.c 2011-06-06 09:12:03 UTC (rev 37244)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_image.c 2011-06-06 10:08:27 UTC (rev 37245)
@@ -4255,8 +4255,8 @@
static void imapaint_convert_brushco(ImBuf *ibufb, float *pos, int *ipos)
{
- ipos[0]= (int)(pos[0] - ibufb->x/2);
- ipos[1]= (int)(pos[1] - ibufb->y/2);
+ ipos[0]= (int)floorf((pos[0] - ibufb->x/2) + 1.0f);
+ ipos[1]= (int)floorf((pos[1] - ibufb->y/2) + 1.0f);
}
/* dosnt run for projection painting
@@ -4863,13 +4863,8 @@
PointerRNA itemptr;
float pressure, mousef[2];
double time;
- int tablet, mouse[2];
+ int tablet;
- // XXX +1 matches brush location better but
- // still not exact, find out why and fix ..
- mouse[0]= event->mval[0] + 1;
- mouse[1]= event->mval[1] + 1;
-
time= PIL_check_seconds_timer();
tablet= 0;
@@ -4888,8 +4883,8 @@
pressure= pop->prev_pressure ? pop->prev_pressure : 1.0f;
if(pop->first) {
- pop->prevmouse[0]= mouse[0];
- pop->prevmouse[1]= mouse[1];
+ pop->prevmouse[0]= event->mval[0];
+ pop->prevmouse[1]= event->mval[1];
pop->starttime= time;
/* special exception here for too high pressure values on first touch in
@@ -4908,8 +4903,8 @@
/* fill in stroke */
RNA_collection_add(op->ptr, "stroke", &itemptr);
- mousef[0] = (float)(mouse[0]);
- mousef[1] = (float)(mouse[1]);
+ mousef[0] = (float)(event->mval[0]);
+ mousef[1] = (float)(event->mval[1]);
RNA_float_set_array(&itemptr, "mouse", mousef);
RNA_float_set(&itemptr, "time", (float)(time - pop->starttime));
RNA_float_set(&itemptr, "pressure", pressure);
More information about the Bf-blender-cvs
mailing list