mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Skip initializing the PNG pixel array
We are about to set all of the pixels anyway
This commit is contained in:
@@ -69,7 +69,7 @@ class Png {
|
|||||||
|
|
||||||
// These are cached for speed
|
// These are cached for speed
|
||||||
uint32_t width, height;
|
uint32_t width, height;
|
||||||
std::vector<Rgba> pixels;
|
DefaultInitVec<Rgba> pixels;
|
||||||
ImagePalette colors;
|
ImagePalette colors;
|
||||||
int colorType;
|
int colorType;
|
||||||
int nbColors;
|
int nbColors;
|
||||||
@@ -206,8 +206,6 @@ public:
|
|||||||
if (height % 8 != 0)
|
if (height % 8 != 0)
|
||||||
fatal("Image height (%" PRIu32 " pixels) is not a multiple of 8!", height);
|
fatal("Image height (%" PRIu32 " pixels) is not a multiple of 8!", height);
|
||||||
|
|
||||||
// TODO: use an allocator that doesn't zero on init to save potentially a lot of perf
|
|
||||||
// https://stackoverflow.com/questions/21028299/is-this-behavior-of-vectorresizesize-type-n-under-c11-and-boost-container/21028912#21028912
|
|
||||||
pixels.resize(static_cast<size_t>(width) * static_cast<size_t>(height));
|
pixels.resize(static_cast<size_t>(width) * static_cast<size_t>(height));
|
||||||
|
|
||||||
auto colorTypeName = [this]() {
|
auto colorTypeName = [this]() {
|
||||||
|
|||||||
Reference in New Issue
Block a user