diff --git a/dgl/NanoVG.hpp b/dgl/NanoVG.hpp index a1fab235..a8efefd1 100644 --- a/dgl/NanoVG.hpp +++ b/dgl/NanoVG.hpp @@ -107,6 +107,7 @@ public: */ Size getSize() const noexcept; + void update(const unsigned char* data); /** Get the OpenGL texture handle. */ diff --git a/dgl/src/NanoVG.cpp b/dgl/src/NanoVG.cpp index 80e3f349..4eec2a4b 100644 --- a/dgl/src/NanoVG.cpp +++ b/dgl/src/NanoVG.cpp @@ -272,6 +272,14 @@ Size NanoImage::getSize() const noexcept return fSize; } +void NanoImage::update(const unsigned char* data) +{ + int w, h; + void * uptr = nvgInternalParams(fHandle.context)->userPtr; + glnvg__renderGetTextureSize(uptr, getTextureHandle(), &w, &h); + glnvg__renderUpdateTexture(uptr, getTextureHandle(), 0, 0, w, h, data); +} + GLuint NanoImage::getTextureHandle() const { DISTRHO_SAFE_ASSERT_RETURN(fHandle.context != nullptr && fHandle.imageId != 0, 0);