Skip to content

Commit

Permalink
Fixed bug 4353 - TTF_drawLine_Blended() overload a colour parameter
Browse files Browse the repository at this point in the history
Sylvain

Render_Blended function are calling TTF_drawLine_Blended() with a colour parameter:

  TTF_drawLine_Blended(..., pixel | (Uint32)fg.a << 24);

Which is overloaded in TTF_drawLine_Blended():

  Uint32 pixel = color | 0xFF000000; /* Amask */

  ( https://hg.libsdl.org/SDL_ttf/file/66fe96efd5f6/SDL_ttf.c#l153 )

Not sure which one should to be kept, or maybe this is an issue.
  • Loading branch information
slouken committed Nov 6, 2018
1 parent 5de806d commit 5a74a0c
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions SDL_ttf.c
Expand Up @@ -155,12 +155,11 @@ static void TTF_drawLine_Blended(const TTF_Font *font, const SDL_Surface *textbu
int line;
Uint32 *dst = (Uint32 *)textbuf->pixels + row * textbuf->pitch/4;
int col;
Uint32 pixel = color | 0xFF000000; /* Amask */

/* Draw line */
for (line = font->underline_height; line > 0; --line) {
for (col = 0; col < line_width; ++col) {
dst[col] = pixel;
dst[col] = color;
}
dst += textbuf->pitch/4;
}
Expand Down Expand Up @@ -1664,13 +1663,13 @@ SDL_Surface *TTF_RenderUTF8_Blended(TTF_Font *font,
/* Handle the underline style */
if (TTF_HANDLE_STYLE_UNDERLINE(font)) {
int first_row = font->underline_top_row + ystart;
TTF_drawLine_Blended(font, textbuf, first_row, textbuf->w, pixel | (Uint32)fg.a << 24);
TTF_drawLine_Blended(font, textbuf, first_row, textbuf->w, pixel | 0xFF000000);
}

/* Handle the strikethrough style */
if (TTF_HANDLE_STYLE_STRIKETHROUGH(font)) {
int first_row = font->strikethrough_top_row + ystart;
TTF_drawLine_Blended(font, textbuf, first_row, textbuf->w, pixel | (Uint32)fg.a << 24);
TTF_drawLine_Blended(font, textbuf, first_row, textbuf->w, pixel | 0xFF000000);
}
return textbuf;
}
Expand Down Expand Up @@ -1935,13 +1934,13 @@ SDL_Surface *TTF_RenderUTF8_Blended_Wrapped(TTF_Font *font,
/* Handle the underline style */
if (TTF_HANDLE_STYLE_UNDERLINE(font)) {
int first_row = rowHeight * line + font->underline_top_row + ystart;
TTF_drawLine_Blended(font, textbuf, first_row, SDL_min(line_width, textbuf->w), pixel | (Uint32)fg.a << 24);
TTF_drawLine_Blended(font, textbuf, first_row, SDL_min(line_width, textbuf->w), pixel | 0xFF000000);
}

/* Handle the strikethrough style */
if (TTF_HANDLE_STYLE_STRIKETHROUGH(font)) {
int first_row = rowHeight * line + font->strikethrough_top_row + ystart;
TTF_drawLine_Blended(font, textbuf, first_row, SDL_min(line_width, textbuf->w), pixel | (Uint32)fg.a << 24);
TTF_drawLine_Blended(font, textbuf, first_row, SDL_min(line_width, textbuf->w), pixel | 0xFF000000);
}
}

Expand Down

0 comments on commit 5a74a0c

Please sign in to comment.