Turn off Antialiasing for Rendering with Palette
Glenn Wurster
gwurster at scs.carleton.ca
Thu Oct 14 23:37:42 CDT 2004
Authors:
Doug Paul <doug at elemental.ath.cx>,
Glenn Wurster <gwurster at scs.carleton.ca>
Description:
* When we are working with a palette, we need to disable antialiasing.
Antialiasing results in a lot of extra colour values which are not
mapped in the palette, causing bad display artifacts.
Changelog:
* Disable antialiasing when working with the palette
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/xrender.c,v
retrieving revision 1.47
diff -u -u -r1.47 xrender.c
--- dlls/x11drv/xrender.c 11 Aug 2004 23:45:34 -0000 1.47
+++ dlls/x11drv/xrender.c 29 Sep 2004 04:46:49 -0000
@@ -981,10 +981,38 @@
HRGN saved_region = 0;
UINT align = GetTextAlign( hdc );
COLORREF textColor = GetTextColor( hdc );
-
+ BOOL antialias_disabled = FALSE;
+ AA_Type backup_aa = AA_None;
+
+ textColor = X11DRV_PALETTE_ToPhysical( physDev, textColor );
+ textColor = ((textColor & 0xFF0000) >> 16) |
+ (textColor & 0xFF00) |
+ ((textColor & 0xFF) << 16);
+
TRACE("%p, %d, %d, %08x, %p, %s, %d, %p)\n", hdc, x, y, flags,
lprect, debugstr_wn(wstr, count), count, lpDx);
+ do {
+ BITMAPOBJ *bmp;
+ HBITMAP hBitmap;
+
+ hBitmap = GetCurrentObject( physDev->hdc, OBJ_BITMAP );
+ bmp = (BITMAPOBJ *)GDI_GetObjPtr( hBitmap, BITMAP_MAGIC );
+ if (!(bmp && bmp->dib)) {
+ TRACE("bitmap is not a DIB\n");
+ GDI_ReleaseObj( hBitmap );
+ break;
+ }
+
+ if (bmp->dib->dsBmih.biBitCount <= 8 && antialias) {
+ TRACE("Disabling antialiasing\n");
+ antialias = 0;
+ antialias_disabled = TRUE;
+ }
+
+ GDI_ReleaseObj( hBitmap );
+ } while (0);
+
if(flags & ETO_GLYPH_INDEX)
glyphs = (LPWORD)wstr;
else {
@@ -1020,7 +1048,7 @@
if(flags & (ETO_CLIPPED | ETO_OPAQUE)) {
if(!lprect) {
- if(flags & ETO_CLIPPED) return FALSE;
+ if(flags & ETO_CLIPPED) { retv = FALSE; goto done2; }
GetTextExtentPointI(hdc, glyphs, count, &sz);
done_extents = TRUE;
rc.left = x;
@@ -1267,6 +1295,10 @@
EnterCriticalSection(&xrender_cs);
entry = glyphsetCache + physDev->xrender->cache_index;
+ if (antialias_disabled) {
+ backup_aa = entry->aa;
+ entry->aa = AA_None;
+ }
for(idx = 0; idx < count; idx++) {
if(glyphs[idx] >= entry->nrealized || entry->realized[glyphs[idx]] == FALSE) {
@@ -1274,6 +1306,9 @@
}
}
+ if (antialias_disabled) {
+ entry->aa = backup_aa;
+ }
TRACE("Writing %s at %ld,%ld\n", debugstr_wn(wstr,count),
physDev->org.x + x, physDev->org.y + y);
@@ -1516,6 +1551,8 @@
done:
X11DRV_UnlockDIBSection( physDev, TRUE );
if(glyphs != wstr) HeapFree(GetProcessHeap(), 0, glyphs);
+done2:
+ if (antialias_disabled == TRUE) antialias = 1;
return retv;
}
More information about the wine-patches
mailing list