summaryrefslogtreecommitdiff
path: root/plugingui/image.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2018-06-09 09:45:03 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2018-06-09 09:45:03 +0200
commit21554166b294470ac593a1a90c82d1b4fe75c61e (patch)
tree4fe4c5782a0bbcef3e3309633e0c2ee7e71c4e2a /plugingui/image.cc
parent108a94eaefc1e9ccfe316d4ce9a30e3bd532af5a (diff)
Add ctor for creating colours from four unsigned char values.
Diffstat (limited to 'plugingui/image.cc')
-rw-r--r--plugingui/image.cc11
1 files changed, 5 insertions, 6 deletions
diff --git a/plugingui/image.cc b/plugingui/image.cc
index 3770fae..fc28d11 100644
--- a/plugingui/image.cc
+++ b/plugingui/image.cc
@@ -119,10 +119,10 @@ void Image::setError()
void Image::load(const char* data, size_t size)
{
unsigned int iw{0}, ih{0};
- unsigned char* char_image_data{nullptr};
- unsigned int res = lodepng_decode32((unsigned char**)&char_image_data,
+ std::uint8_t* char_image_data{nullptr};
+ unsigned int res = lodepng_decode32((std::uint8_t**)&char_image_data,
&iw, &ih,
- (const unsigned char*)data, size);
+ (const std::uint8_t*)data, size);
if(res != 0)
{
@@ -142,9 +142,8 @@ void Image::load(const char* data, size_t size)
{
for(std::size_t x = 0; x < _width; ++x)
{
- unsigned char* ptr = &char_image_data[(x + y * _width) * 4];
- image_data.emplace_back(Colour{ptr[0] / 255.0f, ptr[1] / 255.0f,
- ptr[2] / 255.0f, ptr[3] / 255.0f});
+ std::uint8_t* ptr = &char_image_data[(x + y * _width) * 4];
+ image_data.emplace_back(Colour{ptr[0], ptr[1], ptr[2], ptr[3]});
}
}