Alexandre Julliard : gdi32: Add a helper function to determine anti-aliasing flags.
Alexandre Julliard
julliard at winehq.org
Mon Nov 21 11:10:08 CST 2011
Module: wine
Branch: master
Commit: 1b63d5a6101ee9d8fb27726c0cabc4d15e81cf30
URL: http://source.winehq.org/git/wine.git/?a=commit;h=1b63d5a6101ee9d8fb27726c0cabc4d15e81cf30
Author: Alexandre Julliard <julliard at winehq.org>
Date: Thu Nov 17 12:01:58 2011 +0100
gdi32: Add a helper function to determine anti-aliasing flags.
---
dlls/gdi32/dibdrv/graphics.c | 22 +++++-----------------
dlls/gdi32/font.c | 19 +++++++++++++++++++
dlls/gdi32/gdi_private.h | 3 +++
3 files changed, 27 insertions(+), 17 deletions(-)
diff --git a/dlls/gdi32/dibdrv/graphics.c b/dlls/gdi32/dibdrv/graphics.c
index 0e55af1..3a9880d 100644
--- a/dlls/gdi32/dibdrv/graphics.c
+++ b/dlls/gdi32/dibdrv/graphics.c
@@ -157,19 +157,6 @@ static void draw_glyph( dibdrv_physdev *pdev, const POINT *origin, const GLYPHME
release_wine_region( pdev->clip );
}
-static inline UINT get_aa_flags( dibdrv_physdev *pdev )
-{
- LOGFONTW lf;
-
- if (pdev->dib.bit_count <= 8) return GGO_BITMAP;
-
- GetObjectW( GetCurrentObject( pdev->dev.hdc, OBJ_FONT ), sizeof(lf), &lf );
- if (lf.lfQuality == NONANTIALIASED_QUALITY) return GGO_BITMAP;
-
- /* FIXME, check gasp and user prefs */
- return GGO_GRAY4_BITMAP;
-}
-
static const BYTE masks[8] = {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01};
static const int padding[4] = {0, 3, 2, 1};
@@ -181,10 +168,10 @@ static const int padding[4] = {0, 3, 2, 1};
* For non-antialiased bitmaps convert them to the 17-level format
* using only values 0 or 16.
*/
-static DWORD get_glyph_bitmap( dibdrv_physdev *pdev, UINT index, GLYPHMETRICS *metrics,
+static DWORD get_glyph_bitmap( dibdrv_physdev *pdev, UINT index, UINT aa_flags, GLYPHMETRICS *metrics,
struct gdi_image_bits *image )
{
- UINT aa_flags = get_aa_flags( pdev ), ggo_flags = aa_flags | GGO_GLYPH_INDEX;
+ UINT ggo_flags = aa_flags | GGO_GLYPH_INDEX;
static const MAT2 identity = { {0,1}, {0,0}, {0,0}, {0,1} };
UINT indices[3] = {0, 0, 0x20};
int i, x, y;
@@ -253,7 +240,7 @@ BOOL dibdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
const RECT *rect, LPCWSTR str, UINT count, const INT *dx )
{
dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
- UINT i;
+ UINT aa_flags, i;
POINT origin;
DWORD err;
HRGN saved_clip = NULL;
@@ -274,6 +261,7 @@ BOOL dibdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
DeleteObject( clip );
}
+ aa_flags = get_font_aa_flags( dev->hdc );
origin.x = x;
origin.y = y;
for (i = 0; i < count; i++)
@@ -281,7 +269,7 @@ BOOL dibdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
GLYPHMETRICS metrics;
struct gdi_image_bits image;
- err = get_glyph_bitmap( pdev, (UINT)str[i], &metrics, &image );
+ err = get_glyph_bitmap( pdev, (UINT)str[i], aa_flags, &metrics, &image );
if (err) continue;
if (image.ptr) draw_glyph( pdev, &origin, &metrics, &image );
diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index ee824f0..60e04c5 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -258,6 +258,25 @@ static void FONT_NewTextMetricExWToA(const NEWTEXTMETRICEXW *ptmW, NEWTEXTMETRIC
}
+UINT get_font_aa_flags( HDC hdc )
+{
+ LOGFONTW lf;
+
+ if (GetObjectType( hdc ) == OBJ_MEMDC)
+ {
+ BITMAP bm;
+ GetObjectW( GetCurrentObject( hdc, OBJ_BITMAP ), sizeof(bm), &bm );
+ if (bm.bmBitsPixel <= 8) return GGO_BITMAP;
+ }
+ else if (GetDeviceCaps( hdc, BITSPIXEL ) <= 8) return GGO_BITMAP;
+
+ GetObjectW( GetCurrentObject( hdc, OBJ_FONT ), sizeof(lf), &lf );
+ if (lf.lfQuality == NONANTIALIASED_QUALITY) return GGO_BITMAP;
+
+ /* FIXME, check gasp and user prefs */
+ return GGO_GRAY4_BITMAP;
+}
+
/***********************************************************************
* GdiGetCodePage (GDI32.@)
*/
diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h
index d8a793f..70dc521 100644
--- a/dlls/gdi32/gdi_private.h
+++ b/dlls/gdi32/gdi_private.h
@@ -278,6 +278,9 @@ extern BOOL DRIVER_GetDriverName( LPCWSTR device, LPWSTR driver, DWORD size ) DE
/* enhmetafile.c */
extern HENHMETAFILE EMF_Create_HENHMETAFILE(ENHMETAHEADER *emh, BOOL on_disk ) DECLSPEC_HIDDEN;
+/* font.c */
+extern UINT get_font_aa_flags( HDC hdc ) DECLSPEC_HIDDEN;
+
/* freetype.c */
/* Undocumented structure filled in by GdiRealizationInfo */
More information about the wine-cvs
mailing list