Add minor comment in DocExporter::createEmptyTexture() (#4127, #4135)

This commit is contained in:
David Capello 2023-11-23 09:47:12 -03:00
parent 9f0cac32b3
commit 3486dcca7e

View File

@ -1185,13 +1185,18 @@ Doc* DocExporter::createEmptyTexture(const Samples& samples,
int maxColors = 256;
gfx::ColorSpaceRef colorSpace;
color_t transparentColor = 0;
bool ui = false;
#ifdef ENABLE_UI
if (App::instance()->isGui())
ui = true;
#endif
// We generate a palette for file formats that support a color
// palette inside, or if the UI/preview is available/required.
//
// As a side note, here we cannot use a possible
// ctx->isUIAvailable() (instead of App::instance()->isGui())
// because when the sprite sheet is generated from the UI, a
// temporal non-UI context is created in a background thread.
const bool paletteRequiredByUIPreview = App::instance()->isGui();
const bool textureSupportsPalette =
format_supports_palette(m_textureFilename) || ui;
format_supports_palette(m_textureFilename) ||
paletteRequiredByUIPreview;
for (const auto& sample : samples) {
if (token.canceled())