Browse Source

NanoVG: Add constructor with custom atlas size

gh-pages
falkTX 9 years ago
parent
commit
fb2966126a
2 changed files with 13 additions and 1 deletions
  1. +7
    -1
      dgl/NanoVG.hpp
  2. +6
    -0
      dgl/src/NanoVG.cpp

+ 7
- 1
dgl/NanoVG.hpp View File

@@ -256,9 +256,15 @@ public:

/**
Constructor.
Uses 512x512 as default atlas size.
*/
NanoVG();

/**
Constructor using custom atlas size.
*/
NanoVG(int atlasWidth, int atlasHeight);

/**
Destructor.
*/
@@ -780,7 +786,7 @@ protected:
private:
/**
Widget display function.
Implemented internally to wrap begine/endFrame() automaticaly.
Implemented internally to wrap begin/endFrame() automaticaly.
*/
void onDisplay() override
{


+ 6
- 0
dgl/src/NanoVG.cpp View File

@@ -128,6 +128,12 @@ NanoVG::NanoVG()
DISTRHO_SAFE_ASSERT_RETURN(fContext != nullptr,);
}

NanoVG::NanoVG(int atlasWidth, int atlasHeight)
: fContext(nvgCreateGL(atlasWidth, atlasHeight, NVG_ANTIALIAS))
{
DISTRHO_SAFE_ASSERT_RETURN(fContext != nullptr,);
}

NanoVG::~NanoVG()
{
if (fContext == nullptr)


Loading…
Cancel
Save