DPF

DISTRHO Plugin Framework
Log | Files | Refs | Submodules | README | LICENSE

commit 8d8af85953661c305c96610b7106bb87112357dd
parent 3bebc57983052ffc2ba578eeeb6d811f0b278da9
Author: falkTX <falktx@gmail.com>
Date:   Tue, 27 May 2014 14:15:09 +0100

Add NanoVG::beginFrame(Widget*) for convenience

Diffstat:
Mdgl/NanoVG.hpp | 5+++++
Mdgl/src/NanoVG.cpp | 9+++++++++
2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/dgl/NanoVG.hpp b/dgl/NanoVG.hpp @@ -299,6 +299,11 @@ public: void beginFrame(int width, int height, float scaleFactor = 1.0f, Alpha alpha = PREMULTIPLIED_ALPHA); /** + Begin drawing a new frame inside a widget. + */ + void beginFrame(Widget* widget); + + /** Ends drawing flushing remaining render state. */ void endFrame(); diff --git a/dgl/src/NanoVG.cpp b/dgl/src/NanoVG.cpp @@ -15,6 +15,7 @@ */ #include "../NanoVG.hpp" +#include "../Window.hpp" // ----------------------------------------------------------------------- @@ -182,6 +183,14 @@ void NanoVG::beginFrame(int width, int height, float scaleFactor, Alpha alpha) nvgBeginFrame(fContext, width, height, scaleFactor, static_cast<NVGalpha>(alpha)); } +void NanoVG::beginFrame(Widget* widget) +{ + DISTRHO_SAFE_ASSERT_RETURN(widget != nullptr,); + + Window& window(widget->getParentWindow()); + nvgBeginFrame(fContext, window.getWidth(), window.getHeight(), 1.0f, NVG_PREMULTIPLIED_ALPHA); +} + void NanoVG::endFrame() { nvgEndFrame(fContext);