gdiplus: Added CachedBitmap calls.

oldstable
Nikolay Sivov 2008-11-04 08:54:32 +03:00 committed by Alexandre Julliard
parent 7051bf5e22
commit 1cca99dc23
4 changed files with 70 additions and 3 deletions

View File

@ -81,7 +81,7 @@
@ stdcall GdipCreateBitmapFromScan0(long long long long ptr ptr)
@ stdcall GdipCreateBitmapFromStream(ptr ptr)
@ stdcall GdipCreateBitmapFromStreamICM(ptr ptr)
@ stub GdipCreateCachedBitmap
@ stdcall GdipCreateCachedBitmap(ptr ptr ptr)
@ stdcall GdipCreateCustomLineCap(ptr ptr long long ptr)
@ stub GdipCreateEffect
@ stdcall GdipCreateFont(ptr long long long ptr)
@ -137,7 +137,7 @@
@ stdcall GdipCreateTextureIA(ptr ptr long long long long ptr)
@ stdcall GdipCreateTextureIAI(ptr ptr long long long long ptr)
@ stdcall GdipDeleteBrush(ptr)
@ stub GdipDeleteCachedBitmap
@ stdcall GdipDeleteCachedBitmap(ptr)
@ stdcall GdipDeleteCustomLineCap(ptr)
@ stub GdipDeleteEffect
@ stdcall GdipDeleteFont(ptr)
@ -158,7 +158,7 @@
@ stdcall GdipDrawBezierI(ptr ptr long long long long long long long long)
@ stdcall GdipDrawBeziers(ptr ptr ptr long)
@ stdcall GdipDrawBeziersI(ptr ptr ptr long)
@ stub GdipDrawCachedBitmap
@ stdcall GdipDrawCachedBitmap(ptr ptr long long)
@ stdcall GdipDrawClosedCurve2(ptr ptr ptr long long)
@ stdcall GdipDrawClosedCurve2I(ptr ptr ptr long long)
@ stdcall GdipDrawClosedCurve(ptr ptr ptr long)

View File

@ -195,6 +195,10 @@ struct GpBitmap{
BYTE *bitmapbits; /* pointer to the buffer we passed in BitmapLockBits */
};
struct GpCachedBitmap{
GpBitmap *bmp;
};
struct GpImageAttributes{
WrapMode wrap;
};

View File

@ -547,6 +547,67 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromStreamICM(IStream* stream,
return GdipCreateBitmapFromStream(stream, bitmap);
}
GpStatus WINGDIPAPI GdipCreateCachedBitmap(GpBitmap *bitmap, GpGraphics *graphics,
GpCachedBitmap **cachedbmp)
{
GpStatus stat;
GpImage *copy;
TRACE("%p %p %p\n", bitmap, graphics, cachedbmp);
if(!bitmap || !graphics || !cachedbmp)
return InvalidParameter;
*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);
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;
}
GpStatus WINGDIPAPI GdipDeleteCachedBitmap(GpCachedBitmap *cachedbmp)
{
TRACE("%p\n", cachedbmp);
if(!cachedbmp)
return InvalidParameter;
GdipDisposeImage(&cachedbmp->bmp->image);
GdipFree(cachedbmp->bmp);
return Ok;
}
GpStatus WINGDIPAPI GdipDrawCachedBitmap(GpGraphics *graphics,
GpCachedBitmap *cachedbmp, INT x, INT y)
{
TRACE("%p %p %d %d\n", graphics, cachedbmp, x, y);
if(!graphics || !cachedbmp)
return InvalidParameter;
return GdipDrawImage(graphics, &cachedbmp->bmp->image, (REAL)x, (REAL)y);
}
GpStatus WINGDIPAPI GdipDisposeImage(GpImage *image)
{
HDC hdc;

View File

@ -32,6 +32,7 @@ class GpAdjustableArrowCap : public GpCustomLineCap {};
class GpImage {};
class GpMetafile : public GpImage {};
class GpImageAttributes {};
class GpCachedBitmap {};
class GpBitmap : public GpImage {};
class GpPathGradient : public GpBrush {};
class GpLineGradient : public GpBrush {};
@ -57,6 +58,7 @@ typedef struct GpAdjustableArrowCap GpAdjustableArrowCap;
typedef struct GpImage GpImage;
typedef struct GpMetafile GpMetafile;
typedef struct GpImageAttributes GpImageAttributes;
typedef struct GpCachedBitmap GpCachedBitmap;
typedef struct GpBitmap GpBitmap;
typedef struct GpPathGradient GpPathGradient;
typedef struct GpLineGradient GpLineGradient;