From c61ece6752ab212c32bc1791a32c3061c79bcfc8 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Tue, 26 Aug 2008 01:58:42 +0400 Subject: [PATCH] gdiplus: Basic parameter check in GdipTransformPoints with tests. --- dlls/gdiplus/graphics.c | 6 ++++++ dlls/gdiplus/tests/graphics.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index ef2aff76aea..bf3a6381ab4 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -2887,6 +2887,12 @@ GpStatus WINGDIPAPI GdipGetClip(GpGraphics *graphics, GpRegion *region) GpStatus WINGDIPAPI GdipTransformPoints(GpGraphics *graphics, GpCoordinateSpace dst_space, GpCoordinateSpace src_space, GpPointF *points, INT count) { + if(!graphics || !points || count <= 0) + return InvalidParameter; + + if(graphics->busy) + return ObjectBusy; + FIXME("(%p, %d, %d, %p, %d): stub\n", graphics, dst_space, src_space, points, count); return NotImplemented; diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c index 97702118667..10f0e79e7aa 100644 --- a/dlls/gdiplus/tests/graphics.c +++ b/dlls/gdiplus/tests/graphics.c @@ -714,6 +714,8 @@ static void test_Get_Release_DC(void) status = GdipMultiplyWorldTransform(graphics, m, MatrixOrderPrepend); status = GdipGetClip(graphics, region); expect(ObjectBusy, status); status = Ok; + status = GdipTransformPoints(graphics, CoordinateSpacePage, CoordinateSpaceWorld, ptf, 5); + expect(ObjectBusy, status); status = Ok; /* try to delete before release */ status = GdipDeleteGraphics(graphics); expect(ObjectBusy, status); @@ -732,6 +734,36 @@ static void test_Get_Release_DC(void) ReleaseDC(0, hdc); } +static void test_transformpoints(void) +{ + GpStatus status; + GpGraphics *graphics = NULL; + HDC hdc = GetDC(0); + GpPointF ptf[5]; + INT i; + + status = GdipCreateFromHDC(hdc, &graphics); + expect(Ok, status); + + for(i = 0; i < 5; i++){ + ptf[i].X = 200.0 + i * 50.0 * (i % 2); + ptf[i].Y = 200.0 + i * 50.0 * !(i % 2); + } + + /* NULL arguments */ + status = GdipTransformPoints(NULL, CoordinateSpacePage, CoordinateSpaceWorld, NULL, 0); + expect(InvalidParameter, status); + status = GdipTransformPoints(graphics, CoordinateSpacePage, CoordinateSpaceWorld, NULL, 0); + expect(InvalidParameter, status); + status = GdipTransformPoints(graphics, CoordinateSpacePage, CoordinateSpaceWorld, ptf, 0); + expect(InvalidParameter, status); + status = GdipTransformPoints(graphics, CoordinateSpacePage, CoordinateSpaceWorld, ptf, -1); + expect(InvalidParameter, status); + + GdipDeleteGraphics(graphics); + ReleaseDC(0, hdc); +} + START_TEST(graphics) { struct GdiplusStartupInput gdiplusStartupInput; @@ -752,6 +784,7 @@ START_TEST(graphics) test_GdipDrawLineI(); test_GdipDrawLinesI(); test_Get_Release_DC(); + test_transformpoints(); GdiplusShutdown(gdiplusToken); } -- 2.11.4.GIT