[5/5] gdiplus: Implemented GdipGetCustomLineCapWidthScale with some tests

Nikolay Sivov bunglehead at gmail.com
Sat Jul 26 03:48:16 CDT 2008


Changelog:
    - Implemented GdipGetCustomLineCapWidthScale with some tests

---
 dlls/gdiplus/customlinecap.c       |   12 ++++++++++++
 dlls/gdiplus/gdiplus.spec          |    2 +-
 dlls/gdiplus/gdiplus_private.h     |    1 +
 dlls/gdiplus/tests/customlinecap.c |   33 +++++++++++++++++++++++++++++++++
 include/gdiplusflat.h              |    1 +
 5 files changed, 48 insertions(+), 1 deletions(-)

diff --git a/dlls/gdiplus/customlinecap.c b/dlls/gdiplus/customlinecap.c
index d6af063..48a20df 100644
--- a/dlls/gdiplus/customlinecap.c
+++ b/dlls/gdiplus/customlinecap.c
@@ -101,6 +101,7 @@ GpStatus WINGDIPAPI GdipCreateCustomLineCap(GpPath* fillPath, GpPath* strokePath
     (*customCap)->inset = baseInset;
     (*customCap)->cap = baseCap;
     (*customCap)->join = LineJoinMiter;
+    (*customCap)->scale = 1.0;
 
     return Ok;
 }
@@ -128,6 +129,17 @@ GpStatus WINGDIPAPI GdipGetCustomLineCapStrokeJoin(GpCustomLineCap* customCap,
     return Ok;
 }
 
+GpStatus WINGDIPAPI GdipGetCustomLineCapWidthScale(GpCustomLineCap* custom,
+    REAL* widthScale)
+{
+    if(!custom || !widthScale)
+        return InvalidParameter;
+
+    *widthScale = custom->scale;
+
+    return Ok;
+}
+
 GpStatus WINGDIPAPI GdipSetCustomLineCapStrokeCaps(GpCustomLineCap* custom,
     GpLineCap start, GpLineCap end)
 {
diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec
index 5a1a7a7..2b54ec1 100644
--- a/dlls/gdiplus/gdiplus.spec
+++ b/dlls/gdiplus/gdiplus.spec
@@ -254,7 +254,7 @@
 @ stub GdipGetCustomLineCapStrokeCaps
 @ stdcall GdipGetCustomLineCapStrokeJoin(ptr ptr)
 @ stub GdipGetCustomLineCapType
-@ stub GdipGetCustomLineCapWidthScale
+@ stdcall GdipGetCustomLineCapWidthScale(ptr ptr)
 @ stdcall GdipGetDC(ptr ptr)
 @ stdcall GdipGetDpiX(ptr ptr)
 @ stdcall GdipGetDpiY(ptr ptr)
diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h
index aa03727..56df458 100644
--- a/dlls/gdiplus/gdiplus_private.h
+++ b/dlls/gdiplus/gdiplus_private.h
@@ -150,6 +150,7 @@ struct GpCustomLineCap{
     GpLineCap cap;  /* as far as I can tell, this value is ignored */
     REAL inset;     /* how much to adjust the end of the line */
     GpLineJoin join;
+    REAL scale;
 };
 
 struct GpImage{
diff --git a/dlls/gdiplus/tests/customlinecap.c b/dlls/gdiplus/tests/customlinecap.c
index c674c65..cee5159 100644
--- a/dlls/gdiplus/tests/customlinecap.c
+++ b/dlls/gdiplus/tests/customlinecap.c
@@ -149,6 +149,38 @@ static void test_inset(void)
     GdipDeletePath(path);    
 }
 
+static void test_scale(void)
+{
+    GpCustomLineCap *custom;
+    GpPath *path;
+    REAL scale;
+    GpStatus stat;
+
+    stat = GdipCreatePath(FillModeAlternate, &path);
+    expect(Ok, stat);
+    stat = GdipAddPathRectangle(path, 5.0, 5.0, 10.0, 10.0);
+    expect(Ok, stat);
+
+    stat = GdipCreateCustomLineCap(NULL, path, LineCapFlat, 0.0, &custom);
+    expect(Ok, stat);
+
+    /* NULL args */
+    stat = GdipGetCustomLineCapWidthScale(NULL, NULL);
+    expect(InvalidParameter, stat);
+    stat = GdipGetCustomLineCapWidthScale(NULL, &scale);
+    expect(InvalidParameter, stat);
+    stat = GdipGetCustomLineCapWidthScale(custom, NULL);
+    expect(InvalidParameter, stat);
+    /* valid args */
+    scale = (REAL)0xdeadbeef;
+    stat = GdipGetCustomLineCapWidthScale(custom, &scale);
+    expect(Ok, stat);
+    expectf(1.0, scale);
+
+    GdipDeleteCustomLineCap(custom);
+    GdipDeletePath(path);    
+}
+
 START_TEST(customlinecap)
 {
     struct GdiplusStartupInput gdiplusStartupInput;
@@ -164,6 +196,7 @@ START_TEST(customlinecap)
     test_constructor_destructor();
     test_linejoin();
     test_inset();
+    test_scale();
 
     GdiplusShutdown(gdiplusToken);
 }
diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h
index 0138c8b..8b83c8e 100644
--- a/include/gdiplusflat.h
+++ b/include/gdiplusflat.h
@@ -329,6 +329,7 @@ GpStatus WINGDIPAPI GdipGetCustomLineCapBaseCap(GpCustomLineCap*,GpLineCap*);
 GpStatus WINGDIPAPI GdipGetCustomLineCapBaseInset(GpCustomLineCap*,REAL*);
 GpStatus WINGDIPAPI GdipGetCustomLineCapStrokeJoin(GpCustomLineCap*,GpLineJoin*);
 GpStatus WINGDIPAPI GdipSetCustomLineCapStrokeJoin(GpCustomLineCap*,GpLineJoin);
+GpStatus WINGDIPAPI GdipGetCustomLineCapWidthScale(GpCustomLineCap*,REAL*);
 
 GpStatus WINGDIPAPI GdipBitmapGetPixel(GpBitmap*,INT,INT,ARGB*);
 GpStatus WINGDIPAPI GdipBitmapSetPixel(GpBitmap*,INT,INT,ARGB);
-- 
1.4.4.4






More information about the wine-patches mailing list