diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-09-25 10:59:28 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-09-25 10:59:28 +0300 |
commit | c80331992585bfee3d65a7ba24f3a4b640c48735 (patch) | |
tree | 5eaa85a0a3a1c46bdca7cccfae0e7349e22f6d13 /src/ui/text_simple.c | |
parent | 562a0d2d38c0621a296e8343270f3f1efc268156 (diff) | |
parent | 242e8231ea61278fe482020658be86c2dec0ae53 (diff) |
Merge branch 'work/v1.7' into dev
Diffstat (limited to 'src/ui/text_simple.c')
-rw-r--r-- | src/ui/text_simple.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/ui/text_simple.c b/src/ui/text_simple.c index e88b09a8..8b1de64a 100644 --- a/src/ui/text_simple.c +++ b/src/ui/text_simple.c | |||
@@ -92,7 +92,7 @@ static iRect runSimple_Font_(iFont *d, const iRunArgs *args) { | |||
92 | } | 92 | } |
93 | if (args->mode & fillBackground_RunMode) { | 93 | if (args->mode & fillBackground_RunMode) { |
94 | const iColor initial = get_Color(args->color); | 94 | const iColor initial = get_Color(args->color); |
95 | SDL_SetRenderDrawColor(text_.render, initial.r, initial.g, initial.b, 0); | 95 | SDL_SetRenderDrawColor(activeText_->render, initial.r, initial.g, initial.b, 0); |
96 | } | 96 | } |
97 | /* Text rendering is not very straightforward! Let's dive in... */ | 97 | /* Text rendering is not very straightforward! Let's dive in... */ |
98 | iChar prevCh = 0; | 98 | iChar prevCh = 0; |
@@ -114,14 +114,14 @@ static iRect runSimple_Font_(iFont *d, const iRunArgs *args) { | |||
114 | chPos++; | 114 | chPos++; |
115 | iRegExpMatch m; | 115 | iRegExpMatch m; |
116 | init_RegExpMatch(&m); | 116 | init_RegExpMatch(&m); |
117 | if (match_RegExp(text_.ansiEscape, chPos, args->text.end - chPos, &m)) { | 117 | if (match_RegExp(activeText_->ansiEscape, chPos, args->text.end - chPos, &m)) { |
118 | if (mode & draw_RunMode && ~mode & permanentColorFlag_RunMode) { | 118 | if (mode & draw_RunMode && ~mode & permanentColorFlag_RunMode) { |
119 | /* Change the color. */ | 119 | /* Change the color. */ |
120 | const iColor clr = | 120 | const iColor clr = |
121 | ansiForeground_Color(capturedRange_RegExpMatch(&m, 1), tmParagraph_ColorId); | 121 | ansiForeground_Color(capturedRange_RegExpMatch(&m, 1), tmParagraph_ColorId); |
122 | SDL_SetTextureColorMod(text_.cache, clr.r, clr.g, clr.b); | 122 | SDL_SetTextureColorMod(activeText_->cache, clr.r, clr.g, clr.b); |
123 | if (args->mode & fillBackground_RunMode) { | 123 | if (args->mode & fillBackground_RunMode) { |
124 | SDL_SetRenderDrawColor(text_.render, clr.r, clr.g, clr.b, 0); | 124 | SDL_SetRenderDrawColor(activeText_->render, clr.r, clr.g, clr.b, 0); |
125 | } | 125 | } |
126 | } | 126 | } |
127 | chPos = end_RegExpMatch(&m); | 127 | chPos = end_RegExpMatch(&m); |
@@ -205,9 +205,9 @@ static iRect runSimple_Font_(iFont *d, const iRunArgs *args) { | |||
205 | } | 205 | } |
206 | if (mode & draw_RunMode && ~mode & permanentColorFlag_RunMode) { | 206 | if (mode & draw_RunMode && ~mode & permanentColorFlag_RunMode) { |
207 | const iColor clr = get_Color(colorNum); | 207 | const iColor clr = get_Color(colorNum); |
208 | SDL_SetTextureColorMod(text_.cache, clr.r, clr.g, clr.b); | 208 | SDL_SetTextureColorMod(activeText_->cache, clr.r, clr.g, clr.b); |
209 | if (args->mode & fillBackground_RunMode) { | 209 | if (args->mode & fillBackground_RunMode) { |
210 | SDL_SetRenderDrawColor(text_.render, clr.r, clr.g, clr.b, 0); | 210 | SDL_SetRenderDrawColor(activeText_->render, clr.r, clr.g, clr.b, 0); |
211 | } | 211 | } |
212 | } | 212 | } |
213 | prevCh = 0; | 213 | prevCh = 0; |
@@ -306,12 +306,14 @@ static iRect runSimple_Font_(iFont *d, const iRunArgs *args) { | |||
306 | src.y += over; | 306 | src.y += over; |
307 | src.h -= over; | 307 | src.h -= over; |
308 | } | 308 | } |
309 | dst.x += origin_Paint.x; | ||
310 | dst.y += origin_Paint.y; | ||
309 | if (args->mode & fillBackground_RunMode) { | 311 | if (args->mode & fillBackground_RunMode) { |
310 | /* Alpha blending looks much better if the RGB components don't change in | 312 | /* Alpha blending looks much better if the RGB components don't change in |
311 | the partially transparent pixels. */ | 313 | the partially transparent pixels. */ |
312 | SDL_RenderFillRect(text_.render, &dst); | 314 | SDL_RenderFillRect(activeText_->render, &dst); |
313 | } | 315 | } |
314 | SDL_RenderCopy(text_.render, text_.cache, &src, &dst); | 316 | SDL_RenderCopy(activeText_->render, activeText_->cache, &src, &dst); |
315 | } | 317 | } |
316 | xpos += advance; | 318 | xpos += advance; |
317 | if (!isSpace_Char(ch)) { | 319 | if (!isSpace_Char(ch)) { |