void SetMat(LPMAT2 lpMat) { lpMat->eM11 = FixedFromDouble(2); lpMat->eM12 = FixedFromDouble(0); lpMat->eM21 = FixedFromDouble(0); lpMat->eM22 = FixedFromDouble(2); }
/**************************************************************************** * FUNCTION : IdentityMat * PURPOSE : Fill in matrix to be the identity matrix. * RETURNS : none. ****************************************************************************/ static void IdentityMat(LPMAT2 lpMat) { lpMat->eM11 = FixedFromDouble(1.0); lpMat->eM12 = FixedFromDouble(0.0); lpMat->eM21 = FixedFromDouble(0.0); lpMat->eM22 = FixedFromDouble(1.0); }
WINGDIAPI BOOL GLAPIENTRY wglUseFontBitmapsA(HDC hdc, DWORD first, DWORD count, DWORD listBase) { int i; GLuint font_list; DWORD size; GLYPHMETRICS gm; HANDLE hBits; LPSTR lpBits; MAT2 mat; int success = TRUE; if (count == 0) return FALSE; font_list = listBase; mat.eM11 = FixedFromDouble(1); mat.eM12 = FixedFromDouble(0); mat.eM21 = FixedFromDouble(0); mat.eM22 = FixedFromDouble(-1); memset(&gm,0,sizeof(gm)); /* ** If we can't get the glyph outline, it may be because this is a fixed ** font. Try processing it that way. */ if( GetGlyphOutline(hdc, first, GGO_BITMAP, &gm, 0, NULL, &mat) == GDI_ERROR ) { return wglUseFontBitmaps_FX( hdc, first, count, listBase ); } /* ** Otherwise process all desired characters. */ for (i = 0; i < (int)count; i++) { DWORD err; glNewList( font_list+i, GL_COMPILE ); /* allocate space for the bitmap/outline */ size = GetGlyphOutline(hdc, first + i, GGO_BITMAP, &gm, 0, NULL, &mat); if (size == GDI_ERROR) { glEndList( ); err = GetLastError(); success = FALSE; continue; } hBits = GlobalAlloc(GHND, size+1); lpBits = GlobalLock(hBits); err = GetGlyphOutline(hdc, /* handle to device context */ first + i, /* character to query */ GGO_BITMAP, /* format of data to return */ &gm, /* ptr to structure for metrics*/ size, /* size of buffer for data */ lpBits, /* pointer to buffer for data */ &mat /* pointer to transformation */ /* matrix structure */ ); if (err == GDI_ERROR) { GlobalUnlock(hBits); GlobalFree(hBits); glEndList( ); err = GetLastError(); success = FALSE; continue; } glBitmap(gm.gmBlackBoxX,gm.gmBlackBoxY, (GLfloat)-gm.gmptGlyphOrigin.x, (GLfloat)gm.gmptGlyphOrigin.y, (GLfloat)gm.gmCellIncX, (GLfloat)gm.gmCellIncY, (const GLubyte * )lpBits); GlobalUnlock(hBits); GlobalFree(hBits); glEndList( ); } return success; }