ref: d675523e4903951bb6547a8eddafbc30fda4db5f
parent: ad07c9deb9398ed3a7b9279362f38e37ccb40f0d
author: ISSOtm <eldredhabert0@gmail.com>
date: Sun Mar 6 05:44:16 EST 2022
Skip initializing the PNG pixel array We are about to set all of the pixels anyway
--- a/src/gfx/convert.cpp
+++ b/src/gfx/convert.cpp
@@ -69,7 +69,7 @@
// These are cached for speed
uint32_t width, height;
- std::vector<Rgba> pixels;
+ DefaultInitVec<Rgba> pixels;
ImagePalette colors;
int colorType;
int nbColors;
@@ -206,8 +206,6 @@
if (height % 8 != 0)
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));
auto colorTypeName = [this]() {