[PATCH] wineps.drv: Add a simple implementation of PSDRV_SelectBitmap.

Lei Zhang thestig at google.com
Fri Jan 23 16:36:01 CST 2009


Hi,

This fixes bug 17103 for me. I'm not sure if PSDRV_SelectBitmap() need
to do more, but this is a start and it's better than a stub.
-------------- next part --------------
From 4347850fb3e3fe924e90f4810564c781e62cd387 Mon Sep 17 00:00:00 2001
From: Lei Zhang <thestig at google.com>
Date: Fri, 23 Jan 2009 14:32:33 -0800
Subject: [PATCH] wineps.drv: Add a simple implementation of PSDRV_SelectBitmap.

---
 dlls/wineps.drv/init.c    |    4 ++++
 dlls/wineps.drv/objects.c |   13 +++++++++++--
 dlls/wineps.drv/psdrv.h   |    1 +
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/dlls/wineps.drv/init.c b/dlls/wineps.drv/init.c
index 61e31d8..092bdb0 100644
--- a/dlls/wineps.drv/init.c
+++ b/dlls/wineps.drv/init.c
@@ -343,6 +343,10 @@ BOOL PSDRV_CreateDC( HDC hdc, PSDRV_PDEVICE **pdev, LPCWSTR driver, LPCWSTR devi
     if (!physDev) return FALSE;
     *pdev = physDev;
     physDev->hdc = hdc;
+    if (GetObjectType( hdc ) == OBJ_MEMDC)
+        physDev->bitmap = GetCurrentObject( hdc, OBJ_BITMAP );
+    else
+        physDev->bitmap = NULL;
 
     physDev->pi = pi;
 
diff --git a/dlls/wineps.drv/objects.c b/dlls/wineps.drv/objects.c
index 274e7f9..8c187d6 100644
--- a/dlls/wineps.drv/objects.c
+++ b/dlls/wineps.drv/objects.c
@@ -28,6 +28,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(psdrv);
  */
 HBITMAP PSDRV_SelectBitmap( PSDRV_PDEVICE *physDev, HBITMAP hbitmap )
 {
-    FIXME("stub\n");
-    return 0;
+    HBITMAP old_bitmap;
+    BITMAP bitmap;
+
+    FIXME("semi-stub\n");
+
+    if (!GetObjectW( hbitmap, sizeof(bitmap), &bitmap )) return 0;
+
+    old_bitmap = physDev->bitmap;
+    physDev->bitmap = hbitmap;
+
+    return old_bitmap;
 }
diff --git a/dlls/wineps.drv/psdrv.h b/dlls/wineps.drv/psdrv.h
index fcdc78d..f3dbc21 100644
--- a/dlls/wineps.drv/psdrv.h
+++ b/dlls/wineps.drv/psdrv.h
@@ -346,6 +346,7 @@ typedef struct {
 
 typedef struct {
     HDC                 hdc;
+    HBITMAP             bitmap;
     PSFONT		font;		/* Current PS font */
     DOWNLOAD            *downloaded_fonts;
     PSPEN		pen;
-- 
1.5.4.3


More information about the wine-patches mailing list