Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[core] Use linear filtering for icons in text for zoom dependent text…
Browse files Browse the repository at this point in the history
…-size
  • Loading branch information
alexshalamov committed Nov 19, 2019
1 parent b2b9e11 commit a00ec97
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/mbgl/renderer/layers/render_symbol_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,6 @@ void drawText(const DrawFn& draw,
const gfx::TextureBinding glyphTextureBinding{tile.getGlyphAtlasTexture().getResource(),
gfx::TextureFilterType::Linear};

const bool transformed = values.rotationAlignment == AlignmentType::Map || parameters.state.getPitch() != 0;
const Size& iconTexSize = tile.getIconAtlasTexture().size;
const gfx::TextureBinding iconTextureBinding{tile.getIconAtlasTexture().getResource(),
parameters.state.isChanging() || transformed
? gfx::TextureFilterType::Linear
: gfx::TextureFilterType::Nearest};

const auto drawGlyphs = [&](auto& program, const auto& uniforms, const auto& textures, SymbolSDFPart part) {
draw(program,
uniforms,
Expand All @@ -218,6 +211,15 @@ void drawText(const DrawFn& draw,
};

if (bucket.iconsInText) {
const ZoomEvaluatedSize partiallyEvaluatedTextSize =
bucket.textSizeBinder->evaluateForZoom(parameters.state.getZoom());
const bool transformed = values.rotationAlignment == AlignmentType::Map || parameters.state.getPitch() != 0;
const Size& iconTexSize = tile.getIconAtlasTexture().size;
const gfx::TextureBinding iconTextureBinding{
tile.getIconAtlasTexture().getResource(),
parameters.state.isChanging() || transformed || !partiallyEvaluatedTextSize.isZoomConstant
? gfx::TextureFilterType::Linear
: gfx::TextureFilterType::Nearest};
if (values.hasHalo) {
drawGlyphs(parameters.programs.getSymbolLayerPrograms().symbolTextAndIcon,
SymbolTextAndIconProgram::layoutUniformValues(bucket.hasVariablePlacement,
Expand Down

0 comments on commit a00ec97

Please sign in to comment.