Huw Davies : winex11: Move the code that checks for a colortable based dib to a separate function .

Alexandre Julliard julliard at winehq.org
Mon Jun 6 15:19:10 CDT 2011


Module: wine
Branch: master
Commit: 129021a0ab10e42cec9c16aa8049d229876de290
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=129021a0ab10e42cec9c16aa8049d229876de290

Author: Huw Davies <huw at codeweavers.com>
Date:   Mon Jun  6 12:58:42 2011 +0100

winex11: Move the code that checks for a colortable based dib to a separate function.

---

 dlls/winex11.drv/xrender.c |   24 ++++++++++++++++++------
 1 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/dlls/winex11.drv/xrender.c b/dlls/winex11.drv/xrender.c
index 52e7f25..48ecd22 100644
--- a/dlls/winex11.drv/xrender.c
+++ b/dlls/winex11.drv/xrender.c
@@ -1788,6 +1788,22 @@ static int XRenderErrorHandler(Display *dpy, XErrorEvent *event, void *arg)
     return 1;
 }
 
+/********************************************************************
+ *                   is_dib_with_colortable
+ *
+ * Return TRUE if physdev is backed by a dibsection with <= 8 bits per pixel
+ */
+static inline BOOL is_dib_with_colortable( X11DRV_PDEVICE *physDev )
+{
+    DIBSECTION dib;
+
+    if( physDev->bitmap && GetObjectW( physDev->bitmap->hbitmap, sizeof(dib), &dib ) == sizeof(dib) &&
+        dib.dsBmih.biBitCount <= 8 )
+        return TRUE;
+
+    return FALSE;
+}
+
 /***********************************************************************
  *   X11DRV_XRender_ExtTextOut
  */
@@ -1803,16 +1819,12 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag
     HRGN saved_region = 0;
     BOOL disable_antialias = FALSE;
     AA_Type aa_type = AA_None;
-    DIBSECTION bmp;
     unsigned int idx;
     const WineXRenderFormat *dst_format = get_xrender_format_from_color_shifts(physDev->depth, physDev->color_shifts);
     Picture tile_pict = 0;
 
-    /* Do we need to disable antialiasing because of palette mode? */
-    if( !physDev->bitmap || GetObjectW( physDev->bitmap->hbitmap, sizeof(bmp), &bmp ) != sizeof(bmp) ) {
-        TRACE("bitmap is not a DIB\n");
-    }
-    else if (bmp.dsBmih.biBitCount <= 8) {
+    if(is_dib_with_colortable( physDev ))
+    {
         TRACE("Disabling antialiasing\n");
         disable_antialias = TRUE;
     }




More information about the wine-cvs mailing list