summaryrefslogtreecommitdiff
path: root/src/mbgl/renderer/painter_background.cpp
diff options
context:
space:
mode:
authorJesse Crocker <jesse@gaiagps.com>2017-03-01 11:15:11 -0700
committerJesse Crocker <jesse@gaiagps.com>2017-03-01 11:15:11 -0700
commit9e8dc9a9e3e86adb9987ae69766cc42c7d9efece (patch)
treef5f0abd4d342c89ad0405d01969f9d6caecc1c90 /src/mbgl/renderer/painter_background.cpp
parent16fb0672e64a72b7400c321d55858b73cd5d8c3f (diff)
parentf28d75dccd9bf4a7615df87faccc5cf5eff8df89 (diff)
downloadqtlocation-mapboxgl-9e8dc9a9e3e86adb9987ae69766cc42c7d9efece.tar.gz
Merge remote-tracking branch 'origin/master' into feature/custom-vector-source
Diffstat (limited to 'src/mbgl/renderer/painter_background.cpp')
-rw-r--r--src/mbgl/renderer/painter_background.cpp33
1 files changed, 20 insertions, 13 deletions
diff --git a/src/mbgl/renderer/painter_background.cpp b/src/mbgl/renderer/painter_background.cpp
index 4a3e41701d..4ac414335b 100644
--- a/src/mbgl/renderer/painter_background.cpp
+++ b/src/mbgl/renderer/painter_background.cpp
@@ -14,13 +14,18 @@ using namespace style;
void Painter::renderBackground(PaintParameters& parameters, const BackgroundLayer& layer) {
// Note that for bottommost layers without a pattern, the background color is drawn with
// glClear rather than this method.
- const BackgroundPaintProperties::Evaluated& properties = layer.impl->paint.evaluated;
+ const BackgroundPaintProperties::Evaluated& background = layer.impl->paint.evaluated;
- if (!properties.get<BackgroundPattern>().to.empty()) {
- optional<SpriteAtlasPosition> imagePosA = spriteAtlas->getPosition(
- properties.get<BackgroundPattern>().from, SpritePatternMode::Repeating);
- optional<SpriteAtlasPosition> imagePosB = spriteAtlas->getPosition(
- properties.get<BackgroundPattern>().to, SpritePatternMode::Repeating);
+ style::FillPaintProperties::Evaluated properties;
+ properties.get<FillPattern>() = background.get<BackgroundPattern>();
+ properties.get<FillOpacity>() = { background.get<BackgroundOpacity>() };
+ properties.get<FillColor>() = { background.get<BackgroundColor>() };
+
+ const FillProgram::PaintPropertyBinders paintAttibuteData(properties, 0);
+
+ if (!background.get<BackgroundPattern>().to.empty()) {
+ optional<SpriteAtlasElement> imagePosA = spriteAtlas->getPattern(background.get<BackgroundPattern>().from);
+ optional<SpriteAtlasElement> imagePosB = spriteAtlas->getPattern(background.get<BackgroundPattern>().to);
if (!imagePosA || !imagePosB)
return;
@@ -36,17 +41,19 @@ void Painter::renderBackground(PaintParameters& parameters, const BackgroundLaye
colorModeForRenderPass(),
FillPatternUniforms::values(
matrixForTile(tileID),
- properties.get<BackgroundOpacity>(),
context.viewport.getCurrentValue().size,
*imagePosA,
*imagePosB,
- properties.get<BackgroundPattern>(),
+ background.get<BackgroundPattern>(),
tileID,
state
),
tileVertexBuffer,
tileTriangleIndexBuffer,
- tileTriangleSegments
+ tileTriangleSegments,
+ paintAttibuteData,
+ properties,
+ state.getZoom()
);
}
} else {
@@ -59,14 +66,14 @@ void Painter::renderBackground(PaintParameters& parameters, const BackgroundLaye
colorModeForRenderPass(),
FillProgram::UniformValues {
uniforms::u_matrix::Value{ matrixForTile(tileID) },
- uniforms::u_opacity::Value{ properties.get<BackgroundOpacity>() },
- uniforms::u_color::Value{ properties.get<BackgroundColor>() },
- uniforms::u_outline_color::Value{ properties.get<BackgroundColor>() },
uniforms::u_world::Value{ context.viewport.getCurrentValue().size },
},
tileVertexBuffer,
tileTriangleIndexBuffer,
- tileTriangleSegments
+ tileTriangleSegments,
+ paintAttibuteData,
+ properties,
+ state.getZoom()
);
}
}