summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2017-10-31 15:29:45 +0200
committerBruno de Oliveira Abinader <bruno@mapbox.com>2017-11-01 17:45:37 +0200
commit68ab4f6cec316769fa600e4b69b09500d582eb4d (patch)
treed8cf99dbb8ed0040a219769f69f2feec15e073e3 /src
parente350ef37fe68312c4b5fb03b289a90c0bdda4f03 (diff)
downloadqtlocation-mapboxgl-68ab4f6cec316769fa600e4b69b09500d582eb4d.tar.gz
[core] Let transparency leak in GLContext::Shared mode
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/renderer/renderer_impl.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/mbgl/renderer/renderer_impl.cpp b/src/mbgl/renderer/renderer_impl.cpp
index cbdcbf2f96..d7886ebe88 100644
--- a/src/mbgl/renderer/renderer_impl.cpp
+++ b/src/mbgl/renderer/renderer_impl.cpp
@@ -298,7 +298,9 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) {
if (const RenderBackgroundLayer* background = layer->as<RenderBackgroundLayer>()) {
const BackgroundPaintProperties::PossiblyEvaluated& paint = background->evaluated;
- if (layerImpl.get() == layerImpls->at(0).get() && paint.get<BackgroundPattern>().from.empty()) {
+ if (parameters.contextMode == GLContextMode::Unique
+ && layerImpl.get() == layerImpls->at(0).get()
+ && paint.get<BackgroundPattern>().from.empty()) {
// This is a solid background. We can use glClear().
backgroundColor = paint.get<BackgroundColor>() * paint.get<BackgroundOpacity>();
} else {
@@ -434,10 +436,19 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) {
// Renders the backdrop of the OpenGL view. This also paints in areas where we don't have any
// tiles whatsoever.
{
+ using namespace gl::value;
+
MBGL_DEBUG_GROUP(parameters.context, "clear");
parameters.backend.bind();
- parameters.context.clear((parameters.debugOptions & MapDebugOptions::Overdraw)
- ? Color::black() : backgroundColor);
+ if (parameters.debugOptions & MapDebugOptions::Overdraw) {
+ parameters.context.clear(Color::black(), ClearDepth::Default, ClearStencil::Default);
+ } else if (parameters.contextMode == GLContextMode::Shared) {
+ // Preserve the shared context background colors, clearing only alpha.
+ optional<gl::ColorMode::Mask> mask = { { false, false, false, true } };
+ parameters.context.clear(backgroundColor, ClearDepth::Default, ClearStencil::Default, mask);
+ } else {
+ parameters.context.clear(backgroundColor, ClearDepth::Default, ClearStencil::Default);
+ }
}
// - CLIPPING MASKS ----------------------------------------------------------------------------