summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Lauffenburger <[email protected]>2017-07-06 09:27:00 -0600
committerBrian Paul <[email protected]>2017-07-06 17:26:05 -0600
commit43dea65ad2e8259330849aa7a3e1ed86db5a5d0f (patch)
treed8109de46e697f43610138fc56138b0fc87e7700
parent80c6598cdba36edb43d618f97175103e560d61a1 (diff)
st/wgl: Implement wglUseFontBitmaps.
wglUseFontBitmaps is currently a noop. This patch implements this function for Windows. Misc code clean-ups by Brian. Signed-off-by: Olivier Lauffenburger <[email protected]> Reviewed-by: Brian Paul <[email protected]>
-rw-r--r--src/gallium/state_trackers/wgl/stw_wgl.c65
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