[Bf-blender-cvs] [52f7492] master: Fix (coverity-reported) broken 'transform helpers' drawing.
Bastien Montagne
noreply at git.blender.org
Sun Oct 4 09:34:08 CEST 2015
Commit: 52f74923e6957b4dc6e7b37514d864588b922ae6
Author: Bastien Montagne
Date: Sun Oct 4 09:31:17 2015 +0200
Branches: master
https://developer.blender.org/rB52f74923e6957b4dc6e7b37514d864588b922ae6
Fix (coverity-reported) broken 'transform helpers' drawing.
E.g. trackball-arrows (R-R) were no more visible.
Caused by wrong cast of an array from int to float, we need an int version of those helpers (`glTranslatenxv`) too.
===================================================================
M source/blender/editors/include/BIF_gl.h
M source/blender/editors/transform/transform.c
===================================================================
diff --git a/source/blender/editors/include/BIF_gl.h b/source/blender/editors/include/BIF_gl.h
index e2a24b9..58da0b5 100644
--- a/source/blender/editors/include/BIF_gl.h
+++ b/source/blender/editors/include/BIF_gl.h
@@ -87,11 +87,15 @@ void cpack(unsigned int x);
#define GLA_PIXEL_OFS 0.375f
+BLI_INLINE void glTranslate3iv(const int vec[3]) { glTranslatef(UNPACK3_EX((const float), vec, )); }
+BLI_INLINE void glTranslate2iv(const int vec[2]) { glTranslatef(UNPACK2_EX((const float), vec, ), 0.0f); }
BLI_INLINE void glTranslate3fv(const float vec[3]) { glTranslatef(UNPACK3(vec)); }
BLI_INLINE void glTranslate2fv(const float vec[2]) { glTranslatef(UNPACK2(vec), 0.0f); }
BLI_INLINE void glTranslate3dv(const double vec[3]) { glTranslated(UNPACK3(vec)); }
BLI_INLINE void glTranslate2dv(const double vec[2]) { glTranslated(UNPACK2(vec), 0.0f); }
+BLI_INLINE void glScale3iv(const int vec[3]) { glTranslatef(UNPACK3_EX((const float), vec, )); }
+BLI_INLINE void glScale2iv(const int vec[2]) { glTranslatef(UNPACK2_EX((const float), vec, ), 0.0f); }
BLI_INLINE void glScale3fv(const float vec[3]) { glScalef(UNPACK3(vec)); }
BLI_INLINE void glScale2fv(const float vec[2]) { glScalef(UNPACK2(vec), 0.0); }
BLI_INLINE void glScale3dv(const double vec[3]) { glScaled(UNPACK3(vec)); }
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 6931efd..9aa22ed 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -1720,7 +1720,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
glVertex2fv(cent);
glEnd();
- glTranslate2fv((const float *)mval);
+ glTranslate2iv(mval);
glRotatef(-RAD2DEGF(atan2f(cent[0] - t->mval[0], cent[1] - t->mval[1])), 0, 0, 1);
setlinestyle(0);
@@ -1732,7 +1732,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
case HLP_HARROW:
UI_ThemeColor(TH_VIEW_OVERLAY);
- glTranslate2fv((const float *)mval);
+ glTranslate2iv(mval);
glLineWidth(3.0);
drawArrow(RIGHT, 5, 10, 5);
@@ -1742,7 +1742,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
case HLP_VARROW:
UI_ThemeColor(TH_VIEW_OVERLAY);
- glTranslate2fv((const float *)mval);
+ glTranslate2iv(mval);
glLineWidth(3.0);
drawArrow(UP, 5, 10, 5);
@@ -1793,7 +1793,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
unsigned char col[3], col2[3];
UI_GetThemeColor3ubv(TH_GRID, col);
- glTranslate2fv((const float *)mval);
+ glTranslate2iv(mval);
glLineWidth(3.0);
More information about the Bf-blender-cvs
mailing list