summaryrefslogtreecommitdiff
path: root/src/geometry/sprite_atlas.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/geometry/sprite_atlas.cpp')
-rw-r--r--src/geometry/sprite_atlas.cpp14
1 files changed, 2 insertions, 12 deletions
diff --git a/src/geometry/sprite_atlas.cpp b/src/geometry/sprite_atlas.cpp
index 5271122919..d7ef1e789b 100644
--- a/src/geometry/sprite_atlas.cpp
+++ b/src/geometry/sprite_atlas.cpp
@@ -72,18 +72,7 @@ void copy_bitmap(const uint32_t *src, const int src_stride, const int src_x, con
dst += dst_y * dst_stride + dst_x;
for (int y = 0; y < height; y++, src += src_stride, dst += dst_stride) {
for (int x = 0; x < width; x++) {
- const uint8_t *s = reinterpret_cast<const uint8_t *>(src + x);
- uint8_t *d = reinterpret_cast<uint8_t *>(dst + x);
-
- // Premultiply the bitmap.
- // Note: We don't need to clamp the component values to 0..255, since
- // the source value is already 0..255 and the operation means they will
- // stay within the range of 0..255 and won't overflow.
- const uint8_t a = s[3];
- d[0] = s[0] * a / 255;
- d[1] = s[1] * a / 255;
- d[2] = s[2] * a / 255;
- d[3] = a;
+ dst[x] = src[x];
}
}
}
@@ -158,6 +147,7 @@ void SpriteAtlas::allocate() {
void SpriteAtlas::copy(const Rect<dimension>& dst, const SpritePosition& src) {
if (!sprite->raster) return;
const uint32_t *src_img = reinterpret_cast<const uint32_t *>(sprite->raster->getData());
+ if (!src_img) return;
allocate();
uint32_t *dst_img = reinterpret_cast<uint32_t *>(data);