summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAsheem Mamoowala <asheem.mamoowala@mapbox.com>2017-05-10 11:16:44 -0700
committerAsheem Mamoowala <asheem.mamoowala@mapbox.com>2017-05-18 16:29:06 -0700
commitba6a2dd947966ee7854fed6a1f0c537c6c829de7 (patch)
treef5774c04917832ff43a7c14aff2729c76b7563c9
parent70446a3dabd2ff22cf9766af032ced0ed983bea7 (diff)
downloadqtlocation-mapboxgl-ba6a2dd947966ee7854fed6a1f0c537c6c829de7.tar.gz
[core] Fix quad duplication and vertex order
-rw-r--r--src/mbgl/renderer/sources/render_image_source.cpp11
-rw-r--r--src/mbgl/style/sources/image_source_impl.cpp6
2 files changed, 5 insertions, 12 deletions
diff --git a/src/mbgl/renderer/sources/render_image_source.cpp b/src/mbgl/renderer/sources/render_image_source.cpp
index 8fca4e0de8..b66db1e124 100644
--- a/src/mbgl/renderer/sources/render_image_source.cpp
+++ b/src/mbgl/renderer/sources/render_image_source.cpp
@@ -50,13 +50,10 @@ void RenderImageSource::upload(gl::Context& context) {
void RenderImageSource::updateTiles(const TileParameters& ) {
if(impl.loaded && !isLoaded()) {
- //TODO: AHM: Don't make a copy here
+ //TODO: AHM: Is it possible to do this without making a clone ?
UnassociatedImage img = impl.getData().clone();
bucket = std::make_unique<RasterBucket>(std::move(img));
loaded = true;
- }
-
- if (isLoaded()) {
auto coords = impl.getCoordinates();
GeometryCoordinates geomCoords;
for ( auto latLng : coords) {
@@ -65,11 +62,11 @@ void RenderImageSource::updateTiles(const TileParameters& ) {
assert(geomCoords.size() == 4);
bucket->vertices.emplace_back(RasterProgram::layoutVertex({ geomCoords[0].x, geomCoords[0].y }, { 0, 0 }));
bucket->vertices.emplace_back(RasterProgram::layoutVertex({ geomCoords[1].x, geomCoords[1].y }, { 32767, 0 }));
- bucket->vertices.emplace_back(RasterProgram::layoutVertex({ geomCoords[2].x, geomCoords[2].y }, { 0, 32767 }));
- bucket->vertices.emplace_back(RasterProgram::layoutVertex({ geomCoords[3].x, geomCoords[3].y }, { 32767, 32767 }));
+ bucket->vertices.emplace_back(RasterProgram::layoutVertex({ geomCoords[3].x, geomCoords[3].y }, { 0, 32767 }));
+ bucket->vertices.emplace_back(RasterProgram::layoutVertex({ geomCoords[2].x, geomCoords[2].y }, { 32767, 32767 }));
bucket->indices.emplace_back(0, 1, 2);
- bucket->indices.emplace_back(2, 3, 0);
+ bucket->indices.emplace_back(1, 2, 3);
bucket->segments.emplace_back(0, 0, 4, 6);
}
diff --git a/src/mbgl/style/sources/image_source_impl.cpp b/src/mbgl/style/sources/image_source_impl.cpp
index ca88f947c5..7022e3b95f 100644
--- a/src/mbgl/style/sources/image_source_impl.cpp
+++ b/src/mbgl/style/sources/image_source_impl.cpp
@@ -65,11 +65,7 @@ void ImageSource::Impl::loadDescription(FileSource& fileSource) {
observer->onSourceError(base, std::make_exception_ptr(std::runtime_error("unexpectedly empty image url")));
} else {
try {
- //TODO: AHM: Figure out how to get the correct image pixels through
- UnassociatedImage img = util::unpremultiply(decodeImage(*res.data));
- UnassociatedImage img2 { img.size };
- img2.fill(135);
- image = std::move(img2);
+ image = util::unpremultiply(decodeImage(*res.data));
} catch (...) {
observer->onSourceError(base, std::current_exception());
}