Alexandre Julliard : winex11: Store the device format in the Xrender info structure.

Alexandre Julliard julliard at winehq.org
Tue Oct 13 10:52:55 CDT 2009


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Oct 13 12:21:53 2009 +0200

winex11: Store the device format in the Xrender info structure.

---

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

diff --git a/dlls/winex11.drv/xrender.c b/dlls/winex11.drv/xrender.c
index 2498668..efced85 100644
--- a/dlls/winex11.drv/xrender.c
+++ b/dlls/winex11.drv/xrender.c
@@ -144,6 +144,7 @@ struct xrender_info
 {
     int                cache_index;
     Picture            pict;
+    const WineXRenderFormat *format;
 };
 
 static gsCacheEntry *glyphsetCache = NULL;
@@ -206,23 +207,6 @@ static CRITICAL_SECTION xrender_cs = { &critsect_debug, -1, 0, 0, 0, 0 };
 #define NATIVE_BYTE_ORDER LSBFirst
 #endif
 
-static struct xrender_info *get_xrender_info(X11DRV_PDEVICE *physDev)
-{
-    if(!physDev->xrender)
-    {
-        physDev->xrender = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*physDev->xrender));
-
-        if(!physDev->xrender)
-        {
-            ERR("Unable to allocate XRENDERINFO!\n");
-            return NULL;
-        }
-        physDev->xrender->cache_index = -1;
-    }
-
-    return physDev->xrender;
-}
-
 static BOOL get_xrender_template(const WineXRenderFormatTemplate *fmt, XRenderPictFormat *templ, unsigned long *mask)
 {
     templ->id = 0;
@@ -495,19 +479,23 @@ static void set_xrender_transformation(Picture src_pict, float xscale, float ysc
 #endif
 }
 
-static Picture create_xrender_picture(Drawable drawable, int depth, ColorShifts *shifts)
+static struct xrender_info *get_xrender_info(X11DRV_PDEVICE *physDev)
 {
-    Picture pict;
-    XRenderPictureAttributes pa;
-    const WineXRenderFormat *fmt = get_xrender_format_from_color_shifts(depth, shifts);
-    if (!fmt) return 0;
+    if(!physDev->xrender)
+    {
+        physDev->xrender = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*physDev->xrender));
 
-    wine_tsx11_lock();
-    pa.subwindow_mode = IncludeInferiors;
-    pict = pXRenderCreatePicture(gdi_display, drawable, fmt->pict_format, CPSubwindowMode, &pa);
-    wine_tsx11_unlock();
+        if(!physDev->xrender)
+        {
+            ERR("Unable to allocate XRENDERINFO!\n");
+            return NULL;
+        }
+        physDev->xrender->cache_index = -1;
+    }
+    if (!physDev->xrender->format)
+        physDev->xrender->format = get_xrender_format_from_color_shifts(physDev->depth, physDev->color_shifts);
 
-    return pict;
+    return physDev->xrender;
 }
 
 static Picture get_xrender_picture(X11DRV_PDEVICE *physDev)
@@ -515,9 +503,15 @@ static Picture get_xrender_picture(X11DRV_PDEVICE *physDev)
     struct xrender_info *info = get_xrender_info(physDev);
     if (!info) return 0;
 
-    if(!info->pict)
+    if (!info->pict && info->format)
     {
-        info->pict = create_xrender_picture(physDev->drawable, physDev->depth, physDev->color_shifts);
+        XRenderPictureAttributes pa;
+
+        wine_tsx11_lock();
+        pa.subwindow_mode = IncludeInferiors;
+        info->pict = pXRenderCreatePicture(gdi_display, physDev->drawable, info->format->pict_format,
+                                           CPSubwindowMode, &pa);
+        wine_tsx11_unlock();
         TRACE("Allocing pict=%lx dc=%p drawable=%08lx\n", info->pict, physDev->hdc, physDev->drawable);
     }
 
@@ -939,7 +933,7 @@ void X11DRV_XRender_UpdateDrawable(X11DRV_PDEVICE *physDev)
     }
     wine_tsx11_unlock();
 
-    return;
+    physDev->xrender->format = NULL;
 }
 
 /************************************************************************




More information about the wine-cvs mailing list