mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-28 18:45:54 -05:00
Fixed issue #149.
This commit is contained in:
parent
506efdc072
commit
c627e55451
1 changed files with 7 additions and 3 deletions
|
@ -773,13 +773,17 @@ namespace
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int glnvg__allocVerts(struct GLNVGcontext* gl, int n)
|
static int glnvg__allocVerts(GLNVGcontext* gl, int n)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
if (gl->nverts+n > gl->cverts)
|
if (gl->nverts+n > gl->cverts)
|
||||||
{
|
{
|
||||||
gl->cverts = gl->cverts == 0 ? glnvg__maxi(n, 256) : gl->cverts * 2;
|
NVGvertex* verts;
|
||||||
gl->verts = (struct NVGvertex*)realloc(gl->verts, sizeof(struct NVGvertex) * gl->cverts);
|
int cverts = glnvg__maxi(gl->nverts + n, 4096) + gl->cverts/2; // 1.5x Overallocate
|
||||||
|
verts = (NVGvertex*)realloc(gl->verts, sizeof(NVGvertex) * cverts);
|
||||||
|
if (verts == NULL) return -1;
|
||||||
|
gl->verts = verts;
|
||||||
|
gl->cverts = cverts;
|
||||||
}
|
}
|
||||||
ret = gl->nverts;
|
ret = gl->nverts;
|
||||||
gl->nverts += n;
|
gl->nverts += n;
|
||||||
|
|
Loading…
Reference in a new issue