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:
authorSergey Sharybin <sergey.vfx@gmail.com>2012-05-03 14:40:04 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-05-03 14:40:04 +0400
commit56d22457e320df0bdcdcfd8d7af5e1958ddb201f (patch)
tree02c4ecf168fab6cb9dcbc56992c811b73aca2cf3 /source
parent3ee4be913bbf475ae7ae3af0df7e47568efbadbe (diff)
Fix #31266: Track preview is shifted by half a pixel
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/interface/interface_draw.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 91d3c890df3..d90d8286db9 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -1469,8 +1469,11 @@ static ImBuf *scale_trackpreview_ibuf(ImBuf *ibuf, float track_pos[2], int width
ImBuf *scaleibuf;
const float scalex = ((float)ibuf->x - 2 * margin) / width;
const float scaley = ((float)ibuf->y - 2 * margin) / height;
- float off_x = (int)track_pos[0] - track_pos[0] + 0.5f;
- float off_y = (int)track_pos[1] - track_pos[1] + 0.5f;
+ /* NOTE: 1.0f = 0.5f for integer coordinate coorrection (center of pixel vs. left bottom corner of bixel)
+ * and 0.5f for centering image in preview (cross is draving at exact center of widget so image
+ * should be shifted by half of pixel for correct centering) - sergey */
+ float off_x = (int)track_pos[0] - track_pos[0] + 1.0f;
+ float off_y = (int)track_pos[1] - track_pos[1] + 1.0f;
int x, y;
scaleibuf = IMB_allocImBuf(width, height, 32, IB_rect);