mirror of https://github.com/OpenRCT2/OpenRCT2.git
shadows for fonts
This commit is contained in:
parent
73b0e403c4
commit
2d82bf344e
|
@ -1042,21 +1042,44 @@ static void ttf_draw_string_raw_ttf(rct_drawpixelinfo *dpi, const utf8 *text, te
|
||||||
|
|
||||||
int srcScanSkip = surface->pitch - width;
|
int srcScanSkip = surface->pitch - width;
|
||||||
int dstScanSkip = dpi->width + dpi->pitch - width;
|
int dstScanSkip = dpi->width + dpi->pitch - width;
|
||||||
for (int yy = 0; yy < height; yy++) {
|
uint8 *dst_orig = dst;
|
||||||
for (int xx = 0; xx < width; xx++) {
|
uint8 *src_orig = src;
|
||||||
if (*src != 0) {
|
|
||||||
*dst = colour;
|
// Draw shadow/outline
|
||||||
if (info->flags & TEXT_DRAW_FLAG_INSET) {
|
if (info->flags & TEXT_DRAW_FLAG_OUTLINE) {
|
||||||
*(dst + width + dstScanSkip + 1) = info->palette[3];
|
for (int yy = 0; yy < height - 0; yy++) {
|
||||||
} else if (info->flags & TEXT_DRAW_FLAG_OUTLINE) {
|
for (int xx = 0; xx < width - 0; xx++) {
|
||||||
*(dst + width + dstScanSkip + 1) = info->palette[3];
|
if (*src != 0) {
|
||||||
|
*(dst + 1) = info->palette[3]; // right
|
||||||
|
*(dst - 1) = info->palette[3]; // left
|
||||||
|
*(dst - width - dstScanSkip) = info->palette[3]; // top
|
||||||
|
*(dst + width + dstScanSkip) = info->palette[3]; // bottom
|
||||||
}
|
}
|
||||||
|
src++;
|
||||||
|
dst++;
|
||||||
}
|
}
|
||||||
src++;
|
// Skip any remaining bits
|
||||||
dst++;
|
src += srcScanSkip;
|
||||||
|
dst += dstScanSkip;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
dst = dst_orig;
|
||||||
|
src = src_orig;
|
||||||
|
for (int yy = 0; yy < height; yy++) {
|
||||||
|
for (int xx = 0; xx < width; xx++) {
|
||||||
|
if (*src != 0) {
|
||||||
|
if (info->flags & TEXT_DRAW_FLAG_INSET) {
|
||||||
|
*(dst + width + dstScanSkip + 1) = info->palette[3];
|
||||||
|
}
|
||||||
|
*dst = colour;
|
||||||
|
}
|
||||||
|
src++;
|
||||||
|
dst++;
|
||||||
|
}
|
||||||
|
src += srcScanSkip;
|
||||||
|
dst += dstScanSkip;
|
||||||
}
|
}
|
||||||
src += srcScanSkip;
|
|
||||||
dst += dstScanSkip;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SDL_MUSTLOCK(surface)) {
|
if (SDL_MUSTLOCK(surface)) {
|
||||||
|
|
Loading…
Reference in New Issue