[core] RenderTile returns textures by const reference
This commit is contained in:
@@ -179,7 +179,7 @@ void RenderFillExtrusionLayer::render(PaintParameters& parameters) {
|
||||
tile.translatedClipMatrix(evaluated.get<FillExtrusionTranslate>(),
|
||||
evaluated.get<FillExtrusionTranslateAnchor>(),
|
||||
parameters.state),
|
||||
tile.getIconAtlasTexture()->size,
|
||||
tile.getIconAtlasTexture().size,
|
||||
crossfade,
|
||||
tile.id,
|
||||
parameters.state,
|
||||
@@ -191,7 +191,7 @@ void RenderFillExtrusionLayer::render(PaintParameters& parameters) {
|
||||
patternPosA,
|
||||
patternPosB,
|
||||
FillExtrusionPatternProgram::TextureBindings{
|
||||
textures::image::Value{ tile.getIconAtlasTexture()->getResource(), gfx::TextureFilterType::Linear },
|
||||
textures::image::Value{ tile.getIconAtlasTexture().getResource(), gfx::TextureFilterType::Linear },
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ void RenderFillLayer::render(PaintParameters& parameters) {
|
||||
evaluated.get<FillTranslateAnchor>(),
|
||||
parameters.state),
|
||||
parameters.backend.getDefaultRenderable().getSize(),
|
||||
tile.getIconAtlasTexture()->size,
|
||||
tile.getIconAtlasTexture().size,
|
||||
crossfade,
|
||||
tile.id,
|
||||
parameters.state,
|
||||
@@ -232,7 +232,7 @@ void RenderFillLayer::render(PaintParameters& parameters) {
|
||||
*bucket.triangleIndexBuffer,
|
||||
bucket.triangleSegments,
|
||||
FillPatternProgram::TextureBindings{
|
||||
textures::image::Value{ tile.getIconAtlasTexture()->getResource(), gfx::TextureFilterType::Linear },
|
||||
textures::image::Value{ tile.getIconAtlasTexture().getResource(), gfx::TextureFilterType::Linear },
|
||||
});
|
||||
}
|
||||
if (evaluated.get<FillAntialias>() && unevaluated.get<FillOutlineColor>().isUndefined()) {
|
||||
@@ -242,7 +242,7 @@ void RenderFillLayer::render(PaintParameters& parameters) {
|
||||
*bucket.lineIndexBuffer,
|
||||
bucket.lineSegments,
|
||||
FillOutlinePatternProgram::TextureBindings{
|
||||
textures::image::Value{ tile.getIconAtlasTexture()->getResource(), gfx::TextureFilterType::Linear },
|
||||
textures::image::Value{ tile.getIconAtlasTexture().getResource(), gfx::TextureFilterType::Linear },
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ void RenderLineLayer::render(PaintParameters& parameters) {
|
||||
|
||||
} else if (!unevaluated.get<LinePattern>().isUndefined()) {
|
||||
const auto& linePatternValue = evaluated.get<LinePattern>().constantOr(Faded<std::basic_string<char>>{ "", ""});
|
||||
const Size& texsize = tile.getIconAtlasTexture()->size;
|
||||
const Size& texsize = tile.getIconAtlasTexture().size;
|
||||
|
||||
optional<ImagePosition> posA = tile.getPattern(linePatternValue.from);
|
||||
optional<ImagePosition> posB = tile.getPattern(linePatternValue.to);
|
||||
@@ -187,7 +187,7 @@ void RenderLineLayer::render(PaintParameters& parameters) {
|
||||
posA,
|
||||
posB,
|
||||
LinePatternProgram::TextureBindings{
|
||||
textures::image::Value{ tile.getIconAtlasTexture()->getResource(), gfx::TextureFilterType::Linear },
|
||||
textures::image::Value{ tile.getIconAtlasTexture().getResource(), gfx::TextureFilterType::Linear },
|
||||
});
|
||||
} else if (!unevaluated.get<LineGradient>().getValue().isUndefined()) {
|
||||
assert(colorRampTexture);
|
||||
|
||||
@@ -123,14 +123,14 @@ void drawIcon(const DrawFn& draw,
|
||||
const bool iconScaled = layout.get<IconSize>().constantOr(1.0) != 1.0 || bucket.iconsNeedLinear;
|
||||
const bool iconTransformed = values.rotationAlignment == AlignmentType::Map || parameters.state.getPitch() != 0;
|
||||
|
||||
const gfx::TextureBinding textureBinding{ tile.getIconAtlasTexture()->getResource(),
|
||||
const gfx::TextureBinding textureBinding{ tile.getIconAtlasTexture().getResource(),
|
||||
bucket.sdfIcons ||
|
||||
parameters.state.isChanging() ||
|
||||
iconScaled || iconTransformed
|
||||
? gfx::TextureFilterType::Linear
|
||||
: gfx::TextureFilterType::Nearest };
|
||||
|
||||
const Size& iconSize = tile.getIconAtlasTexture()->size;
|
||||
const Size& iconSize = tile.getIconAtlasTexture().size;
|
||||
|
||||
if (bucket.sdfIcons) {
|
||||
if (values.hasHalo) {
|
||||
@@ -189,7 +189,7 @@ void drawText(const DrawFn& draw,
|
||||
const auto& evaluated = getEvaluated<SymbolLayerProperties>(renderData.layerProperties);
|
||||
const auto& layout = bucket.layout;
|
||||
|
||||
const gfx::TextureBinding textureBinding{ tile.getGlyphAtlasTexture()->getResource(),
|
||||
const gfx::TextureBinding textureBinding{ tile.getGlyphAtlasTexture().getResource(),
|
||||
gfx::TextureFilterType::Linear };
|
||||
|
||||
auto values = textPropertyValues(evaluated, layout);
|
||||
@@ -198,7 +198,7 @@ void drawText(const DrawFn& draw,
|
||||
const bool alongLine = layout.get<SymbolPlacement>() != SymbolPlacementType::Point &&
|
||||
layout.get<TextRotationAlignment>() == AlignmentType::Map;
|
||||
|
||||
const Size& texsize = tile.getGlyphAtlasTexture()->size;
|
||||
const Size& texsize = tile.getGlyphAtlasTexture().size;
|
||||
|
||||
if (values.hasHalo) {
|
||||
draw(parameters.programs.getSymbolLayerPrograms().symbolGlyph,
|
||||
|
||||
@@ -77,14 +77,16 @@ optional<ImagePosition> RenderTile::getPattern(const std::string& pattern) const
|
||||
return static_cast<const GeometryTile&>(tile).getPattern(pattern);
|
||||
}
|
||||
|
||||
const optional<gfx::Texture>& RenderTile::getGlyphAtlasTexture() const {
|
||||
const gfx::Texture& RenderTile::getGlyphAtlasTexture() const {
|
||||
assert(tile.kind == Tile::Kind::Geometry);
|
||||
return static_cast<const GeometryTile&>(tile).glyphAtlasTexture;
|
||||
assert(static_cast<const GeometryTile&>(tile).glyphAtlasTexture);
|
||||
return *(static_cast<const GeometryTile&>(tile).glyphAtlasTexture);
|
||||
}
|
||||
|
||||
const optional<gfx::Texture>& RenderTile::getIconAtlasTexture() const {
|
||||
const gfx::Texture& RenderTile::getIconAtlasTexture() const {
|
||||
assert(tile.kind == Tile::Kind::Geometry);
|
||||
return static_cast<const GeometryTile&>(tile).iconAtlasTexture;
|
||||
assert(static_cast<const GeometryTile&>(tile).iconAtlasTexture);
|
||||
return *(static_cast<const GeometryTile&>(tile).iconAtlasTexture);
|
||||
}
|
||||
|
||||
std::shared_ptr<FeatureIndex> RenderTile::getFeatureIndex() const {
|
||||
|
||||
@@ -57,8 +57,8 @@ public:
|
||||
Bucket* getBucket(const style::Layer::Impl&) const;
|
||||
const LayerRenderData* getLayerRenderData(const style::Layer::Impl&) const;
|
||||
optional<ImagePosition> getPattern(const std::string& pattern) const;
|
||||
const optional<gfx::Texture>& getGlyphAtlasTexture() const;
|
||||
const optional<gfx::Texture>& getIconAtlasTexture() const;
|
||||
const gfx::Texture& getGlyphAtlasTexture() const;
|
||||
const gfx::Texture& getIconAtlasTexture() const;
|
||||
std::shared_ptr<FeatureIndex> getFeatureIndex() const;
|
||||
|
||||
void setMask(TileMask&&);
|
||||
|
||||
Reference in New Issue
Block a user