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.
This commit is contained in:
Bastien Montagne 2015-10-04 09:31:17 +02:00
parent 61218546cb
commit 52f74923e6
2 changed files with 8 additions and 4 deletions

View File

@ -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)); }

View File

@ -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);