summaryrefslogtreecommitdiff
path: root/plugingui/font.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2020-02-29 16:12:26 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2020-02-29 17:32:33 +0100
commit15e9d38d36573ba0e1ec6e0cc2768b12ca01bff0 (patch)
tree5bceab5dfb37941cbc055a978780ed0a777228e5 /plugingui/font.cc
parentdf32a5c6a6f8e204a757f68f0a61ea6f4843c569 (diff)
WIP: Read images as uint8_t instead of float. Convert Colour and all colour related operations to use uint8_t instade of float and finally optimize rendering to render lines instead of single pixels.
Diffstat (limited to 'plugingui/font.cc')
-rw-r--r--plugingui/font.cc8
1 files changed, 3 insertions, 5 deletions
diff --git a/plugingui/font.cc b/plugingui/font.cc
index 9f54b16..0500e81 100644
--- a/plugingui/font.cc
+++ b/plugingui/font.cc
@@ -59,8 +59,8 @@ Font::Font(const std::string& fontfile)
auto& pixel = img_font.getPixel(px, 0);
// Find next purple pixel in top row:
- if((pixel.red() == 1.0f) && (pixel.green() == 0.0f) &&
- (pixel.blue() == 1.0f) && (pixel.alpha() == 1.0f))
+ if((pixel.red() == 255) && (pixel.green() == 0) &&
+ (pixel.blue() == 255) && (pixel.alpha() == 255))
{
break;
}
@@ -124,9 +124,7 @@ PixelBufferAlpha *Font::render(const std::string& text) const
for(size_t y = 0; y < img_font.height(); ++y)
{
auto& c = img_font.getPixel(x + character.offset, y);
- pb->setPixel(x + x_offset + character.pre_bias, y,
- c.red() * 255, c.green() * 255,
- c.blue() * 255, c.alpha() * 255);
+ pb->setPixel(x + x_offset + character.pre_bias, y, c);
}
}
x_offset += character.width + spacing + character.post_bias;