Browse Source

Passes the device pixel ratio parameter to `renderViewport` function.

This commit updates the `nvgBeginFrame()` function to forward the received `devicePixelRatio` parameter to the `renderViewport()` function so it is possible to configure the environemnt correctly when using `bgfx` backend.
shared-context
Olli Wang 8 years ago
parent
commit
1664a524a7
3 changed files with 3 additions and 3 deletions
  1. +1
    -1
      src/nanovg.c
  2. +1
    -1
      src/nanovg.h
  3. +1
    -1
      src/nanovg_gl.h

+ 1
- 1
src/nanovg.c View File

@@ -295,7 +295,7 @@ void nvgBeginFrame(NVGcontext* ctx, int windowWidth, int windowHeight, float dev

nvg__setDevicePixelRatio(ctx, devicePixelRatio);

ctx->params.renderViewport(ctx->params.userPtr, windowWidth, windowHeight);
ctx->params.renderViewport(ctx->params.userPtr, windowWidth, windowHeight, devicePixelRatio);

ctx->drawCallCount = 0;
ctx->fillTriCount = 0;


+ 1
- 1
src/nanovg.h View File

@@ -588,7 +588,7 @@ struct NVGparams {
int (*renderDeleteTexture)(void* uptr, int image);
int (*renderUpdateTexture)(void* uptr, int image, int x, int y, int w, int h, const unsigned char* data);
int (*renderGetTextureSize)(void* uptr, int image, int* w, int* h);
void (*renderViewport)(void* uptr, int width, int height);
void (*renderViewport)(void* uptr, int width, int height, float devicePixelRatio);
void (*renderCancel)(void* uptr);
void (*renderFlush)(void* uptr);
void (*renderFill)(void* uptr, NVGpaint* paint, NVGscissor* scissor, float fringe, const float* bounds, const NVGpath* paths, int npaths);


+ 1
- 1
src/nanovg_gl.h View File

@@ -941,7 +941,7 @@ static void glnvg__setUniforms(GLNVGcontext* gl, int uniformOffset, int image)
}
}

static void glnvg__renderViewport(void* uptr, int width, int height)
static void glnvg__renderViewport(void* uptr, int width, int height, float devicePixelRatio)
{
GLNVGcontext* gl = (GLNVGcontext*)uptr;
gl->view[0] = (float)width;


Loading…
Cancel
Save