mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[kandinsky] Handle drawing clipped text
Text can be drawn in a rect that cannot contain the whole character. Luckily, we have fillRectWithPixels handy to handle such cases.
This commit is contained in:
committed by
LeaNumworks
parent
fd136f71e7
commit
1dd1e6ca8d
@@ -22,9 +22,11 @@ KDPoint KDContext::drawString(const char * text, KDPoint p, const KDFont * font,
|
||||
} else {
|
||||
// Fetch and draw glyph for current char
|
||||
font->fetchGlyphForChar(*text, &palette, glyph);
|
||||
KDRect absoluteRect = absoluteFillRect(KDRect(position, glyphSize.width(), glyphSize.height()));
|
||||
pushRect(absoluteRect, glyph);
|
||||
|
||||
fillRectWithPixels(
|
||||
KDRect(position, glyphSize.width(), glyphSize.height()),
|
||||
glyph,
|
||||
glyph // It's OK to trash the content of glyph since we'll re-fetch it for the next char anyway
|
||||
);
|
||||
position = position.translatedBy(KDPoint(glyphSize.width(), 0));
|
||||
}
|
||||
text++;
|
||||
|
||||
Reference in New Issue
Block a user