From 38c4759282d652bf227eaa0542db4d708f6263f6 Mon Sep 17 00:00:00 2001 From: Mark Tehver Date: Wed, 28 Dec 2016 21:03:13 +0200 Subject: [PATCH] Disable subtile blending in case when RGBA tiles are used --- libs-carto/vt/src/vt/GLTileRenderer.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/libs-carto/vt/src/vt/GLTileRenderer.cpp b/libs-carto/vt/src/vt/GLTileRenderer.cpp index cb5dda062..7b29b5cda 100644 --- a/libs-carto/vt/src/vt/GLTileRenderer.cpp +++ b/libs-carto/vt/src/vt/GLTileRenderer.cpp @@ -526,7 +526,18 @@ namespace carto { namespace vt { break; } if (blend && blendNode->tileId.intersects(oldBlendNode->tileId)) { - if (_subTileBlending) { + bool subTileBlending = _subTileBlending; + + // Disable subtile blending if alpha channel is used on the tile + for (const std::shared_ptr& layer : blendNode->tile->getLayers()) { + for (const std::shared_ptr& bitmap : layer->getBitmaps()) { + if (bitmap->getFormat() == TileBitmap::Format::RGBA) { + subTileBlending = false; + } + } + } + + if (subTileBlending) { blendNode->childNodes.push_back(oldBlendNode); oldBlendNode->blend = calculateBlendNodeOpacity(*oldBlendNode, 1.0f); // this is an optimization, to reduce extensive blending subtrees oldBlendNode->childNodes.clear();