Vincent Povirk : gdiplus: Implement CachedBitmap based on Image.

Alexandre Julliard julliard at winehq.org
Mon Nov 24 09:17:05 CST 2008


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

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Fri Nov 21 16:57:48 2008 -0600

gdiplus: Implement CachedBitmap based on Image.

---

 dlls/gdiplus/gdiplus_private.h |    2 +-
 dlls/gdiplus/image.c           |   22 ++++------------------
 2 files changed, 5 insertions(+), 19 deletions(-)

diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h
index 2dde79b..e9cbfa5 100644
--- a/dlls/gdiplus/gdiplus_private.h
+++ b/dlls/gdiplus/gdiplus_private.h
@@ -197,7 +197,7 @@ struct GpBitmap{
 };
 
 struct GpCachedBitmap{
-    GpBitmap *bmp;
+    GpImage *image;
 };
 
 struct GpImageAttributes{
diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c
index e44315a..6e0c468 100644
--- a/dlls/gdiplus/image.c
+++ b/dlls/gdiplus/image.c
@@ -552,7 +552,6 @@ GpStatus WINGDIPAPI GdipCreateCachedBitmap(GpBitmap *bitmap, GpGraphics *graphic
     GpCachedBitmap **cachedbmp)
 {
     GpStatus stat;
-    GpImage *copy;
 
     TRACE("%p %p %p\n", bitmap, graphics, cachedbmp);
 
@@ -562,26 +561,13 @@ GpStatus WINGDIPAPI GdipCreateCachedBitmap(GpBitmap *bitmap, GpGraphics *graphic
     *cachedbmp = GdipAlloc(sizeof(GpCachedBitmap));
     if(!*cachedbmp)
         return OutOfMemory;
-    (*cachedbmp)->bmp = GdipAlloc(sizeof(GpBitmap));
-    if(!(*cachedbmp)->bmp){
-        GdipFree(*cachedbmp);
-        return OutOfMemory;
-    }
 
-    copy = &(*cachedbmp)->bmp->image;
-    stat = GdipCloneImage(&(bitmap->image), &copy);
+    stat = GdipCloneImage(&(bitmap->image), &(*cachedbmp)->image);
     if(stat != Ok){
         GdipFree(*cachedbmp);
         return stat;
     }
 
-    (*cachedbmp)->bmp->width  = bitmap->width;
-    (*cachedbmp)->bmp->height = bitmap->height;
-    (*cachedbmp)->bmp->format = bitmap->format;
-    (*cachedbmp)->bmp->lockmode = 0;
-    (*cachedbmp)->bmp->numlocks = 0;
-    (*cachedbmp)->bmp->bitmapbits = NULL;
-
     return Ok;
 }
 
@@ -592,8 +578,8 @@ GpStatus WINGDIPAPI GdipDeleteCachedBitmap(GpCachedBitmap *cachedbmp)
     if(!cachedbmp)
         return InvalidParameter;
 
-    GdipDisposeImage(&cachedbmp->bmp->image);
-    GdipFree(cachedbmp->bmp);
+    GdipDisposeImage(cachedbmp->image);
+    GdipFree(cachedbmp);
 
     return Ok;
 }
@@ -606,7 +592,7 @@ GpStatus WINGDIPAPI GdipDrawCachedBitmap(GpGraphics *graphics,
     if(!graphics || !cachedbmp)
         return InvalidParameter;
 
-    return GdipDrawImage(graphics, &cachedbmp->bmp->image, (REAL)x, (REAL)y);
+    return GdipDrawImage(graphics, cachedbmp->image, (REAL)x, (REAL)y);
 }
 
 GpStatus WINGDIPAPI GdipDisposeImage(GpImage *image)




More information about the wine-cvs mailing list