Get rid of last PRIM_QUAD usage, in blf_font.c/blf_glyph.c.
This commit is contained in:
@@ -188,7 +188,7 @@ static unsigned verts_needed(const FontBLF *font, const char *str, size_t len)
|
|||||||
quad_ct += 25; /* 5x5 kernel */
|
quad_ct += 25; /* 5x5 kernel */
|
||||||
}
|
}
|
||||||
|
|
||||||
return length * quad_ct * 4;
|
return length * quad_ct * 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void blf_font_draw_ex(
|
static void blf_font_draw_ex(
|
||||||
@@ -206,8 +206,7 @@ static void blf_font_draw_ex(
|
|||||||
|
|
||||||
blf_font_ensure_ascii_table(font);
|
blf_font_ensure_ascii_table(font);
|
||||||
|
|
||||||
#ifdef WITH_GL_PROFILE_COMPAT
|
immBeginAtMost(PRIM_TRIANGLES, verts_needed(font, str, len));
|
||||||
immBeginAtMost(PRIM_QUADS_XXX, verts_needed(font, str, len));
|
|
||||||
/* at most because some glyphs might be clipped & not drawn */
|
/* at most because some glyphs might be clipped & not drawn */
|
||||||
|
|
||||||
while ((i < len) && str[i]) {
|
while ((i < len) && str[i]) {
|
||||||
@@ -228,7 +227,6 @@ static void blf_font_draw_ex(
|
|||||||
}
|
}
|
||||||
|
|
||||||
immEnd();
|
immEnd();
|
||||||
#endif
|
|
||||||
|
|
||||||
if (r_info) {
|
if (r_info) {
|
||||||
r_info->lines = 1;
|
r_info->lines = 1;
|
||||||
@@ -255,8 +253,7 @@ static void blf_font_draw_ascii_ex(
|
|||||||
|
|
||||||
blf_font_ensure_ascii_table(font);
|
blf_font_ensure_ascii_table(font);
|
||||||
|
|
||||||
#ifdef WITH_GL_PROFILE_COMPAT
|
immBeginAtMost(PRIM_TRIANGLES, verts_needed(font, str, len));
|
||||||
immBeginAtMost(PRIM_QUADS_XXX, verts_needed(font, str, len));
|
|
||||||
|
|
||||||
while ((c = *(str++)) && len--) {
|
while ((c = *(str++)) && len--) {
|
||||||
BLI_assert(c < 128);
|
BLI_assert(c < 128);
|
||||||
@@ -273,7 +270,6 @@ static void blf_font_draw_ascii_ex(
|
|||||||
}
|
}
|
||||||
|
|
||||||
immEnd();
|
immEnd();
|
||||||
#endif
|
|
||||||
|
|
||||||
if (r_info) {
|
if (r_info) {
|
||||||
r_info->lines = 1;
|
r_info->lines = 1;
|
||||||
@@ -297,8 +293,7 @@ int blf_font_draw_mono(FontBLF *font, const char *str, size_t len, int cwidth)
|
|||||||
|
|
||||||
blf_font_ensure_ascii_table(font);
|
blf_font_ensure_ascii_table(font);
|
||||||
|
|
||||||
#ifdef WITH_GL_PROFILE_COMPAT
|
immBeginAtMost(PRIM_TRIANGLES, verts_needed(font, str, len));
|
||||||
immBeginAtMost(PRIM_QUADS_XXX, verts_needed(font, str, len));
|
|
||||||
|
|
||||||
while ((i < len) && str[i]) {
|
while ((i < len) && str[i]) {
|
||||||
BLF_UTF8_NEXT_FAST(font, g, str, i, c, glyph_ascii_table);
|
BLF_UTF8_NEXT_FAST(font, g, str, i, c, glyph_ascii_table);
|
||||||
@@ -320,7 +315,6 @@ int blf_font_draw_mono(FontBLF *font, const char *str, size_t len, int cwidth)
|
|||||||
}
|
}
|
||||||
|
|
||||||
immEnd();
|
immEnd();
|
||||||
#endif
|
|
||||||
|
|
||||||
return columns;
|
return columns;
|
||||||
}
|
}
|
||||||
|
@@ -317,6 +317,7 @@ void blf_glyph_free(GlyphBLF *g)
|
|||||||
|
|
||||||
static void blf_texture_draw(const unsigned char color[4], float uv[2][2], float dx, float y1, float dx1, float y2)
|
static void blf_texture_draw(const unsigned char color[4], float uv[2][2], float dx, float y1, float dx1, float y2)
|
||||||
{
|
{
|
||||||
|
/* First triangle. */
|
||||||
immAttrib2f(BLF_COORD_ID, uv[0][0], uv[0][1]);
|
immAttrib2f(BLF_COORD_ID, uv[0][0], uv[0][1]);
|
||||||
immSkipAttrib(BLF_COLOR_ID); /* skip color of most vertices */
|
immSkipAttrib(BLF_COLOR_ID); /* skip color of most vertices */
|
||||||
immVertex2f(BLF_POS_ID, dx, y1);
|
immVertex2f(BLF_POS_ID, dx, y1);
|
||||||
@@ -325,6 +326,15 @@ static void blf_texture_draw(const unsigned char color[4], float uv[2][2], float
|
|||||||
immSkipAttrib(BLF_COLOR_ID);
|
immSkipAttrib(BLF_COLOR_ID);
|
||||||
immVertex2f(BLF_POS_ID, dx, y2);
|
immVertex2f(BLF_POS_ID, dx, y2);
|
||||||
|
|
||||||
|
immAttrib2f(BLF_COORD_ID, uv[1][0], uv[1][1]);
|
||||||
|
immAttrib4ubv(BLF_COLOR_ID, color); /* set color of provoking vertex */
|
||||||
|
immVertex2f(BLF_POS_ID, dx1, y2);
|
||||||
|
|
||||||
|
/* Second triangle. */
|
||||||
|
immAttrib2f(BLF_COORD_ID, uv[0][0], uv[0][1]);
|
||||||
|
immSkipAttrib(BLF_COLOR_ID); /* skip color of most vertices */
|
||||||
|
immVertex2f(BLF_POS_ID, dx, y1);
|
||||||
|
|
||||||
immAttrib2f(BLF_COORD_ID, uv[1][0], uv[1][1]);
|
immAttrib2f(BLF_COORD_ID, uv[1][0], uv[1][1]);
|
||||||
immSkipAttrib(BLF_COLOR_ID);
|
immSkipAttrib(BLF_COLOR_ID);
|
||||||
immVertex2f(BLF_POS_ID, dx1, y2);
|
immVertex2f(BLF_POS_ID, dx1, y2);
|
||||||
|
Reference in New Issue
Block a user