Browse Source

Better rounding for quantization to remove text rendering jitter

shared-context
Mikko Mononen 11 years ago
parent
commit
336de19a16
2 changed files with 2 additions and 2 deletions
  1. +1
    -1
      example/demo.c
  2. +1
    -1
      src/nanovg.c

+ 1
- 1
example/demo.c View File

@@ -750,7 +750,7 @@ void renderDemo(struct NVGcontext* vg, float mx, float my, float width, float he

nvgSave(vg);
if (blowup) {
// nvgRotate(vg, 3.0f/180.0f*NVG_PI);
nvgRotate(vg, sinf(t*0.3f)*5.0f/180.0f*NVG_PI);
nvgScale(vg, 2.0f, 2.0f);
}



+ 1
- 1
src/nanovg.c View File

@@ -1572,7 +1572,7 @@ void nvgFontFace(struct NVGcontext* ctx, const char* font)

static float nvg__quantize(float a, float d)
{
return ((int)(a / d)) * d;
return ((int)(a / d + 0.5f)) * d;
}

float nvgText(struct NVGcontext* ctx, float x, float y, const char* string, const char* end)


Loading…
Cancel
Save