Always write png instead of jpg.

This commit is contained in:
K. S. Ernest (iFire) Lee 2022-05-12 10:59:20 -07:00
parent 815c19e893
commit f718110834
1 changed files with 8 additions and 16 deletions

View File

@ -118,24 +118,16 @@ std::shared_ptr<TextureData> TextureBuilder::combine(
} }
} }
// write a .png iff we need transparency in the destination texture
bool png = includeAlphaChannel;
std::vector<char> imgBuffer; std::vector<char> imgBuffer;
int res; int res;
if (png) { res = stbi_write_png_to_func(
res = stbi_write_png_to_func( WriteToVectorContext,
WriteToVectorContext, &imgBuffer,
&imgBuffer, width,
width, height,
height, channels,
channels, mergedPixels.data(),
mergedPixels.data(), width * channels);
width * channels);
} else {
res = stbi_write_jpg_to_func(
WriteToVectorContext, &imgBuffer, width, height, channels, mergedPixels.data(), 80);
}
if (!res) { if (!res) {
fmt::printf("Warning: failed to generate merge texture '%s'.\n", mergedFilename); fmt::printf("Warning: failed to generate merge texture '%s'.\n", mergedFilename);
return nullptr; return nullptr;