Disable antialiasing in palette mode (updated)

Jakob Eriksson jakov at vmlinux.org
Wed Jan 26 03:22:22 CST 2005


I'm just a peon but wouldn't it be better for the ReactOS project if
you put the code in gdi instead?

They have to solve it someplace else anyway, since they don't have x11drv.

Glenn Wurster wrote:

>This is an updated patch based on Alexandre's comments.  It uses
>GetObjectW instead of GDI_GetObjPtr.
>
>Description: 
>
>According to the docs for CreateFont:
>
>"Windows 95 with Plus!, Windows 98/Me: The display must greater than
>8-bit color, it must be a single plane device, it cannot be a palette
>display, and it cannot be in a multiple display monitor setup. In
>addition, you must select a TrueType font into a screen DC prior to
>using it in a DIBSection, otherwise antialiasing does not happen."
>
>Windows 2000 has been tested and it also does not antialias fonts when
>writing into an 8 bit DIB.
>
>This patch disables antialiasing when a palette is involved.  You've
>seen this before in previous incarnations.  The docs specify to
>disable antialiasing and I've got an application which depends on
>antialiasing being disabled.  I've tried putting the change in the gdi
>code, as well as in the x11drv code.  I think it looks cleaner in the
>x11drv code (no change to function prototypes) so that's where this
>attempts to put it (with the caching split off into a different patch
>this time).
>
>Author:
>  * Glenn Wurster (gwurster at scs.carleton.ca)
>
>Changelog:
>  * Disable antialiasing of fonts while working in a palette.
>
>Index: dlls/x11drv/xrender.c
>===================================================================
>RCS file: /home/wine/wine/dlls/x11drv/xrender.c,v
>retrieving revision 1.56
>diff -u -r1.56 xrender.c
>--- dlls/x11drv/xrender.c	24 Jan 2005 19:32:54 -0000	1.56
>+++ dlls/x11drv/xrender.c	26 Jan 2005 04:15:27 -0000
>@@ -1013,6 +1013,25 @@
>     INT *deltas = NULL, char_extra;
>     HRGN saved_region = 0;
>     UINT align = GetTextAlign( hdc );
>+    BOOL disable_antialias = FALSE;
>+    AA_Type antialias = AA_None;
>+
>+    /* Do we need to disable antialiasing because of palette mode? */
>+    do {
>+       HBITMAP hBitmap;
>+       DIBSECTION bmp;
>+
>+       hBitmap = GetCurrentObject( physDev->hdc, OBJ_BITMAP );
>+       if( GetObjectW( hBitmap, sizeof(bmp), &bmp ) != sizeof(bmp) ) {
>+           TRACE("bitmap is not a DIB\n");
>+           break;
>+       }
>+
>+       if (bmp.dsBmih.biBitCount <= 8) {
>+           TRACE("Disabling antialiasing\n");
>+           disable_antialias = TRUE;
>+       }
>+    } while (0);
> 
>     TRACE("%p, %d, %d, %08x, %p, %s, %d, %p)\n", hdc, x, y, flags,
> 	  lprect, debugstr_wn(wstr, count), count, lpDx);
>@@ -1307,14 +1326,16 @@
> 
>     EnterCriticalSection(&xrender_cs);
>     entry = glyphsetCache + physDev->xrender->cache_index;
>-    formatEntry = entry->format[entry->aa_default];
>+    if( disable_antialias == FALSE )
>+        antialias = entry->aa_default;
>+    formatEntry = entry->format[antialias];
> 
>     for(idx = 0; idx < count; idx++) {
>         if( !formatEntry ) {
>-	    UploadGlyph(physDev, glyphs[idx], entry->aa_default);
>-            formatEntry = entry->format[entry->aa_default];
>+	    UploadGlyph(physDev, glyphs[idx], antialias);
>+            formatEntry = entry->format[antialias];
>         } else if( glyphs[idx] >= formatEntry->nrealized || formatEntry->realized[glyphs[idx]] == FALSE) {
>-	    UploadGlyph(physDev, glyphs[idx], entry->aa_default);
>+	    UploadGlyph(physDev, glyphs[idx], antialias);
> 	}
>     }
>     assert(formatEntry);
>@@ -1354,7 +1375,7 @@
>         wine_tsx11_lock();
> 	XSetForeground( gdi_display, physDev->gc, textPixel );
> 
>-	if(entry->aa_default == AA_None) {
>+	if(antialias == AA_None) {
> 	    for(idx = 0; idx < count; idx++) {
> 	        SharpGlyphMono(physDev, physDev->org.x + x + xoff,
> 			       physDev->org.y + y + yoff,
>  
>




More information about the wine-devel mailing list