summaryrefslogtreecommitdiff
path: root/plugingui/painter.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2020-03-01 17:40:23 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2020-03-07 19:22:59 +0100
commit560574d2e565510edd39dd9daf1d957a85f2220c (patch)
treed76efefe3e8b9ba041d82820aa366ca72e1904e4 /plugingui/painter.cc
parent01b3f327df2dc30d847bd335ccce12eaec2dfd39 (diff)
Remove unused pixel functions.
Diffstat (limited to 'plugingui/painter.cc')
-rw-r--r--plugingui/painter.cc18
1 files changed, 8 insertions, 10 deletions
diff --git a/plugingui/painter.cc b/plugingui/painter.cc
index 89d7498..761fe9b 100644
--- a/plugingui/painter.cc
+++ b/plugingui/painter.cc
@@ -65,7 +65,8 @@ static void plot(PixelBufferAlpha& pixbuf, const Colour& colour,
}
// plot the pixel at (x, y) with brightness c (where 0 ≤ c ≤ 1)
- pixbuf.addPixel(x, y, colour.red(), colour.green(), colour.blue(), colour.alpha() * c);
+ Colour col(colour.red(), colour.green(), colour.blue(), (std::uint8_t)(colour.alpha() * c));
+ pixbuf.addPixel(x, y, col);
}
static inline double fpart(double x)
@@ -202,21 +203,19 @@ void Painter::drawText(int x0, int y0, const Font& font,
{
for(int x = -1 * std::min(0, x0); x < renderWidth; ++x)
{
- unsigned char r, g, b, a;
-
assert(x >= 0);
assert(y >= 0);
assert(x < (int)textbuf->width);
assert(y < (int)textbuf->height);
- textbuf->pixel(x, y, &r, &g, &b, &a);
+ auto c = textbuf->pixel(x, y);
assert(x + x0 >= 0);
assert(y + y0 >= 0);
assert(x + x0 < (int)pixbuf.width);
assert(y + y0 < (int)pixbuf.height);
- pixbuf.addPixel(x + x0, y + y0, r, g, b, a);
+ pixbuf.addPixel(x + x0, y + y0, c);
}
}
}
@@ -226,22 +225,21 @@ void Painter::drawText(int x0, int y0, const Font& font,
{
for(int x = -1 * std::min(0, x0); x < renderWidth; ++x)
{
- unsigned char r,g,b,a;
-
assert(x >= 0);
assert(y >= 0);
assert(x < (int)textbuf->width);
assert(y < (int)textbuf->height);
- textbuf->pixel(x, y, &r, &g, &b, &a);
+ auto c = textbuf->pixel(x, y);
assert(x + x0 >= 0);
assert(y + y0 >= 0);
assert(x + x0 < (int)pixbuf.width);
assert(y + y0 < (int)pixbuf.height);
- pixbuf.addPixel(x + x0, y + y0, colour.red(), colour.green(),
- colour.blue(), (int)(colour.alpha() * a) / 255);
+ Colour col(colour.red(), colour.green(),
+ colour.blue(), (int)(colour.alpha() * c.alpha()) / 255);
+ pixbuf.addPixel(x + x0, y + y0, col);
}
}
}