[2/2] gdiplus: GdipDrawImageRect/GdipDrawImageRectI

Nikolay Sivov bunglehead at gmail.com
Thu Apr 24 16:58:36 CDT 2008


Changelog:
    - implemented GdipDrawImageRect/GdipDrawImageRectI
    - imageAttributes could be NULL in GdipDrawImagePointsRect (it's a default value)

---
 dlls/gdiplus/gdiplus.spec |    4 ++--
 dlls/gdiplus/graphics.c   |   27 ++++++++++++++++++++++++++-
 include/gdiplusflat.h     |    2 ++
 3 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec
index 9fdd4be..bdead36 100644
--- a/dlls/gdiplus/gdiplus.spec
+++ b/dlls/gdiplus/gdiplus.spec
@@ -181,8 +181,8 @@
 @ stub GdipDrawImagePointsI
 @ stdcall GdipDrawImagePointsRect(ptr ptr ptr long long long long long long ptr ptr ptr)
 @ stub GdipDrawImagePointsRectI
-@ stub GdipDrawImageRect
-@ stub GdipDrawImageRectI
+@ stdcall GdipDrawImageRect(ptr ptr long long long long)
+@ stdcall GdipDrawImageRectI(ptr ptr long long long long)
 @ stdcall GdipDrawImageRectRect(ptr ptr long long long long long long long long long ptr long ptr)
 @ stdcall GdipDrawImageRectRectI(ptr ptr long long long long long long long long long ptr long ptr)
 @ stdcall GdipDrawLine(ptr ptr long long long long)
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index ef57def..b8a2efa 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -1100,7 +1100,7 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
           srcx, srcy, srcwidth, srcheight, srcUnit, imageAttributes, callback,
           callbackData);
 
-    if(!graphics || !image || !points || !imageAttributes || count != 3)
+    if(!graphics || !image || !points || count != 3)
          return InvalidParameter;
 
     if(srcUnit == UnitInch)
@@ -1177,6 +1177,31 @@ GpStatus WINGDIPAPI GdipDrawImageRectRectI(GpGraphics *graphics, GpImage *image,
                srcwidth, srcheight, srcUnit, imageAttributes, callback, callbackData);
 }
 
+GpStatus WINGDIPAPI GdipDrawImageRect(GpGraphics *graphics, GpImage *image,
+    REAL x, REAL y, REAL width, REAL height)
+{
+    RectF bounds;
+    GpUnit unit;
+    GpStatus ret;
+
+    if(!graphics || !image)
+        return InvalidParameter;
+
+    ret = GdipGetImageBounds(image, &bounds, &unit);
+    if(ret != Ok)
+        return ret;
+
+    return GdipDrawImageRectRect(graphics, image, x, y, width, height,
+                                 bounds.X, bounds.Y, bounds.Width, bounds.Height,
+                                 unit, NULL, NULL, NULL);
+}
+
+GpStatus WINGDIPAPI GdipDrawImageRectI(GpGraphics *graphics, GpImage *image,
+    INT x, INT y, INT width, INT height)
+{
+    return GdipDrawImageRect(graphics, image, (REAL)x, (REAL)y, (REAL)width, (REAL)height);
+}
+
 GpStatus WINGDIPAPI GdipDrawLine(GpGraphics *graphics, GpPen *pen, REAL x1,
     REAL y1, REAL x2, REAL y2)
 {
diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h
index cd349ea..8df6c5b 100644
--- a/include/gdiplusflat.h
+++ b/include/gdiplusflat.h
@@ -87,6 +87,8 @@ GpStatus WINGDIPAPI GdipDrawImageRectRect(GpGraphics*,GpImage*,REAL,REAL,REAL,
 GpStatus WINGDIPAPI GdipDrawImageRectRectI(GpGraphics*,GpImage*,INT,INT,INT,
     INT,INT,INT,INT,INT,GpUnit,GDIPCONST GpImageAttributes*,DrawImageAbort,
     VOID*);
+GpStatus WINGDIPAPI GdipDrawImageRect(GpGraphics*,GpImage*,REAL,REAL,REAL,REAL);
+GpStatus WINGDIPAPI GdipDrawImageRectI(GpGraphics*,GpImage*,INT,INT,INT,INT);
 GpStatus WINGDIPAPI GdipDrawLine(GpGraphics*,GpPen*,REAL,REAL,REAL,REAL);
 GpStatus WINGDIPAPI GdipDrawLineI(GpGraphics*,GpPen*,INT,INT,INT,INT);
 GpStatus WINGDIPAPI GdipDrawLines(GpGraphics*,GpPen*,GDIPCONST GpPointF*,INT);
-- 
1.4.4.4






More information about the wine-patches mailing list