|
|
|
@@ -28,7 +28,7 @@ |
|
|
|
#ifndef NVG_NO_STB |
|
|
|
#define STB_IMAGE_IMPLEMENTATION |
|
|
|
#include "stb_image.h" |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
#ifdef _MSC_VER |
|
|
|
#pragma warning(disable: 4100) // unreferenced formal parameter |
|
|
|
@@ -396,6 +396,7 @@ void nvgEndFrame(NVGcontext* ctx) |
|
|
|
ctx->params.renderFlush(ctx->params.userPtr); |
|
|
|
if (ctx->fontImageIdx != 0) { |
|
|
|
int fontImage = ctx->fontImages[ctx->fontImageIdx]; |
|
|
|
ctx->fontImages[ctx->fontImageIdx] = 0; |
|
|
|
int i, j, iw, ih; |
|
|
|
// delete images that smaller than current one |
|
|
|
if (fontImage == 0) |
|
|
|
@@ -404,20 +405,19 @@ void nvgEndFrame(NVGcontext* ctx) |
|
|
|
for (i = j = 0; i < ctx->fontImageIdx; i++) { |
|
|
|
if (ctx->fontImages[i] != 0) { |
|
|
|
int nw, nh; |
|
|
|
nvgImageSize(ctx, ctx->fontImages[i], &nw, &nh); |
|
|
|
int image = ctx->fontImages[i]; |
|
|
|
ctx->fontImages[i] = 0; |
|
|
|
nvgImageSize(ctx, image, &nw, &nh); |
|
|
|
if (nw < iw || nh < ih) |
|
|
|
nvgDeleteImage(ctx, ctx->fontImages[i]); |
|
|
|
nvgDeleteImage(ctx, image); |
|
|
|
else |
|
|
|
ctx->fontImages[j++] = ctx->fontImages[i]; |
|
|
|
ctx->fontImages[j++] = image; |
|
|
|
} |
|
|
|
} |
|
|
|
// make current font image to first |
|
|
|
ctx->fontImages[j++] = ctx->fontImages[0]; |
|
|
|
ctx->fontImages[j] = ctx->fontImages[0]; |
|
|
|
ctx->fontImages[0] = fontImage; |
|
|
|
ctx->fontImageIdx = 0; |
|
|
|
// clear all images after j |
|
|
|
for (i = j; i < NVG_MAX_FONTIMAGES; i++) |
|
|
|
ctx->fontImages[i] = 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|