Browse Source

Fixes the type of view size.

This commit changes the type of the view size accepted by `nvgRenderFrame()` from `int` to `float` so it matches the type defined in `GLNVGcontext`. This would prevent a framebuffer missing a pixel in final rendering result.
shared-context
Olli Wang 7 years ago
parent
commit
6b6e3a5246
3 changed files with 6 additions and 6 deletions
  1. +1
    -1
      src/nanovg.c
  2. +2
    -2
      src/nanovg.h
  3. +3
    -3
      src/nanovg_gl.h

+ 1
- 1
src/nanovg.c View File

@@ -363,7 +363,7 @@ void nvgDeleteInternal(NVGcontext* ctx)
free(ctx); free(ctx);
} }


void nvgBeginFrame(NVGcontext* ctx, int windowWidth, int windowHeight, float devicePixelRatio)
void nvgBeginFrame(NVGcontext* ctx, float windowWidth, float windowHeight, float devicePixelRatio)
{ {
/* printf("Tris: draws:%d fill:%d stroke:%d text:%d TOT:%d\n", /* printf("Tris: draws:%d fill:%d stroke:%d text:%d TOT:%d\n",
ctx->drawCallCount, ctx->fillTriCount, ctx->strokeTriCount, ctx->textTriCount, ctx->drawCallCount, ctx->fillTriCount, ctx->strokeTriCount, ctx->textTriCount,


+ 2
- 2
src/nanovg.h View File

@@ -152,7 +152,7 @@ enum NVGimageFlags {
// For example, GLFW returns two dimension for an opened window: window size and // For example, GLFW returns two dimension for an opened window: window size and
// frame buffer size. In that case you would set windowWidth/Height to the window size // frame buffer size. In that case you would set windowWidth/Height to the window size
// devicePixelRatio to: frameBufferWidth / windowWidth. // devicePixelRatio to: frameBufferWidth / windowWidth.
void nvgBeginFrame(NVGcontext* ctx, int windowWidth, int windowHeight, float devicePixelRatio);
void nvgBeginFrame(NVGcontext* ctx, float windowWidth, float windowHeight, float devicePixelRatio);


// Cancels drawing the current frame. // Cancels drawing the current frame.
void nvgCancelFrame(NVGcontext* ctx); void nvgCancelFrame(NVGcontext* ctx);
@@ -653,7 +653,7 @@ struct NVGparams {
int (*renderDeleteTexture)(void* uptr, int image); 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 (*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); int (*renderGetTextureSize)(void* uptr, int image, int* w, int* h);
void (*renderViewport)(void* uptr, int width, int height, float devicePixelRatio);
void (*renderViewport)(void* uptr, float width, float height, float devicePixelRatio);
void (*renderCancel)(void* uptr); void (*renderCancel)(void* uptr);
void (*renderFlush)(void* uptr); void (*renderFlush)(void* uptr);
void (*renderFill)(void* uptr, NVGpaint* paint, NVGcompositeOperationState compositeOperation, NVGscissor* scissor, float fringe, const float* bounds, const NVGpath* paths, int npaths); void (*renderFill)(void* uptr, NVGpaint* paint, NVGcompositeOperationState compositeOperation, NVGscissor* scissor, float fringe, const float* bounds, const NVGpath* paths, int npaths);


+ 3
- 3
src/nanovg_gl.h View File

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


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


static void glnvg__fill(GLNVGcontext* gl, GLNVGcall* call) static void glnvg__fill(GLNVGcontext* gl, GLNVGcall* call)


Loading…
Cancel
Save