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;
int res;
if (png) {
res = stbi_write_png_to_func(
WriteToVectorContext,
&imgBuffer,
width,
height,
channels,
mergedPixels.data(),
width * channels);
} else {
res = stbi_write_jpg_to_func(
WriteToVectorContext, &imgBuffer, width, height, channels, mergedPixels.data(), 80);
}
res = stbi_write_png_to_func(
WriteToVectorContext,
&imgBuffer,
width,
height,
channels,
mergedPixels.data(),
width * channels);
if (!res) {
fmt::printf("Warning: failed to generate merge texture '%s'.\n", mergedFilename);
return nullptr;