diff options
-rw-r--r-- | src/gallium/state_trackers/wgl/stw_wgl.c | 65 |
1 files changed, 49 insertions, 16 deletions
diff --git a/src/gallium/state_trackers/wgl/stw_wgl.c b/src/gallium/state_trackers/wgl/stw_wgl.c index de4b4f6f3b0..532a5adb955 100644 --- a/src/gallium/state_trackers/wgl/stw_wgl.c +++ b/src/gallium/state_trackers/wgl/stw_wgl.c @@ -214,14 +214,7 @@ wglUseFontBitmapsA( DWORD count, DWORD listBase ) { - (void) hdc; - (void) first; - (void) count; - (void) listBase; - - assert( 0 ); - - return FALSE; + return wglUseFontBitmapsW(hdc, first, count, listBase); } WINGDIAPI BOOL APIENTRY @@ -240,14 +233,54 @@ wglUseFontBitmapsW( DWORD count, DWORD listBase ) { - (void) hdc; - (void) first; - (void) count; - (void) listBase; - - assert( 0 ); - - return FALSE; + GLYPHMETRICS gm; + MAT2 tra; + FIXED one, minus_one, zero; + void *buffer = NULL; + BOOL result = TRUE; + + one.value = 1; + one.fract = 0; + minus_one.value = -1; + minus_one.fract = 0; + zero.value = 0; + zero.fract = 0; + + tra.eM11 = one; + tra.eM22 = minus_one; + tra.eM12 = tra.eM21 = zero; + + for (int i = 0; i < count; i++) { + DWORD size = GetGlyphOutline(hdc, first + i, GGO_BITMAP, &gm, 0, + NULL, &tra); + + glNewList(listBase + i, GL_COMPILE); + + if (size != GDI_ERROR) { + if (size == 0) { + glBitmap(0, 0, -gm.gmptGlyphOrigin.x, gm.gmptGlyphOrigin.y, + gm.gmCellIncX, gm.gmCellIncY, NULL); + } + else { + buffer = realloc(buffer, size); + size = GetGlyphOutline(hdc, first + i, GGO_BITMAP, &gm, + size, buffer, &tra); + + glBitmap(gm.gmBlackBoxX, gm.gmBlackBoxY, + -gm.gmptGlyphOrigin.x, gm.gmptGlyphOrigin.y, + gm.gmCellIncX, gm.gmCellIncY, buffer); + } + } + else { + result = FALSE; + } + + glEndList(); + } + + free(buffer); + + return result; } WINGDIAPI BOOL APIENTRY |