static DWORD VertBufIndex;
static GLenum TessErrorOccurred;
-
-/*****************************************************************************
-* InitLineBuf
-*
-* Initializes the global LineBuf and its associated size and current-element
-* counters.
-*****************************************************************************/
-
-INT InitLineBuf(VOID)
-{
- if (!(LineBuf = (FLOAT*)
- HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (LineBufSize = LINE_BUF_QUANT) * sizeof(FLOAT))))
- return 0;
- LineBufIndex = 0;
- return 1;
-}
-
-/*****************************************************************************
-* InitVertBuf
-*
-* Initializes the global VertBuf and its associated size and current-element
-* counters.
-*****************************************************************************/
-
-INT InitVertBuf(VOID)
-{
- if (!(VertBuf = (FLOAT*)
- HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (VertBufSize = VERT_BUF_QUANT) * sizeof(FLOAT))))
- return 0;
- VertBufIndex = 0;
- return 1;
-}
-
/*****************************************************************************
* AppendToLineBuf
*
if (LineBufIndex >= LineBufSize)
{
FLOAT* f;
+ LineBufSize += LINE_BUF_QUANT;
- f = (FLOAT*) HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, LineBuf, (LineBufSize += LINE_BUF_QUANT) * sizeof(FLOAT));
+ f = (FLOAT*) HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, LineBuf, (LineBufSize) * sizeof(FLOAT));
if (!f)
return 0;
LineBuf = f;
return 1;
}
-/*****************************************************************************
-* FreeLineBuf
-*
-* Cleans up vertex buffer structure.
-*****************************************************************************/
-
-VOID FreeLineBuf(VOID)
-{
- if (LineBuf)
- {
- HeapFree(GetProcessHeap(), 0, LineBuf);
- LineBuf = NULL;
- }
-}
-
-/*****************************************************************************
-* FreeVertBuf
-*
-* Cleans up vertex buffer structure.
-*****************************************************************************/
-
-VOID FreeVertBuf(VOID)
-{
- if (VertBuf)
- {
- HeapFree(GetProcessHeap(), 0, VertBuf);
- VertBuf = NULL;
- }
-}
-
/*****************************************************************************
* GetWord
*
/*
* Initialize the global buffer into which we place the outlines:
*/
- if (!InitLineBuf())
+ LineBuf = (FLOAT*) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (LINE_BUF_QUANT) * sizeof(FLOAT));
+
+ if(!LineBuf)
goto exit;
+ LineBufSize = LINE_BUF_QUANT;
+ LineBufIndex = 0;
+
/*
* Convert the glyph outlines to a set of polyline loops.
* (See MakeLinesFromGlyph() for the format of the loop data
* auxiliary routines for drawing.
*/
- if (!InitVertBuf())
+ VertBuf = (FLOAT*) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (VERT_BUF_QUANT) * sizeof(FLOAT));
+
+ if (!VertBuf)
goto exit;
+
+ VertBufSize = VERT_BUF_QUANT;
+ VertBufIndex = 0;
+
if (!(tess = gluNewTess()))
goto exit;
exit:
- FreeLineBuf();
+
+ if(LineBuf)
+ HeapFree(GetProcessHeap(), 0, LineBuf);
+
+ if(VertBuf)
+ HeapFree(GetProcessHeap(), 0, VertBuf);
+
if (tess)
gluDeleteTess(tess);
- FreeVertBuf();
return status;
}