summaryrefslogtreecommitdiff
path: root/src/plugins/geoservices/mapboxgl
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-11-15 09:09:41 +0100
committerLiang Qi <liang.qi@qt.io>2017-11-15 09:09:41 +0100
commitafc51951769ac7320a98a973bcb95a12bc970019 (patch)
treef248c33d4a98b2baa047cf8453dd91d6e6545cc8 /src/plugins/geoservices/mapboxgl
parent5804d34e3b311dc814c7897894ef7a6b960f0f40 (diff)
parent8c42dba3910c0bec3134f57bd5fa466df72d7ba7 (diff)
downloadqtlocation-afc51951769ac7320a98a973bcb95a12bc970019.tar.gz
Merge remote-tracking branch 'origin/5.9' into 5.10
Change-Id: Id7d47d95c8dc6a696b79812573e50c572593123e
Diffstat (limited to 'src/plugins/geoservices/mapboxgl')
-rw-r--r--src/plugins/geoservices/mapboxgl/mapboxgl.pro11
-rw-r--r--src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp13
-rw-r--r--src/plugins/geoservices/mapboxgl/qsgmapboxglnode.cpp9
3 files changed, 17 insertions, 16 deletions
diff --git a/src/plugins/geoservices/mapboxgl/mapboxgl.pro b/src/plugins/geoservices/mapboxgl/mapboxgl.pro
index f35f26dc..17b6f53a 100644
--- a/src/plugins/geoservices/mapboxgl/mapboxgl.pro
+++ b/src/plugins/geoservices/mapboxgl/mapboxgl.pro
@@ -35,16 +35,7 @@ load(qt_build_paths)
LIBS_PRIVATE += -L$$MODULE_BASE_OUTDIR/lib -lqmapboxgl$$qtPlatformTargetSuffix()
qtConfig(icu) {
- include(../../../3rdparty/icu_dependency.pri)
-}
-
-# When building for Windows with dynamic OpenGL, this plugin
-# can only run with ANGLE because Mapbox GL requires at least
-# OpenGL ES and does not use QOpenGLFunctions for resolving
-# the OpenGL symbols. -lopengl32 only gives OpenGL 1.1.
-win32:qtConfig(dynamicgl) {
- qtConfig(combined-angle-lib): LIBS_PRIVATE += -l$${LIBQTANGLE_NAME}
- else: LIBS_PRIVATE += -l$${LIBEGL_NAME} -l$${LIBGLESV2_NAME}
+ QMAKE_USE_PRIVATE += icu
}
PLUGIN_TYPE = geoservices
diff --git a/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp b/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp
index 69bb6e4b..f39bfae3 100644
--- a/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp
+++ b/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp
@@ -124,7 +124,10 @@ QMapbox::Feature featureFromMapPolygon(QDeclarativePolygonMapItem *mapItem)
coordinates << QMapbox::Coordinate { coordinate.latitude(), coordinate.longitude() };
}
}
- coordinates.append(coordinates.first());
+
+ if (!coordinates.empty())
+ coordinates.append(coordinates.first()); // closing the path
+
QMapbox::CoordinatesCollections geometry { { coordinates } };
return QMapbox::Feature(QMapbox::Feature::PolygonType, geometry, {}, getId(mapItem));
@@ -381,7 +384,7 @@ QList<QSharedPointer<QMapboxGLStyleChange>> QMapboxGLStyleSetPaintProperty::from
const QString id = getId(item);
changes << QSharedPointer<QMapboxGLStyleChange>(
- new QMapboxGLStyleSetPaintProperty(id, QStringLiteral("fill-opacity"), item->mapItemOpacity()));
+ new QMapboxGLStyleSetPaintProperty(id, QStringLiteral("fill-opacity"), item->color().alphaF() * item->mapItemOpacity()));
changes << QSharedPointer<QMapboxGLStyleChange>(
new QMapboxGLStyleSetPaintProperty(id, QStringLiteral("fill-color"), item->color()));
changes << QSharedPointer<QMapboxGLStyleChange>(
@@ -398,7 +401,7 @@ QList<QSharedPointer<QMapboxGLStyleChange>> QMapboxGLStyleSetPaintProperty::from
const QString id = getId(item);
changes << QSharedPointer<QMapboxGLStyleChange>(
- new QMapboxGLStyleSetPaintProperty(id, QStringLiteral("fill-opacity"), item->mapItemOpacity()));
+ new QMapboxGLStyleSetPaintProperty(id, QStringLiteral("fill-opacity"), item->color().alphaF() * item->mapItemOpacity()));
changes << QSharedPointer<QMapboxGLStyleChange>(
new QMapboxGLStyleSetPaintProperty(id, QStringLiteral("fill-color"), item->color()));
changes << QSharedPointer<QMapboxGLStyleChange>(
@@ -415,7 +418,7 @@ QList<QSharedPointer<QMapboxGLStyleChange>> QMapboxGLStyleSetPaintProperty::from
const QString id = getId(item);
changes << QSharedPointer<QMapboxGLStyleChange>(
- new QMapboxGLStyleSetPaintProperty(id, QStringLiteral("fill-opacity"), item->mapItemOpacity()));
+ new QMapboxGLStyleSetPaintProperty(id, QStringLiteral("fill-opacity"), item->color().alphaF() * item->mapItemOpacity()));
changes << QSharedPointer<QMapboxGLStyleChange>(
new QMapboxGLStyleSetPaintProperty(id, QStringLiteral("fill-color"), item->color()));
changes << QSharedPointer<QMapboxGLStyleChange>(
@@ -432,7 +435,7 @@ QList<QSharedPointer<QMapboxGLStyleChange>> QMapboxGLStyleSetPaintProperty::from
const QString id = getId(item);
changes << QSharedPointer<QMapboxGLStyleChange>(
- new QMapboxGLStyleSetPaintProperty(id, QStringLiteral("line-opacity"), item->mapItemOpacity()));
+ new QMapboxGLStyleSetPaintProperty(id, QStringLiteral("line-opacity"), item->line()->color().alphaF() * item->mapItemOpacity()));
changes << QSharedPointer<QMapboxGLStyleChange>(
new QMapboxGLStyleSetPaintProperty(id, QStringLiteral("line-color"), item->line()->color()));
changes << QSharedPointer<QMapboxGLStyleChange>(
diff --git a/src/plugins/geoservices/mapboxgl/qsgmapboxglnode.cpp b/src/plugins/geoservices/mapboxgl/qsgmapboxglnode.cpp
index 82aa868f..7721fe61 100644
--- a/src/plugins/geoservices/mapboxgl/qsgmapboxglnode.cpp
+++ b/src/plugins/geoservices/mapboxgl/qsgmapboxglnode.cpp
@@ -68,8 +68,10 @@ void QSGMapboxGLTextureNode::resize(const QSize &size, qreal pixelRatio)
m_map->setFramebufferObject(m_fbo->handle());
QSGPlainTexture *fboTexture = static_cast<QSGPlainTexture *>(texture());
- if (!fboTexture)
+ if (!fboTexture) {
fboTexture = new QSGPlainTexture;
+ fboTexture->setHasAlphaChannel(true);
+ }
fboTexture->setTextureId(m_fbo->texture());
fboTexture->setTextureSize(fbSize);
@@ -92,6 +94,11 @@ void QSGMapboxGLTextureNode::render(QQuickWindow *window)
f->glGetIntegerv(GL_UNPACK_ALIGNMENT, &alignment);
m_fbo->bind();
+
+ f->glClearColor(0.f, 0.f, 0.f, 0.f);
+ f->glColorMask(true, true, true, true);
+ f->glClear(GL_COLOR_BUFFER_BIT);
+
m_map->render();
m_fbo->release();