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-01 17:40:23 +0100
commit25b73fd1c19750105ba6126d379f3cd1f0a9fd63 (patch)
treef5d613da6fbb2a22af695de32cd6475dfbe1f5a6 /plugingui/painter.cc
parenta9ee71d8f1ccc634acdd9f0205855af1527c4bb9 (diff)
WIP: 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);
}
}
}