diff options
author | Ansis Brammanis <ansis.brammanis@gmail.com> | 2019-04-02 12:57:45 -0400 |
---|---|---|
committer | Fabian Guerra Soto <fabian.guerra@mapbox.com> | 2019-04-02 15:21:14 -0700 |
commit | c600a688ca12ee6aceac73723ba56921009c23aa (patch) | |
tree | d0ab0477f606d77d6142f5b927e852b65b773bcc /src/mbgl/gl/context.cpp | |
parent | ec3f115d19d7b2775c69121bd8f040d90fd19083 (diff) | |
download | qtlocation-mapboxgl-c600a688ca12ee6aceac73723ba56921009c23aa.tar.gz |
[core] add onStyleImageMissing to allow dynamically loaded or generated images (#14253)
Also make `Style#updateImage(...)` much faster when the image doesn't change size. This can be useful for asynchronously generating images.
Diffstat (limited to 'src/mbgl/gl/context.cpp')
-rw-r--r-- | src/mbgl/gl/context.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/mbgl/gl/context.cpp b/src/mbgl/gl/context.cpp index 5193381251..11fa9444b7 100644 --- a/src/mbgl/gl/context.cpp +++ b/src/mbgl/gl/context.cpp @@ -547,6 +547,24 @@ void Context::updateTextureResource(const gfx::TextureResource& resource, Enum<gfx::TextureChannelDataType>::to(type), data)); } +void Context::updateTextureResourceSub(const gfx::TextureResource& resource, + const uint16_t xOffset, + const uint16_t yOffset, + const Size size, + const void* data, + gfx::TexturePixelType format, + gfx::TextureChannelDataType type) { + // Always use texture unit 0 for manipulating it. + activeTextureUnit = 0; + texture[0] = static_cast<const gl::TextureResource&>(resource).texture; + MBGL_CHECK_ERROR(glTexSubImage2D(GL_TEXTURE_2D, 0, + xOffset, yOffset, + size.width, size.height, + Enum<gfx::TexturePixelType>::to(format), + Enum<gfx::TextureChannelDataType>::to(type), data)); +} + + std::unique_ptr<gfx::DrawScopeResource> Context::createDrawScopeResource() { return std::make_unique<gl::DrawScopeResource>(createVertexArray()); } |