Skip to content

Commit

Permalink
Blended mode: use max alpha value for underline/strikethrough
Browse files Browse the repository at this point in the history
Instead of drawing a full opaque line
  • Loading branch information
1bsyl committed Dec 18, 2018
1 parent 4c284c5 commit 4ee0fbe
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions SDL_ttf.c
Expand Up @@ -1685,13 +1685,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 | 0xFF000000);
TTF_drawLine_Blended(font, textbuf, first_row, textbuf->w, pixel | (alpha_table[255] << 24));
}

/* 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 | 0xFF000000);
TTF_drawLine_Blended(font, textbuf, first_row, textbuf->w, pixel | (alpha_table[255] << 24));
}
return textbuf;
}
Expand Down Expand Up @@ -1949,13 +1949,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 | 0xFF000000);
TTF_drawLine_Blended(font, textbuf, first_row, SDL_min(line_width, textbuf->w), pixel | (alpha_table[255] << 24));
}

/* 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 | 0xFF000000);
TTF_drawLine_Blended(font, textbuf, first_row, SDL_min(line_width, textbuf->w), pixel | (alpha_table[255] << 24));
}
}

Expand Down

0 comments on commit 4ee0fbe

Please sign in to comment.