mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-30 08:51:04 +02:00
fontrenderer: adjust width clipping
instead of not even trying to draw glyphs that *might* extend past the
allocated space, actually draw as much as fits in the box
Origin commit data
------------------
Branch: ni/coolstream
Commit: 736964034c
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2018-01-28 (Sun, 28 Jan 2018)
------------------
This commit was generated by Migit
This commit is contained in:
committed by
vanhofen
parent
5554ef47ce
commit
05bb4e16b4
@@ -644,10 +644,11 @@ void Font::RenderString(int x, int y, const int width, const char *text, const f
|
|||||||
x += (kerning.x) >> 6; // kerning!
|
x += (kerning.x) >> 6; // kerning!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
// width clip
|
// width clip
|
||||||
if (x + glyph->xadvance + spread_by > left + width)
|
if (x + glyph->xadvance + spread_by > left + width)
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
int ap=(x + glyph->left) * sizeof(fb_pixel_t) + stride * (y - glyph->top);
|
int ap=(x + glyph->left) * sizeof(fb_pixel_t) + stride * (y - glyph->top);
|
||||||
uint8_t * d = ((uint8_t *)buff) + ap;
|
uint8_t * d = ((uint8_t *)buff) + ap;
|
||||||
uint8_t * s = glyph->buffer;
|
uint8_t * s = glyph->buffer;
|
||||||
@@ -659,6 +660,9 @@ void Font::RenderString(int x, int y, const int width, const char *text, const f
|
|||||||
fb_pixel_t * td = (fb_pixel_t *)d;
|
fb_pixel_t * td = (fb_pixel_t *)d;
|
||||||
int ax;
|
int ax;
|
||||||
for (ax = 0; ax < w + spread_by; ax++) {
|
for (ax = 0; ax < w + spread_by; ax++) {
|
||||||
|
/* width clip */
|
||||||
|
if (x + ax > left + width)
|
||||||
|
break;
|
||||||
if (stylemodifier != Font::Embolden) {
|
if (stylemodifier != Font::Embolden) {
|
||||||
/* do not paint the backgroundcolor (*s = 0) */
|
/* do not paint the backgroundcolor (*s = 0) */
|
||||||
if (*s != 0)
|
if (*s != 0)
|
||||||
|
Reference in New Issue
Block a user