Skip to content

Commit a24c5fb

Browse files
authored
Fix cached scale. (#129)
1 parent 44d93ac commit a24c5fb

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Diff for: src/rendering/caches/TextAtlas.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -300,20 +300,20 @@ std::unique_ptr<TextAtlas> TextAtlas::Make(const TextGlyphs* textGlyphs, RenderC
300300
float scale) {
301301
auto context = renderCache->getContext();
302302
auto maxTextureSize = context->caps()->maxTextureSize;
303-
scale = scale * textGlyphs->maxScale();
303+
auto maxScale = scale * textGlyphs->maxScale();
304304
const auto& maskGlyphs = textGlyphs->maskAtlasGlyphs();
305-
if (maskGlyphs.empty() || maskGlyphs[0]->getFont().getSize() * scale > kMaxAtlasFontSize) {
305+
if (maskGlyphs.empty() || maskGlyphs[0]->getFont().getSize() * maxScale > kMaxAtlasFontSize) {
306306
return nullptr;
307307
}
308308
const auto& colorGlyphs = textGlyphs->colorAtlasGlyphs();
309-
if (!colorGlyphs.empty() && colorGlyphs[0]->getFont().getSize() * scale > kMaxAtlasFontSize) {
309+
if (!colorGlyphs.empty() && colorGlyphs[0]->getFont().getSize() * maxScale > kMaxAtlasFontSize) {
310310
return nullptr;
311311
}
312-
auto maskAtlas = Atlas::Make(context, scale, maskGlyphs, maxTextureSize).release();
312+
auto maskAtlas = Atlas::Make(context, maxScale, maskGlyphs, maxTextureSize).release();
313313
if (maskAtlas == nullptr) {
314314
return nullptr;
315315
}
316-
auto colorAtlas = Atlas::Make(context, scale, colorGlyphs, maxTextureSize, false).release();
316+
auto colorAtlas = Atlas::Make(context, maxScale, colorGlyphs, maxTextureSize, false).release();
317317
return std::unique_ptr<TextAtlas>(new TextAtlas(textGlyphs->id(), maskAtlas, colorAtlas, scale));
318318
}
319319

0 commit comments

Comments
 (0)