From b701387e9e133d765a1d373e815c4a4e890ccfe1 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Sat, 26 Dec 2009 21:05:58 -0500 Subject: [PATCH 7/7] gdiplus: Implement GdipBitmapSetResolution. --- dlls/gdiplus/image.c | 10 ++++++++-- dlls/gdiplus/tests/image.c | 10 +++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c index b9ef1a6..923e5f7 100644 --- a/dlls/gdiplus/image.c +++ b/dlls/gdiplus/image.c @@ -535,9 +535,15 @@ GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap* bitmap, GDIPCONST GpRect* rect, GpStatus WINGDIPAPI GdipBitmapSetResolution(GpBitmap* bitmap, REAL xdpi, REAL ydpi) { - FIXME("(%p, %.2f, %.2f)\n", bitmap, xdpi, ydpi); + TRACE("(%p, %.2f, %.2f)\n", bitmap, xdpi, ydpi); - return NotImplemented; + if (!bitmap || xdpi == 0.0 || ydpi == 0.0) + return InvalidParameter; + + bitmap->image.xres = xdpi; + bitmap->image.yres = ydpi; + + return Ok; } GpStatus WINGDIPAPI GdipBitmapUnlockBits(GpBitmap* bitmap, diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c index 4dec404..807100e 100644 --- a/dlls/gdiplus/tests/image.c +++ b/dlls/gdiplus/tests/image.c @@ -909,10 +909,10 @@ static void test_resolution(void) expect(InvalidParameter, stat); stat = GdipBitmapSetResolution(NULL, 96.0, 96.0); - todo_wine expect(InvalidParameter, stat); + expect(InvalidParameter, stat); stat = GdipBitmapSetResolution(bitmap, 0.0, 0.0); - todo_wine expect(InvalidParameter, stat); + expect(InvalidParameter, stat); /* defaults to screen resolution */ screendc = GetDC(0); @@ -932,15 +932,15 @@ static void test_resolution(void) /* test changing the resolution */ stat = GdipBitmapSetResolution(bitmap, screenxres*2.0, screenyres*3.0); - todo_wine expect(Ok, stat); + expect(Ok, stat); stat = GdipGetImageHorizontalResolution((GpImage*)bitmap, &res); expect(Ok, stat); - todo_wine expectf(screenxres*2.0, res); + expectf(screenxres*2.0, res); stat = GdipGetImageVerticalResolution((GpImage*)bitmap, &res); expect(Ok, stat); - todo_wine expectf(screenyres*3.0, res); + expectf(screenyres*3.0, res); stat = GdipDisposeImage((GpImage*)bitmap); expect(Ok, stat); -- 1.6.3.3