*/
#include <math.h>
-#include <assert.h>
#define WIN32_NO_STATUS
#define _INC_WINDOWS
#define expect(expected, got) ok((got) == (expected), "Expected %d, got %d\n", (INT)(expected), (INT)(got))
#define expectf_(expected, got, precision) ok(fabs((expected) - (got)) <= (precision), "Expected %f, got %f\n", (expected), (got))
#define expectf(expected, got) expectf_((expected), (got), 0.001)
-#define TABLE_LEN (23)
static const REAL mm_per_inch = 25.4;
static const REAL point_per_inch = 72.0;
case UnitMillimeter:
return units * dpi / mm_per_inch;
default:
- assert(0);
+ ok(0, "Unsupported unit: %d\n", unit);
return 0;
}
}
case UnitMillimeter:
return pixels * mm_per_inch / dpi;
default:
- assert(0);
+ ok(0, "Unsupported unit: %d\n", unit);
return 0;
}
}
return pixels_to_units(pixels, to, dpi);
}
-static GpGraphics *create_graphics(REAL res_x, REAL res_y, GpUnit unit, REAL scale)
+static GpGraphics *create_graphics(REAL res_x, REAL res_y, GpUnit unit, REAL scale, GpImage **image)
{
GpStatus status;
union
status = GdipGetImageGraphicsContext(u.image, &graphics);
expect(Ok, status);
- /* image is intentionally leaked to make sure that there is no
- side effects after its destruction.
- status = GdipDisposeImage(u.image);
- expect(Ok, status);
- */
+
+ *image = u.image;
status = GdipGetDpiX(graphics, &res);
expect(Ok, status);
status = GdipEndContainer(graphics, cont2);
expect(Ok, status);
- GdipGetClipBounds(graphics, &clip);
+ status = GdipGetClipBounds(graphics, &clip);
+ expect(Ok, status);
+
ok(fabs(defClip[0] - clip.X) < 0.0001 &&
fabs(defClip[1] - clip.Y) < 0.0001 &&
fabs(defClip[2] - clip.Width) < 0.0001 &&
GdipDeleteGraphics(graphics);
GdipDisposeImage((GpImage*)bitmap);
+
+ /* If we don't draw to the HDC, the bits are never accessed */
+ status = GdipCreateBitmapFromScan0(4, 4, 12, PixelFormat24bppRGB, (BYTE*)1, &bitmap);
+ expect(Ok, status);
+
+ status = GdipGetImageGraphicsContext((GpImage*)bitmap, &graphics);
+ expect(Ok, status);
+
+ status = GdipGetDC(graphics, &hdc);
+ expect(Ok, status);
+ ok(hdc != NULL, "got NULL hdc\n");
+
+ color = GetPixel(hdc, 0, 0);
+ todo_wine expect(0x0c0b0d, color);
+
+ status = GdipReleaseDC(graphics, hdc);
+ expect(Ok, status);
+
+ GdipDeleteGraphics(graphics);
+
+ GdipDisposeImage((GpImage*)bitmap);
}
static void test_GdipIsVisiblePoint(void)
ReleaseDC(hwnd, hdc);
}
-#if CORE_6659_IS_FIXED
static void test_string_functions(void)
{
GpStatus status;
expect(2, linesfilled);
char_height = bounds.Height - char_bounds.Height;
+ /* Measure the first line. */
+ status = GdipMeasureString(graphics, teststring, 4, font, &rc, NULL, &bounds, &codepointsfitted, &linesfilled);
+ expect(Ok, status);
+ expectf(0.0, bounds.X);
+ expectf(0.0, bounds.Y);
+ expect(4, codepointsfitted);
+ expect(1, linesfilled);
+
+ /* Give just enough space to fit the first line. */
+ rc.Width = bounds.Width;
+ status = GdipMeasureString(graphics, teststring, 5, font, &rc, NULL, &bounds, &codepointsfitted, &linesfilled);
+ expect(Ok, status);
+ expectf(0.0, bounds.X);
+ expectf(0.0, bounds.Y);
+ todo_wine expect(5, codepointsfitted);
+ todo_wine expect(1, linesfilled);
+
/* Cut off everything after the first space. */
rc.Width = char_bounds.Width + char_width * 2.1;
ReleaseDC(hwnd, hdc);
}
-#endif /* CORE_6659_IS_FIXED */
static void test_get_set_interpolation(void)
{
for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
{
- graphics = create_graphics(td[i].res_x, td[i].res_y, td[i].unit, td[i].page_scale);
+ GpImage *image;
+
+ graphics = create_graphics(td[i].res_x, td[i].res_y, td[i].unit, td[i].page_scale, &image);
lf.lfHeight = 0xdeadbeef;
status = GdipGetLogFontW(font, graphics, &lf);
status = GdipDeleteGraphics(graphics);
expect(Ok, status);
+
+ status = GdipDisposeImage(image);
+ expect(Ok, status);
}
GdipDeleteFont(font);
for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
{
REAL unit_scale;
+ GpImage *image;
- graphics = create_graphics(td[i].res_x, td[i].res_y, td[i].unit, td[i].page_scale);
+ graphics = create_graphics(td[i].res_x, td[i].res_y, td[i].unit, td[i].page_scale, &image);
lf.lfHeight = 0xdeadbeef;
status = GdipGetLogFontW(font, graphics, &lf);
status = GdipDeleteGraphics(graphics);
expect(Ok, status);
+
+ status = GdipDisposeImage(image);
+ expect(Ok, status);
+ }
+
+ GdipDeleteFont(font);
+ }
+
+ /* Font with units = UnitWorld */
+ for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
+ {
+ GpPointF pt = {0.0, 100.0};
+ GpImage* image;
+ REAL expected_width, expected_height;
+
+ graphics = create_graphics(td[i].res_x, td[i].res_y, td[i].unit, td[i].page_scale, &image);
+
+ status = GdipTransformPoints(graphics, CoordinateSpaceWorld, CoordinateSpaceDevice, &pt, 1);
+ expect(Ok, status);
+
+ status = GdipCreateFont(family, pt.Y, FontStyleRegular, UnitWorld, &font);
+ expect(Ok, status);
+
+ status = GdipGetFontUnit(font, &font_unit);
+ expect(Ok, status);
+ expect(UnitWorld, font_unit);
+
+ lf.lfHeight = 0xdeadbeef;
+ status = GdipGetLogFontW(font, graphics, &lf);
+ expect(Ok, status);
+ ok(lf.lfHeight == -100, "%u: expected -100, got %d\n", i, lf.lfHeight);
+
+ set_rect_empty(&rc);
+ set_rect_empty(&bounds);
+ status = GdipMeasureString(graphics, string, -1, font, &rc, format, &bounds, &chars, &lines);
+ expect(Ok, status);
+
+ if (i == 0)
+ {
+ base_cx = bounds.Width;
+ base_cy = bounds.Height;
}
+ pt.X = 1.0;
+ pt.Y = 1.0;
+
+ status = GdipTransformPoints(graphics, CoordinateSpaceWorld, CoordinateSpaceDevice, &pt, 1);
+ expect(Ok, status);
+
+ /* height is constant in device space, width is proportional to height in world space */
+ expected_width = base_cx * pt.Y;
+ expected_height = base_cy * pt.Y;
+
+ if (td[i].unit == UnitDisplay || td[i].unit == UnitPixel)
+ ok(fabs(expected_width - bounds.Width) <= 0.001, "%u: expected %f, got %f\n", i, expected_width, bounds.Width);
+ else
+ todo_wine ok(fabs(expected_width - bounds.Width) <= 0.001, "%u: expected %f, got %f\n", i, expected_width, bounds.Width);
+ ok(fabs(expected_height - bounds.Height) <= 0.001, "%u: expected %f, got %f\n", i, expected_height, bounds.Height);
+
+ GdipDeleteGraphics(graphics);
+ GdipDisposeImage(image);
GdipDeleteFont(font);
}
};
GpStatus status;
GpGraphics *graphics;
+ GpImage *image;
GpPointF ptf[2];
UINT i;
for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
{
- graphics = create_graphics(td[i].res_x, td[i].res_y, td[i].unit, td[i].scale);
+ graphics = create_graphics(td[i].res_x, td[i].res_y, td[i].unit, td[i].scale, &image);
ptf[0].X = td[i].in[0].X;
ptf[0].Y = td[i].in[0].Y;
ptf[1].X = td[i].in[1].X;
expectf(td[i].in[1].Y, ptf[1].Y);
status = GdipDeleteGraphics(graphics);
expect(Ok, status);
+ status = GdipDisposeImage(image);
+ expect(Ok, status);
+ }
+}
+
+static void test_pen_thickness(void)
+{
+ static const struct test_data
+ {
+ REAL res_x, res_y, scale;
+ GpUnit pen_unit, page_unit;
+ REAL pen_width;
+ INT cx, cy;
+ } td[] =
+ {
+ { 10.0, 10.0, 1.0, UnitPixel, UnitPixel, 1.0, 1, 1 },
+ { 10.0, 10.0, 3.0, UnitPixel, UnitPixel, 2.0, 2, 2 },
+ { 10.0, 10.0, 30.0, UnitPixel, UnitInch, 1.0, 1, 1 },
+ { 10.0, 10.0, 1.0, UnitWorld, UnitPixel, 1.0, 1, 1 },
+ { 10.0, 10.0, 3.0, UnitWorld, UnitPixel, 2.0, 6, 6 },
+ { 10.0, 10.0, 2.0, UnitWorld, UnitInch, 1.0, 20, 20 },
+ };
+ GpStatus status;
+ int i, j;
+ GpGraphics *graphics;
+ union
+ {
+ GpBitmap *bitmap;
+ GpImage *image;
+ } u;
+ GpPen *pen;
+ GpPointF corner;
+ BitmapData bd;
+ INT min, max, size;
+
+ for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
+ {
+ status = GdipCreateBitmapFromScan0(100, 100, 0, PixelFormat24bppRGB, NULL, &u.bitmap);
+ expect(Ok, status);
+
+ status = GdipBitmapSetResolution(u.bitmap, td[i].res_x, td[i].res_y);
+ expect(Ok, status);
+
+ status = GdipGetImageGraphicsContext(u.image, &graphics);
+ expect(Ok, status);
+
+ status = GdipSetPageUnit(graphics, td[i].page_unit);
+ expect(Ok, status);
+
+ status = GdipSetPageScale(graphics, td[i].scale);
+ expect(Ok, status);
+
+ status = GdipCreatePen1(0xffffffff, td[i].pen_width, td[i].pen_unit, &pen);
+ expect(Ok, status);
+
+ corner.X = corner.Y = 100.0;
+ status = GdipTransformPoints(graphics, CoordinateSpaceWorld, CoordinateSpaceDevice, &corner, 1);
+ expect(Ok, status);
+
+ status = GdipDrawLine(graphics, pen, corner.X/2, 0, corner.X/2, corner.Y);
+ expect(Ok, status);
+
+ status = GdipDrawLine(graphics, pen, 0, corner.Y/2, corner.X, corner.Y/2);
+ expect(Ok, status);
+
+ status = GdipBitmapLockBits(u.bitmap, NULL, ImageLockModeRead, PixelFormat24bppRGB, &bd);
+ expect(Ok, status);
+
+ min = -1;
+ max = -2;
+
+ for (j=0; j<100; j++)
+ {
+ if (((BYTE*)bd.Scan0)[j*3] == 0xff)
+ {
+ min = j;
+ break;
+ }
+ }
+
+ for (j=99; j>=0; j--)
+ {
+ if (((BYTE*)bd.Scan0)[j*3] == 0xff)
+ {
+ max = j;
+ break;
+ }
+ }
+
+ size = max-min+1;
+
+ ok(size == td[i].cx, "%u: expected %d, got %d\n", i, td[i].cx, size);
+
+ min = -1;
+ max = -2;
+
+ for (j=0; j<100; j++)
+ {
+ if (((BYTE*)bd.Scan0)[bd.Stride*j] == 0xff)
+ {
+ min = j;
+ break;
+ }
+ }
+
+ for (j=99; j>=0; j--)
+ {
+ if (((BYTE*)bd.Scan0)[bd.Stride*j] == 0xff)
+ {
+ max = j;
+ break;
+ }
+ }
+
+ size = max-min+1;
+
+ ok(size == td[i].cy, "%u: expected %d, got %d\n", i, td[i].cy, size);
+
+ status = GdipBitmapUnlockBits(u.bitmap, &bd);
+ expect(Ok, status);
+
+ GdipDeletePen(pen);
+ GdipDeleteGraphics(graphics);
+ GdipDisposeImage(u.image);
}
}
hdc = CreateCompatibleDC(0);
status = GdipCreateFromHDC(hdc, &graphics);
+ expect(Ok, status);
status = GdipGetDpiY(graphics, &dpi);
expect(Ok, status);
match = fabs(1.0 - margin / rect.X) <= 0.05;
ok(match, "Expected %f, got %f\n", margin, rect.X);
match = fabs(1.0 - font_height / rect.Height) <= 0.1;
-todo_wine
ok(match, "Expected %f, got %f\n", font_height, rect.Height);
match = fabs(1.0 - bounds.Width / (rect.Width + margin * 2.0)) <= 0.05;
ok(match, "Expected %f, got %f\n", bounds.Width, rect.Width + margin * 2.0);
static void test_alpha_hdc(void)
{
GpStatus status;
- HDC hdc;
+ HDC hdc, gp_hdc;
HBITMAP hbm, old_hbm;
GpGraphics *graphics;
ULONG *bits;
BITMAPINFO bmi;
GpRectF bounds;
+ COLORREF colorref;
hdc = CreateCompatibleDC(0);
ok(hdc != NULL, "CreateCompatibleDC failed\n");
expect(0xffaaaaaa, bits[0]);
+ bits[0] = 0xdeadbeef;
+
+ status = GdipGetDC(graphics, &gp_hdc);
+ expect(Ok, status);
+
+ colorref = GetPixel(gp_hdc, 0, 4);
+ expect(0xefbead, colorref);
+
+ SetPixel(gp_hdc, 0, 4, 0xffffff);
+
+ expect(0xffffff, bits[0]);
+
+ status = GdipReleaseDC(graphics, gp_hdc);
+ expect(Ok, status);
+
SelectObject(hdc, old_hbm);
bits[0] = 0xdeadbeef;
GdipDisposeImage((GpImage*)bitmap);
}
+static void test_clipping(void)
+{
+ HDC hdc;
+ GpStatus status;
+ GpGraphics *graphics;
+ GpRegion *region, *region100x100;
+ GpMatrix *matrix;
+ GpRectF rect;
+ GpPointF ptf[4];
+ GpUnit unit;
+ HRGN hrgn;
+ int ret;
+ RECT rc;
+
+ hdc = CreateCompatibleDC(0);
+ status = GdipCreateFromHDC(hdc, &graphics);
+ expect(Ok, status);
+
+ status = GdipGetPageUnit(graphics, &unit);
+ expect(Ok, status);
+ expect(UnitDisplay, unit);
+
+ status = GdipCreateRegion(®ion);
+ expect(Ok, status);
+ status = GdipSetEmpty(region);
+ expect(Ok, status);
+
+ status = GdipCreateRegion(®ion100x100);
+ expect(Ok, status);
+ status = GdipSetEmpty(region100x100);
+ expect(Ok, status);
+
+ rect.X = rect.Y = 100.0;
+ rect.Width = rect.Height = 100.0;
+ status = GdipCombineRegionRect(region100x100, &rect, CombineModeUnion);
+ expect(Ok, status);
+ status = GdipSetClipRegion(graphics, region100x100, CombineModeReplace);
+ expect(Ok, status);
+
+ status = GdipGetClipBounds(graphics, &rect);
+ expect(Ok, status);
+ ok(rect.X == 100.0 && rect.Y == 100.0 && rect.Width == 100.0 && rect.Height == 100.0,
+ "expected 100.0,100.0-100.0,100.0, got %.2f,%.2f-%.2f,%.2f\n", rect.X, rect.Y, rect.Width, rect.Height);
+
+ status = GdipSetEmpty(region);
+ expect(Ok, status);
+ status = GdipGetClip(graphics, region);
+ expect(Ok, status);
+ status = GdipGetRegionBounds(region, graphics, &rect);
+ expect(Ok, status);
+ ok(rect.X == 100.0 && rect.Y == 100.0 && rect.Width == 100.0 && rect.Height == 100.0,
+ "expected 100.0,100.0-100.0,100.0, got %.2f,%.2f-%.2f,%.2f\n", rect.X, rect.Y, rect.Width, rect.Height);
+
+ ptf[0].X = 100.0;
+ ptf[0].Y = 100.0;
+ ptf[1].X = 200.0;
+ ptf[1].Y = 200.0;
+ status = GdipTransformPoints(graphics, CoordinateSpaceWorld, CoordinateSpaceDevice, ptf, 2);
+ expect(Ok, status);
+ ok(ptf[0].X == 100.0 && ptf[0].Y == 100.0 && ptf[1].X == 200.0 && ptf[1].Y == 200.0,
+ "expected 100.0,100.0-200.0,200.0, got %f,%f-%f,%f\n", ptf[0].X, ptf[0].Y, ptf[1].X, ptf[1].Y);
+
+ status = GdipCreateMatrix(&matrix);
+ expect(Ok, status);
+ status = GdipScaleMatrix(matrix, 2.0, 4.0, MatrixOrderAppend);
+ expect(Ok, status);
+ status = GdipTranslateMatrix(matrix, 10.0, 20.0, MatrixOrderAppend);
+ expect(Ok, status);
+ status = GdipSetWorldTransform(graphics, matrix);
+ expect(Ok, status);
+
+ status = GdipGetClipBounds(graphics, &rect);
+ expect(Ok, status);
+ ok(rect.X == 45.0 && rect.Y == 20.0 && rect.Width == 50.0 && rect.Height == 25.0,
+ "expected 45.0,20.0-50.0,25.0, got %.2f,%.2f-%.2f,%.2f\n", rect.X, rect.Y, rect.Width, rect.Height);
+
+ status = GdipSetEmpty(region);
+ expect(Ok, status);
+ status = GdipGetClip(graphics, region);
+ expect(Ok, status);
+ status = GdipGetRegionBounds(region, graphics, &rect);
+ expect(Ok, status);
+ ok(rect.X == 45.0 && rect.Y == 20.0 && rect.Width == 50.0 && rect.Height == 25.0,
+ "expected 45.0,20.0-50.0,25.0, got %.2f,%.2f-%.2f,%.2f\n", rect.X, rect.Y, rect.Width, rect.Height);
+
+ status = GdipGetRegionBounds(region100x100, graphics, &rect);
+ expect(Ok, status);
+ ok(rect.X == 100.0 && rect.Y == 100.0 && rect.Width == 100.0 && rect.Height == 100.0,
+ "expected 100.0,100.0-100.0,100.0, got %.2f,%.2f-%.2f,%.2f\n", rect.X, rect.Y, rect.Width, rect.Height);
+
+ status = GdipGetRegionHRgn(region, NULL, &hrgn);
+ expect(Ok, status);
+ ret = GetRgnBox(hrgn, &rc);
+ ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
+ ok(rc.left == 45 && rc.top == 20 && rc.right == 95 && rc.bottom == 45,
+ "expected 45,20-95,45, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+ DeleteObject(hrgn);
+
+ status = GdipGetRegionHRgn(region, graphics, &hrgn);
+ expect(Ok, status);
+ ret = GetRgnBox(hrgn, &rc);
+ ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
+ ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
+ "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+ DeleteObject(hrgn);
+
+ ptf[0].X = 100.0;
+ ptf[0].Y = 100.0;
+ ptf[1].X = 200.0;
+ ptf[1].Y = 200.0;
+ status = GdipTransformPoints(graphics, CoordinateSpaceWorld, CoordinateSpaceDevice, ptf, 2);
+ expect(Ok, status);
+ ok(ptf[0].X == 45.0 && ptf[0].Y == 20.0 && ptf[1].X == 95.0 && ptf[1].Y == 45.0,
+ "expected 45.0,20.0-95.0,45.0, got %f,%f-%f,%f\n", ptf[0].X, ptf[0].Y, ptf[1].X, ptf[1].Y);
+
+ status = GdipGetRegionHRgn(region100x100, NULL, &hrgn);
+ expect(Ok, status);
+ ret = GetRgnBox(hrgn, &rc);
+ ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
+ ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
+ "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+ DeleteObject(hrgn);
+
+ status = GdipGetRegionHRgn(region100x100, graphics, &hrgn);
+ expect(Ok, status);
+ ret = GetRgnBox(hrgn, &rc);
+ ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
+ ok(rc.left == 210 && rc.top == 420 && rc.right == 410 && rc.bottom == 820,
+ "expected 210,420-410,820, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+ DeleteObject(hrgn);
+
+ ptf[0].X = 210.0;
+ ptf[0].Y = 420.0;
+ ptf[1].X = 410.0;
+ ptf[1].Y = 820.0;
+ status = GdipTransformPoints(graphics, CoordinateSpaceWorld, CoordinateSpaceDevice, ptf, 2);
+ expect(Ok, status);
+ ok(ptf[0].X == 100.0 && ptf[0].Y == 100.0 && ptf[1].X == 200.0 && ptf[1].Y == 200.0,
+ "expected 100.0,100.0-200.0,200.0, got %f,%f-%f,%f\n", ptf[0].X, ptf[0].Y, ptf[1].X, ptf[1].Y);
+
+ status = GdipSetPageScale(graphics, 2.0);
+ expect(Ok, status);
+
+ status = GdipGetClipBounds(graphics, &rect);
+ expect(Ok, status);
+ ok(rect.X == 45.0 && rect.Y == 20.0 && rect.Width == 50.0 && rect.Height == 25.0,
+ "expected 45.0,20.0-50.0,25.0, got %.2f,%.2f-%.2f,%.2f\n", rect.X, rect.Y, rect.Width, rect.Height);
+
+ status = GdipSetEmpty(region);
+ expect(Ok, status);
+ status = GdipGetClip(graphics, region);
+ expect(Ok, status);
+ status = GdipGetRegionBounds(region, graphics, &rect);
+ expect(Ok, status);
+ ok(rect.X == 45.0 && rect.Y == 20.0 && rect.Width == 50.0 && rect.Height == 25.0,
+ "expected 45.0,20.0-50.0,25.0, got %.2f,%.2f-%.2f,%.2f\n", rect.X, rect.Y, rect.Width, rect.Height);
+
+ status = GdipGetRegionBounds(region100x100, graphics, &rect);
+ expect(Ok, status);
+ ok(rect.X == 100.0 && rect.Y == 100.0 && rect.Width == 100.0 && rect.Height == 100.0,
+ "expected 100.0,100.0-100.0,100.0, got %.2f,%.2f-%.2f,%.2f\n", rect.X, rect.Y, rect.Width, rect.Height);
+
+ status = GdipGetRegionHRgn(region, NULL, &hrgn);
+ expect(Ok, status);
+ ret = GetRgnBox(hrgn, &rc);
+ ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
+ ok(rc.left == 45 && rc.top == 20 && rc.right == 95 && rc.bottom == 45,
+ "expected 45,20-95,45, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+ DeleteObject(hrgn);
+
+ status = GdipGetRegionHRgn(region, graphics, &hrgn);
+ expect(Ok, status);
+ ret = GetRgnBox(hrgn, &rc);
+ ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
+ ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
+ "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+ DeleteObject(hrgn);
+
+ ptf[0].X = 100.0;
+ ptf[0].Y = 100.0;
+ ptf[1].X = 200.0;
+ ptf[1].Y = 200.0;
+ status = GdipTransformPoints(graphics, CoordinateSpaceWorld, CoordinateSpaceDevice, ptf, 2);
+ expect(Ok, status);
+ ok(ptf[0].X == 45.0 && ptf[0].Y == 20.0 && ptf[1].X == 95.0 && ptf[1].Y == 45.0,
+ "expected 45.0,20.0-95.0,45.0, got %f,%f-%f,%f\n", ptf[0].X, ptf[0].Y, ptf[1].X, ptf[1].Y);
+
+ status = GdipGetRegionHRgn(region100x100, NULL, &hrgn);
+ expect(Ok, status);
+ ret = GetRgnBox(hrgn, &rc);
+ ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
+ ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
+ "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+ DeleteObject(hrgn);
+
+ status = GdipGetRegionHRgn(region100x100, graphics, &hrgn);
+ expect(Ok, status);
+ ret = GetRgnBox(hrgn, &rc);
+ ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
+ ok(rc.left == 210 && rc.top == 420 && rc.right == 410 && rc.bottom == 820,
+ "expected 210,420-410,820, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+ DeleteObject(hrgn);
+
+ ptf[0].X = 210.0;
+ ptf[0].Y = 420.0;
+ ptf[1].X = 410.0;
+ ptf[1].Y = 820.0;
+ status = GdipTransformPoints(graphics, CoordinateSpaceWorld, CoordinateSpaceDevice, ptf, 2);
+ expect(Ok, status);
+ ok(ptf[0].X == 100.0 && ptf[0].Y == 100.0 && ptf[1].X == 200.0 && ptf[1].Y == 200.0,
+ "expected 100.0,100.0-200.0,200.0, got %f,%f-%f,%f\n", ptf[0].X, ptf[0].Y, ptf[1].X, ptf[1].Y);
+
+ GdipSetPageUnit(graphics, UnitPoint);
+ expect(Ok, status);
+
+ status = GdipGetClipBounds(graphics, &rect);
+ expect(Ok, status);
+ ok((rect.X == 13.75 && rect.Y == 4.375 && rect.Width == 18.75 && rect.Height == 9.375) ||
+ /* rounding under Wine is slightly different */
+ (rect.X == 14.0 && rect.Y == 4.0 && rect.Width == 19.0 && rect.Height == 10.0) /* Wine */ ||
+ broken(rect.X == 45.0 && rect.Y == 20.0 && rect.Width == 50.0 && rect.Height == 25.0) /* before Win7 */,
+ "expected 13.75,4.375-18.75,9.375, got %.2f,%.2f-%.2f,%.2f\n", rect.X, rect.Y, rect.Width, rect.Height);
+
+ status = GdipSetEmpty(region);
+ expect(Ok, status);
+ status = GdipGetClip(graphics, region);
+ expect(Ok, status);
+ status = GdipGetRegionBounds(region, graphics, &rect);
+ expect(Ok, status);
+ ok((rect.X == 13.75 && rect.Y == 4.375 && rect.Width == 18.75 && rect.Height == 9.375) ||
+ /* rounding under Wine is slightly different */
+ (rect.X == 14.0 && rect.Y == 4.0 && rect.Width == 19.0 && rect.Height == 10.0) /* Wine */ ||
+ broken(rect.X == 45.0 && rect.Y == 20.0 && rect.Width == 50.0 && rect.Height == 25.0) /* before Win7 */,
+ "expected 13.75,4.375-18.75,9.375, got %.2f,%.2f-%.2f,%.2f\n", rect.X, rect.Y, rect.Width, rect.Height);
+
+ status = GdipGetRegionBounds(region100x100, graphics, &rect);
+ expect(Ok, status);
+ ok(rect.X == 100.0 && rect.Y == 100.0 && rect.Width == 100.0 && rect.Height == 100.0,
+ "expected 100.0,100.0-100.0,100.0, got %.2f,%.2f-%.2f,%.2f\n", rect.X, rect.Y, rect.Width, rect.Height);
+
+ status = GdipGetRegionHRgn(region, NULL, &hrgn);
+ expect(Ok, status);
+ ret = GetRgnBox(hrgn, &rc);
+ ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
+ ok((rc.left == 14 && rc.top == 5 && rc.right == 33 && rc.bottom == 14) ||
+ /* rounding under Wine is slightly different */
+ (rc.left == 14 && rc.top == 4 && rc.right == 33 && rc.bottom == 14) /* Wine */ ||
+ broken(rc.left == 45 && rc.top == 20 && rc.right == 95 && rc.bottom == 45) /* before Win7 */,
+ "expected 14,5-33,14, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+ DeleteObject(hrgn);
+
+ status = GdipGetRegionHRgn(region, graphics, &hrgn);
+ expect(Ok, status);
+ ret = GetRgnBox(hrgn, &rc);
+ ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
+ ok((rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200) ||
+ broken(rc.left == 267 && rc.top == 267 && rc.right == 534 && rc.bottom == 534) /* before Win7 */,
+ "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+ DeleteObject(hrgn);
+
+ ptf[0].X = 100.0;
+ ptf[0].Y = 100.0;
+ ptf[1].X = 200.0;
+ ptf[1].Y = 200.0;
+ status = GdipTransformPoints(graphics, CoordinateSpaceWorld, CoordinateSpaceDevice, ptf, 2);
+ expect(Ok, status);
+ ok((ptf[0].X == 13.75 && ptf[0].Y == 4.375 && ptf[1].X == 32.5 && ptf[1].Y == 13.75) ||
+ broken(ptf[0].X == 45.0 && ptf[0].Y == 20.0 && ptf[1].X == 95.0 && ptf[1].Y == 45.0) /* before Win7 */,
+ "expected 13.75,4.375-32.5,13.75, got %f,%f-%f,%f\n", ptf[0].X, ptf[0].Y, ptf[1].X, ptf[1].Y);
+
+ status = GdipGetRegionHRgn(region100x100, NULL, &hrgn);
+ expect(Ok, status);
+ ret = GetRgnBox(hrgn, &rc);
+ ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
+ ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
+ "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+ DeleteObject(hrgn);
+
+ status = GdipGetRegionHRgn(region100x100, graphics, &hrgn);
+ expect(Ok, status);
+ ret = GetRgnBox(hrgn, &rc);
+ ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
+ ok((rc.left == 560 && rc.top == 1120 && rc.right == 1094 && rc.bottom == 2187) ||
+ /* rounding under Wine is slightly different */
+ (rc.left == 560 && rc.top == 1120 && rc.right == 1093 && rc.bottom == 2187) /* Wine */,
+ "expected 560,1120-1094,2187, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+ DeleteObject(hrgn);
+
+ ptf[0].X = 560.0;
+ ptf[0].Y = 1120.0;
+ ptf[1].X = 1094.0;
+ ptf[1].Y = 2187.0;
+ status = GdipTransformPoints(graphics, CoordinateSpaceWorld, CoordinateSpaceDevice, ptf, 2);
+ expect(Ok, status);
+ if (fabs(ptf[0].X - 100.0) < 0.001)
+ {
+ expectf(100.0, ptf[0].X);
+ expectf(100.0, ptf[0].Y);
+ expectf(200.125, ptf[1].X);
+ expectf(200.03125, ptf[1].Y);
+ }
+ else /* before Win7 */
+ {
+ ok(broken(fabs(ptf[0].X - 275.0) < 0.001), "expected 275.0, got %f\n", ptf[0].X);
+ ok(broken(fabs(ptf[0].Y - 275.0) < 0.001), "expected 275.0, got %f\n", ptf[0].Y);
+ ok(broken(fabs(ptf[1].X - 542.0) < 0.001), "expected 542.0, got %f\n", ptf[1].X);
+ ok(broken(fabs(ptf[1].Y - 541.75) < 0.001), "expected 541.75, got %f\n", ptf[1].Y);
+ }
+
+ status = GdipTransformRegion(region100x100, matrix);
+ expect(Ok, status);
+
+ status = GdipGetRegionBounds(region100x100, graphics, &rect);
+ expect(Ok, status);
+ ok(rect.X == 210.0 && rect.Y == 420.0 && rect.Width == 200.0 && rect.Height == 400.0,
+ "expected 210.0,420.0-200.0,400.0, got %.2f,%.2f-%.2f,%.2f\n", rect.X, rect.Y, rect.Width, rect.Height);
+
+ status = GdipGetRegionHRgn(region100x100, NULL, &hrgn);
+ expect(Ok, status);
+ ret = GetRgnBox(hrgn, &rc);
+ ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
+ ok(rc.left == 210 && rc.top == 420 && rc.right == 410 && rc.bottom == 820,
+ "expected 210,420-410,820, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+ DeleteObject(hrgn);
+
+ status = GdipGetRegionHRgn(region100x100, graphics, &hrgn);
+ expect(Ok, status);
+ ret = GetRgnBox(hrgn, &rc);
+ ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
+ ok((rc.left == 1147 && rc.top == 4534 && rc.right == 2214 && rc.bottom == 8800) ||
+ /* rounding under Wine is slightly different */
+ (rc.left == 1147 && rc.top == 4533 && rc.right == 2213 && rc.bottom == 8800) /* Wine */,
+ "expected 1147,4534-2214,8800, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+ DeleteObject(hrgn);
+
+ ptf[0].X = 1147.0;
+ ptf[0].Y = 4534.0;
+ ptf[1].X = 2214.0;
+ ptf[1].Y = 8800.0;
+ status = GdipTransformPoints(graphics, CoordinateSpaceWorld, CoordinateSpaceDevice, ptf, 2);
+ expect(Ok, status);
+ if (fabs(ptf[0].X - 210.0625) < 0.001)
+ {
+ expectf(210.0625, ptf[0].X);
+ expectf(420.0625, ptf[0].Y);
+ expectf(410.125, ptf[1].X);
+ expectf(820.0, ptf[1].Y);
+ }
+ else /* before Win7 */
+ {
+ ok(broken(fabs(ptf[0].X - 568.5) < 0.001), "expected 568.5, got %f\n", ptf[0].X);
+ ok(broken(fabs(ptf[0].Y - 1128.5) < 0.001), "expected 1128.5, got %f\n", ptf[0].Y);
+ ok(broken(fabs(ptf[1].X - 1102.0) < 0.001), "expected 1102.0, got %f\n", ptf[1].X);
+ ok(broken(fabs(ptf[1].Y - 2195.0) < 0.001), "expected 2195.0, got %f\n", ptf[1].Y);
+ }
+
+ status = GdipRotateMatrix(matrix, 30.0, MatrixOrderAppend);
+ expect(Ok, status);
+ status = GdipSetWorldTransform(graphics, matrix);
+ expect(Ok, status);
+
+ status = GdipGetClipBounds(graphics, &rect);
+ expect(Ok, status);
+ expectf_(20.612978, rect.X, 1.0);
+ expectf_(-6.256012, rect.Y, 1.5);
+ expectf_(25.612978, rect.Width, 1.0);
+ expectf_(12.806489, rect.Height, 1.0);
+
+ status = GdipSetEmpty(region);
+ expect(Ok, status);
+ status = GdipGetClip(graphics, region);
+ expect(Ok, status);
+ status = GdipGetRegionBounds(region, graphics, &rect);
+ expect(Ok, status);
+ /* rounding under Wine is slightly different */
+ expectf_(20.612978, rect.X, 1.0);
+ expectf_(-6.256012, rect.Y, 1.5);
+ expectf_(25.612978, rect.Width, 1.0);
+ expectf_(12.806489, rect.Height, 1.0);
+
+ status = GdipGetRegionBounds(region100x100, graphics, &rect);
+ expect(Ok, status);
+ ok(rect.X == 210.0 && rect.Y == 420.0 && rect.Width == 200.0 && rect.Height == 400.0,
+ "expected 210.0,420.0-200.0,400.0, got %f,%f-%f,%f\n", rect.X, rect.Y, rect.Width, rect.Height);
+
+ status = GdipGetRegionHRgn(region, NULL, &hrgn);
+ expect(Ok, status);
+ ret = GetRgnBox(hrgn, &rc);
+ ok(ret == COMPLEXREGION, "expected COMPLEXREGION, got %d\n", ret);
+ ok((rc.left == 22 && rc.top == -6 && rc.right == 46 && rc.bottom == 7) ||
+ /* rounding under Wine is slightly different */
+ (rc.left == 21 && rc.top == -5 && rc.right == 46 && rc.bottom == 7) /* Wine */,
+ "expected (22,-6)-(46,7), got (%d,%d)-(%d,%d)\n", rc.left, rc.top, rc.right, rc.bottom);
+ DeleteObject(hrgn);
+
+ status = GdipGetRegionHRgn(region, graphics, &hrgn);
+ expect(Ok, status);
+ ret = GetRgnBox(hrgn, &rc);
+ ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
+ ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
+ "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+ DeleteObject(hrgn);
+
+ ptf[0].X = 100.0;
+ ptf[0].Y = 100.0;
+ ptf[1].X = 200.0;
+ ptf[1].Y = 200.0;
+ ptf[2].X = 200.0;
+ ptf[2].Y = 100.0;
+ ptf[3].X = 100.0;
+ ptf[3].Y = 200.0;
+ status = GdipTransformPoints(graphics, CoordinateSpaceWorld, CoordinateSpaceDevice, ptf, 4);
+ expect(Ok, status);
+ expectf(20.612978, ptf[0].X);
+ expectf(-1.568512, ptf[0].Y);
+ expectf(46.225956, ptf[1].X);
+ expectf(1.862977, ptf[1].Y);
+ expectf(36.850956, ptf[2].X);
+ expectf(-6.256012, ptf[2].Y);
+ expectf(29.987980, ptf[3].X);
+ expectf(6.550478, ptf[3].Y);
+
+ status = GdipGetRegionHRgn(region100x100, NULL, &hrgn);
+ expect(Ok, status);
+ ret = GetRgnBox(hrgn, &rc);
+ ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
+ ok(rc.left == 210 && rc.top == 420 && rc.right == 410 && rc.bottom == 820,
+ "expected 210,420-410,820, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+ DeleteObject(hrgn);
+
+ status = GdipGetRegionHRgn(region100x100, graphics, &hrgn);
+ expect(Ok, status);
+ ret = GetRgnBox(hrgn, &rc);
+ ok(ret == COMPLEXREGION, "expected COMPLEXREGION, got %d\n", ret);
+ ok((rc.left == -3406 && rc.top == 4500 && rc.right == -350 && rc.bottom == 8728) ||
+ /* rounding under Wine is slightly different */
+ (rc.left == -3407 && rc.top == 4500 && rc.right == -350 && rc.bottom == 8728) /* Wine */,
+ "expected (-3406,4500)-(-350,8728), got (%d,%d)-(%d,%d)\n", rc.left, rc.top, rc.right, rc.bottom);
+ DeleteObject(hrgn);
+
+ ptf[0].X = -3406.0;
+ ptf[0].Y = 4500.0;
+ ptf[1].X = -350.0;
+ ptf[1].Y = 8728.0;
+ ptf[2].X = -350.0;
+ ptf[2].Y = 4500.0;
+ ptf[3].X = -3406.0;
+ ptf[3].Y = 8728.0;
+ status = GdipTransformPoints(graphics, CoordinateSpaceWorld, CoordinateSpaceDevice, ptf, 4);
+ expect(Ok, status);
+ expectf(-136.190491, ptf[0].X);
+ expectf(520.010742, ptf[0].Y);
+ expectf(756.417175, ptf[1].X);
+ expectf(720.031616, ptf[1].Y);
+ expectf(360.042114, ptf[2].X);
+ expectf(376.760742, ptf[2].Y);
+ expectf(260.184570, ptf[3].X);
+ expectf(863.281616, ptf[3].Y);
+
+ status = GdipRotateMatrix(matrix, -90.0, MatrixOrderAppend);
+ expect(Ok, status);
+ status = GdipSetWorldTransform(graphics, matrix);
+ expect(Ok, status);
+
+ status = GdipGetClipBounds(graphics, &rect);
+ expect(Ok, status);
+ expectf_(-28.100956, rect.X, 1.0);
+ expectf_(7.806488, rect.Y, 1.5);
+ expectf_(25.612978, rect.Width, 1.0);
+ expectf_(12.806489, rect.Height, 1.0);
+
+ status = GdipSetEmpty(region);
+ expect(Ok, status);
+ status = GdipGetClip(graphics, region);
+ expect(Ok, status);
+ status = GdipGetRegionBounds(region, graphics, &rect);
+ expect(Ok, status);
+ /* rounding under Wine is slightly different */
+ expectf_(-28.100956, rect.X, 1.0);
+ expectf_(7.806488, rect.Y, 1.5);
+ expectf_(25.612978, rect.Width, 1.0);
+ expectf_(12.806489, rect.Height, 1.0);
+
+ status = GdipGetRegionBounds(region100x100, graphics, &rect);
+ expect(Ok, status);
+ ok(rect.X == 210.0 && rect.Y == 420.0 && rect.Width == 200.0 && rect.Height == 400.0,
+ "expected 210.0,420.0-200.0,400.0, got %f,%f-%f,%f\n", rect.X, rect.Y, rect.Width, rect.Height);
+
+ status = GdipGetRegionHRgn(region, NULL, &hrgn);
+ expect(Ok, status);
+ ret = GetRgnBox(hrgn, &rc);
+ ok(ret == COMPLEXREGION, "expected COMPLEXREGION, got %d\n", ret);
+ ok((rc.left == -27 && rc.top == 8 && rc.right == -2 && rc.bottom == 21) ||
+ /* rounding under Wine is slightly different */
+ (rc.left == -28 && rc.top == 9 && rc.right == -2 && rc.bottom == 21) /* Wine */,
+ "expected (-27,8)-(-2,21), got (%d,%d)-(%d,%d)\n", rc.left, rc.top, rc.right, rc.bottom);
+ DeleteObject(hrgn);
+
+ status = GdipGetRegionHRgn(region, graphics, &hrgn);
+ expect(Ok, status);
+ ret = GetRgnBox(hrgn, &rc);
+ ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
+ ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
+ "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+ DeleteObject(hrgn);
+
+ ptf[0].X = 100.0;
+ ptf[0].Y = 100.0;
+ ptf[1].X = 200.0;
+ ptf[1].Y = 200.0;
+ ptf[2].X = 200.0;
+ ptf[2].Y = 100.0;
+ ptf[3].X = 100.0;
+ ptf[3].Y = 200.0;
+ status = GdipTransformPoints(graphics, CoordinateSpaceWorld, CoordinateSpaceDevice, ptf, 4);
+ expect(Ok, status);
+ expectf(-11.862979, ptf[0].X);
+ expectf(7.806488, ptf[0].Y);
+ expectf(-18.725958, ptf[1].X);
+ expectf(20.612976, ptf[1].Y);
+ expectf(-2.487981, ptf[2].X);
+ expectf(15.925477, ptf[2].Y);
+ expectf(-28.100956, ptf[3].X);
+ expectf(12.493987, ptf[3].Y);
+
+ status = GdipGetRegionHRgn(region100x100, NULL, &hrgn);
+ expect(Ok, status);
+ ret = GetRgnBox(hrgn, &rc);
+ ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
+ ok(rc.left == 210 && rc.top == 420 && rc.right == 410 && rc.bottom == 820,
+ "expected 210,420-410,820, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+ DeleteObject(hrgn);
+
+ status = GdipGetRegionHRgn(region100x100, graphics, &hrgn);
+ expect(Ok, status);
+ ret = GetRgnBox(hrgn, &rc);
+ ok(ret == COMPLEXREGION, "expected COMPLEXREGION, got %d\n", ret);
+ ok((rc.left == 4500 && rc.top == 351 && rc.right == 8728 && rc.bottom == 3407) ||
+ /* rounding under Wine is slightly different */
+ (rc.left == 4499 && rc.top == 351 && rc.right == 8728 && rc.bottom == 3407) /* Wine */,
+ "expected (4500,351)-(8728,3407), got (%d,%d)-(%d,%d)\n", rc.left, rc.top, rc.right, rc.bottom);
+ DeleteObject(hrgn);
+
+ ptf[0].X = -3406.0;
+ ptf[0].Y = 4500.0;
+ ptf[1].X = -350.0;
+ ptf[1].Y = 8728.0;
+ ptf[2].X = -350.0;
+ ptf[2].Y = 4500.0;
+ ptf[3].X = -3406.0;
+ ptf[3].Y = 8728.0;
+ status = GdipTransformPoints(graphics, CoordinateSpaceWorld, CoordinateSpaceDevice, ptf, 4);
+ expect(Ok, status);
+ expectf(-1055.021484, ptf[0].X);
+ expectf(-70.595329, ptf[0].Y);
+ expectf(-1455.063232, ptf[1].X);
+ expectf(375.708435, ptf[1].Y);
+ expectf(-768.521484, ptf[2].X);
+ expectf(177.520981, ptf[2].Y);
+ expectf(-1741.563110, ptf[3].X);
+ expectf(127.592125, ptf[3].Y);
+
+ GdipDeleteMatrix(matrix);
+ GdipDeleteRegion(region);
+ GdipDeleteRegion(region100x100);
+ GdipDeleteGraphics(graphics);
+ DeleteDC(hdc);
+}
+
+static void test_clipping_2(void)
+{
+
+ HDC hdc;
+ GpStatus status;
+ GpGraphics *graphics;
+ GpRegion *region;
+ GpMatrix *matrix;
+ GpRectF rect;
+ GpPointF ptf[4];
+ GpUnit unit;
+ HRGN hrgn;
+ int ret;
+ RECT rc;
+
+ hdc = CreateCompatibleDC(0);
+ status = GdipCreateFromHDC(hdc, &graphics);
+ expect(Ok, status);
+
+ status = GdipGetPageUnit(graphics, &unit);
+ expect(Ok, status);
+ expect(UnitDisplay, unit);
+
+ GdipSetPageUnit(graphics, UnitInch);
+
+ status = GdipCreateRegion(®ion);
+ expect(Ok, status);
+ status = GdipSetEmpty(region);
+ expect(Ok, status);
+ rect.X = rect.Y = 100.0;
+ rect.Width = rect.Height = 100.0;
+ status = GdipCombineRegionRect(region, &rect, CombineModeUnion);
+ expect(Ok, status);
+ status = GdipSetClipRegion(graphics, region, CombineModeReplace);
+ expect(Ok, status);
+
+ status = GdipGetClip(graphics, region);
+ expect(Ok, status);
+ status = GdipGetRegionHRgn(region, NULL, &hrgn);
+ expect(Ok, status);
+ ret = GetRgnBox(hrgn, &rc);
+ ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
+ ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
+ "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+ DeleteObject(hrgn);
+ status = GdipGetRegionHRgn(region, graphics, &hrgn);
+ expect(Ok, status);
+ ret = GetRgnBox(hrgn, &rc);
+ ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
+ ok(rc.left == 9600 && rc.top == 9600 && rc.right == 19200 && rc.bottom == 19200,
+ "expected 9600,9600-19200,19200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+ DeleteObject(hrgn);
+
+ ptf[0].X = 9600.0;
+ ptf[0].Y = 9600.0;
+ ptf[1].X = 19200.0;
+ ptf[1].Y = 19200.0;
+ status = GdipTransformPoints(graphics, CoordinateSpaceWorld, CoordinateSpaceDevice, ptf, 2);
+ expect(Ok, status);
+ expectf(100.0, ptf[0].X);
+ expectf(100.0, ptf[0].Y);
+ expectf(200.0, ptf[1].X);
+ expectf(200.0, ptf[1].X);
+
+ GdipSetPageUnit(graphics, UnitPoint);
+
+ status = GdipGetClip(graphics, region);
+ expect(Ok, status);
+ status = GdipGetRegionHRgn(region, NULL, &hrgn);
+ expect(Ok, status);
+ ret = GetRgnBox(hrgn, &rc);
+ ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
+ ok((rc.left == 7200 && rc.top == 7200 && rc.right == 14400 && rc.bottom == 14400) ||
+ broken(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200) /* before Win7 */,
+ "expected 7200,7200-14400,14400, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+ DeleteObject(hrgn);
+ status = GdipGetRegionHRgn(region, graphics, &hrgn);
+ expect(Ok, status);
+ ret = GetRgnBox(hrgn, &rc);
+ ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
+ ok((rc.left == 9600 && rc.top == 9600 && rc.right == 19200 && rc.bottom == 19200) ||
+ broken(rc.left == 134 && rc.top == 134 && rc.right == 267 && rc.bottom == 267) /* before Win7 */,
+ "expected 9600,9600-19200,19200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+ DeleteObject(hrgn);
+
+ ptf[0].X = 9600.0;
+ ptf[0].Y = 9600.0;
+ ptf[1].X = 19200.0;
+ ptf[1].Y = 19200.0;
+ status = GdipTransformPoints(graphics, CoordinateSpaceWorld, CoordinateSpaceDevice, ptf, 2);
+ expect(Ok, status);
+ if (fabs(ptf[0].X - 7200.0) < 0.001)
+ ok(ptf[0].X == 7200.0 && ptf[0].Y == 7200.0 && ptf[1].X == 14400.0 && ptf[1].Y == 14400.0,
+ "expected 7200.0,7200.0-14400.0,14400.0, got %f,%f-%f,%f\n", ptf[0].X, ptf[0].Y, ptf[1].X, ptf[1].Y);
+ else /* before Win7 */
+ {
+ ok(broken(fabs(ptf[0].X - 100.0) < 0.001), "expected 100.0, got %f\n", ptf[0].X);
+ ok(broken(fabs(ptf[0].Y - 100.0) < 0.001), "expected 100.0, got %f\n", ptf[0].Y);
+ ok(broken(fabs(ptf[1].X - 200.0) < 0.001), "expected 200.0, got %f\n", ptf[1].X);
+ ok(broken(fabs(ptf[1].Y - 200.0) < 0.001), "expected 200.0, got %f\n", ptf[1].Y);
+ }
+
+ GdipDeleteRegion(region);
+
+ GdipSetPageUnit(graphics, UnitPixel);
+
+ status = GdipCreateRegion(®ion);
+ expect(Ok, status);
+ status = GdipSetEmpty(region);
+ expect(Ok, status);
+ rect.X = rect.Y = 100.0;
+ rect.Width = rect.Height = 100.0;
+ status = GdipCombineRegionRect(region, &rect, CombineModeUnion);
+ expect(Ok, status);
+ status = GdipSetClipRegion(graphics, region, CombineModeReplace);
+ expect(Ok, status);
+
+ status = GdipGetClip(graphics, region);
+ expect(Ok, status);
+ status = GdipGetRegionHRgn(region, NULL, &hrgn);
+ expect(Ok, status);
+ ret = GetRgnBox(hrgn, &rc);
+ ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
+ ok((rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200) ||
+ broken(rc.left == 2 && rc.top == 2 && rc.right == 3 && rc.bottom == 3) /* before Win7 */,
+ "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+ DeleteObject(hrgn);
+ status = GdipGetRegionHRgn(region, graphics, &hrgn);
+ expect(Ok, status);
+ ret = GetRgnBox(hrgn, &rc);
+ ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
+ ok((rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200) ||
+ broken(rc.left == 2 && rc.top == 2 && rc.right == 3 && rc.bottom == 3) /* before Win7 */,
+ "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+ DeleteObject(hrgn);
+
+ ptf[0].X = 100.0;
+ ptf[0].Y = 100.0;
+ ptf[1].X = 200.0;
+ ptf[1].Y = 200.0;
+ status = GdipTransformPoints(graphics, CoordinateSpaceWorld, CoordinateSpaceDevice, ptf, 2);
+ expect(Ok, status);
+ if (fabs(ptf[0].X - 100.0) < 0.001)
+ ok(ptf[0].X == 100.0 && ptf[0].Y == 100.0 && ptf[1].X == 200.0 && ptf[1].Y == 200.0,
+ "expected 100.0,100.0-200.0,200.0, got %f,%f-%f,%f\n", ptf[0].X, ptf[0].Y, ptf[1].X, ptf[1].Y);
+ else /* before Win7 */
+ {
+ ok(broken(fabs(ptf[0].X - 1.041667) < 0.001), "expected 1.041667, got %f\n", ptf[0].X);
+ ok(broken(fabs(ptf[0].Y - 1.041667) < 0.001), "expected 1.041667, got %f\n", ptf[0].Y);
+ ok(broken(fabs(ptf[1].X - 2.083333) < 0.001), "expected 2.083333, got %f\n", ptf[1].X);
+ ok(broken(fabs(ptf[1].Y - 2.083333) < 0.001), "expected 2.083333, got %f\n", ptf[1].Y);
+ }
+
+ GdipSetPageUnit(graphics, UnitPoint);
+
+ status = GdipGetClip(graphics, region);
+ expect(Ok, status);
+ status = GdipGetRegionHRgn(region, NULL, &hrgn);
+ expect(Ok, status);
+ ret = GetRgnBox(hrgn, &rc);
+ ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
+ ok((rc.left == 75 && rc.top == 75 && rc.right == 150 && rc.bottom == 150) ||
+ broken(rc.left == 2 && rc.top == 2 && rc.right == 3 && rc.bottom == 3) /* before Win7 */,
+ "expected 75,75-150,150, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+ DeleteObject(hrgn);
+ status = GdipGetRegionHRgn(region, graphics, &hrgn);
+ expect(Ok, status);
+ ret = GetRgnBox(hrgn, &rc);
+ ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
+ ok((rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200) ||
+ broken(rc.left == 2 && rc.top == 2 && rc.right == 3 && rc.bottom == 3) /* before Win7 */,
+ "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+ DeleteObject(hrgn);
+
+ ptf[0].X = 100.0;
+ ptf[0].Y = 100.0;
+ ptf[1].X = 200.0;
+ ptf[1].Y = 200.0;
+ status = GdipTransformPoints(graphics, CoordinateSpaceWorld, CoordinateSpaceDevice, ptf, 2);
+ expect(Ok, status);
+ if (fabs(ptf[0].X - 75.0) < 0.001)
+ ok(ptf[0].X == 75.0 && ptf[0].Y == 75.0 && ptf[1].X == 150.0 && ptf[1].Y == 150.0,
+ "expected 75.0,75.0-150.0,150.0, got %f,%f-%f,%f\n", ptf[0].X, ptf[0].Y, ptf[1].X, ptf[1].Y);
+ else /* before Win7 */
+ {
+ ok(broken(fabs(ptf[0].X - 1.041667) < 0.001), "expected 1.041667, got %f\n", ptf[0].X);
+ ok(broken(fabs(ptf[0].Y - 1.041667) < 0.001), "expected 1.041667, got %f\n", ptf[0].Y);
+ ok(broken(fabs(ptf[1].X - 2.083333) < 0.001), "expected 2.083333, got %f\n", ptf[1].X);
+ ok(broken(fabs(ptf[1].Y - 2.083333) < 0.001), "expected 2.083333, got %f\n", ptf[1].Y);
+ }
+
+ status = GdipCreateMatrix(&matrix);
+ expect(Ok, status);
+ status = GdipTranslateMatrix(matrix, 10.0, 10.0, MatrixOrderAppend);
+ expect(Ok, status);
+ status = GdipSetWorldTransform(graphics, matrix);
+ expect(Ok, status);
+ GdipDeleteMatrix(matrix);
+
+ status = GdipGetClip(graphics, region);
+ expect(Ok, status);
+ status = GdipGetRegionHRgn(region, NULL, &hrgn);
+ expect(Ok, status);
+ ret = GetRgnBox(hrgn, &rc);
+ ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
+ ok(rc.left == 65 && rc.top == 65 && rc.right == 140 && rc.bottom == 140,
+ "expected 65,65-140,140, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+ DeleteObject(hrgn);
+ status = GdipGetRegionHRgn(region, graphics, &hrgn);
+ expect(Ok, status);
+ ret = GetRgnBox(hrgn, &rc);
+ ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
+ ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
+ "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+ DeleteObject(hrgn);
+
+ ptf[0].X = 100.0;
+ ptf[0].Y = 100.0;
+ ptf[1].X = 200.0;
+ ptf[1].Y = 200.0;
+ status = GdipTransformPoints(graphics, CoordinateSpaceWorld, CoordinateSpaceDevice, ptf, 2);
+ expect(Ok, status);
+ expectf(65.0, ptf[0].X);
+ expectf(65.0, ptf[0].Y);
+ expectf(140.0, ptf[1].X);
+ expectf(140.0, ptf[1].X);
+
+ status = GdipCreateMatrix(&matrix);
+ expect(Ok, status);
+ status = GdipScaleMatrix(matrix, 0.25, 0.5, MatrixOrderAppend);
+ expect(Ok, status);
+ status = GdipSetWorldTransform(graphics, matrix);
+ expect(Ok, status);
+ GdipDeleteMatrix(matrix);
+
+ status = GdipGetClip(graphics, region);
+ expect(Ok, status);
+ status = GdipGetRegionHRgn(region, NULL, &hrgn);
+ expect(Ok, status);
+ ret = GetRgnBox(hrgn, &rc);
+ ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
+ ok(rc.left == 300 && rc.top == 150 && rc.right == 600 && rc.bottom == 300,
+ "expected 300,150-600,300, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+ DeleteObject(hrgn);
+ status = GdipGetRegionHRgn(region, graphics, &hrgn);
+ expect(Ok, status);
+ ret = GetRgnBox(hrgn, &rc);
+ ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
+ ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
+ "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+ DeleteObject(hrgn);
+
+ ptf[0].X = 100.0;
+ ptf[0].Y = 100.0;
+ ptf[1].X = 200.0;
+ ptf[1].Y = 200.0;
+ status = GdipTransformPoints(graphics, CoordinateSpaceWorld, CoordinateSpaceDevice, ptf, 2);
+ expect(Ok, status);
+ expectf(300.0, ptf[0].X);
+ expectf(150.0, ptf[0].Y);
+ expectf(600.0, ptf[1].X);
+ expectf(300.0, ptf[1].Y);
+
+ status = GdipSetPageScale(graphics, 2.0);
+ expect(Ok, status);
+
+ status = GdipGetClip(graphics, region);
+ expect(Ok, status);
+ status = GdipGetRegionHRgn(region, NULL, &hrgn);
+ expect(Ok, status);
+ ret = GetRgnBox(hrgn, &rc);
+ ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
+ ok((rc.left == 150 && rc.top == 75 && rc.right == 300 && rc.bottom == 150) ||
+ broken(rc.left == 300 && rc.top == 150 && rc.right == 600 && rc.bottom == 300) /* before Win7 */,
+ "expected 150,75-300,150, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+ DeleteObject(hrgn);
+ status = GdipGetRegionHRgn(region, graphics, &hrgn);
+ expect(Ok, status);
+ ret = GetRgnBox(hrgn, &rc);
+ ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
+ ok((rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200) ||
+ broken(rc.left == 200 && rc.top == 200 && rc.right == 400 && rc.bottom == 400) /* before Win7 */,
+ "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+ DeleteObject(hrgn);
+
+ ptf[0].X = 100.0;
+ ptf[0].Y = 100.0;
+ ptf[1].X = 200.0;
+ ptf[1].Y = 200.0;
+ status = GdipTransformPoints(graphics, CoordinateSpaceWorld, CoordinateSpaceDevice, ptf, 2);
+ expect(Ok, status);
+ if (fabs(ptf[0].X - 150.0) < 0.001)
+ {
+ expectf(150.0, ptf[0].X);
+ expectf(75.0, ptf[0].Y);
+ expectf(300.0, ptf[1].X);
+ expectf(150.0, ptf[1].Y);
+ }
+ else /* before Win7 */
+ {
+ ok(broken(fabs(ptf[0].X - 300.0) < 0.001), "expected 300.0, got %f\n", ptf[0].X);
+ ok(broken(fabs(ptf[0].Y - 150.0) < 0.001), "expected 150.0, got %f\n", ptf[0].Y);
+ ok(broken(fabs(ptf[1].X - 600.0) < 0.001), "expected 600.0, got %f\n", ptf[1].X);
+ ok(broken(fabs(ptf[1].Y - 300.0) < 0.001), "expected 300.0, got %f\n", ptf[1].Y);
+ }
+
+ status = GdipCreateMatrix(&matrix);
+ expect(Ok, status);
+ status = GdipRotateMatrix(matrix, 45.0, MatrixOrderAppend);
+ expect(Ok, status);
+ status = GdipSetWorldTransform(graphics, matrix);
+ expect(Ok, status);
+ GdipDeleteMatrix(matrix);
+
+ status = GdipGetClip(graphics, region);
+ expect(Ok, status);
+ status = GdipGetRegionHRgn(region, NULL, &hrgn);
+ expect(Ok, status);
+ ret = GetRgnBox(hrgn, &rc);
+ ok(ret == COMPLEXREGION, "expected COMPLEXREGION, got %d\n", ret);
+ ok((rc.left == 54 && rc.top == -26 && rc.right == 107 && rc.bottom == 27) ||
+ /* rounding under Wine is slightly different */
+ (rc.left == 53 && rc.top == -26 && rc.right == 106 && rc.bottom == 27) /* Wine */,
+ "expected 54,-26-107,27, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+ DeleteObject(hrgn);
+ status = GdipGetRegionHRgn(region, graphics, &hrgn);
+ expect(Ok, status);
+ ret = GetRgnBox(hrgn, &rc);
+ ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
+ ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
+ "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+ DeleteObject(hrgn);
+
+ ptf[0].X = 100.0;
+ ptf[0].Y = 100.0;
+ ptf[1].X = 200.0;
+ ptf[1].Y = 200.0;
+ ptf[2].X = 200.0;
+ ptf[2].Y = 100.0;
+ ptf[3].X = 100.0;
+ ptf[3].Y = 200.0;
+ status = GdipTransformPoints(graphics, CoordinateSpaceWorld, CoordinateSpaceDevice, ptf, 4);
+ expect(Ok, status);
+ expectf(53.033016, ptf[0].X);
+ expectf(0.0, ptf[0].Y);
+ expectf(106.066032, ptf[1].X);
+ expectf(0.0, ptf[1].Y);
+ expectf(79.549522, ptf[2].X);
+ expectf(-26.516510, ptf[2].Y);
+ expectf(79.549522, ptf[3].X);
+ expectf(26.516508, ptf[3].Y);
+
+ status = GdipCreateMatrix(&matrix);
+ expect(Ok, status);
+ status = GdipRotateMatrix(matrix, -45.0, MatrixOrderAppend);
+ expect(Ok, status);
+ status = GdipSetWorldTransform(graphics, matrix);
+ expect(Ok, status);
+ GdipDeleteMatrix(matrix);
+
+ status = GdipGetClip(graphics, region);
+ expect(Ok, status);
+ status = GdipGetRegionHRgn(region, NULL, &hrgn);
+ expect(Ok, status);
+ ret = GetRgnBox(hrgn, &rc);
+ ok(ret == COMPLEXREGION, "expected COMPLEXREGION, got %d\n", ret);
+ ok((rc.left == -26 && rc.top == 54 && rc.right == 27 && rc.bottom == 107) ||
+ /* rounding under Wine is slightly different */
+ (rc.left == -27 && rc.top == 54 && rc.right == 27 && rc.bottom == 106) /* Wine */,
+ "expected -26,54-27,107, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+ DeleteObject(hrgn);
+ status = GdipGetRegionHRgn(region, graphics, &hrgn);
+ expect(Ok, status);
+ ret = GetRgnBox(hrgn, &rc);
+ ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
+ ok(rc.left == 100 && rc.top == 100 && rc.right == 200 && rc.bottom == 200,
+ "expected 100,100-200,200, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
+ DeleteObject(hrgn);
+
+ ptf[0].X = 100.0;
+ ptf[0].Y = 100.0;
+ ptf[1].X = 200.0;
+ ptf[1].Y = 200.0;
+ ptf[2].X = 200.0;
+ ptf[2].Y = 100.0;
+ ptf[3].X = 100.0;
+ ptf[3].Y = 200.0;
+ status = GdipTransformPoints(graphics, CoordinateSpaceWorld, CoordinateSpaceDevice, ptf, 4);
+ expect(Ok, status);
+ expectf(0.0, ptf[0].X);
+ expectf(53.033005, ptf[0].Y);
+ expectf(0.0, ptf[1].X);
+ expectf(106.066010, ptf[1].Y);
+ expectf(26.516491, ptf[2].X);
+ expectf(79.549507, ptf[2].Y);
+ expectf(-26.516520, ptf[3].X);
+ expectf(79.549500, ptf[3].Y);
+
+ GdipDeleteRegion(region);
+ GdipDeleteGraphics(graphics);
+ DeleteDC(hdc);
+}
+
+
+static void test_GdipFillRectangles(void)
+{
+ GpStatus status;
+ GpGraphics *graphics = NULL;
+ GpBrush *brush = NULL;
+ HDC hdc = GetDC( hwnd );
+ GpRectF rects[2] = {{0,0,10,10}, {10,10,10,10}};
+
+ ok(hdc != NULL, "Expected HDC to be initialized\n");
+
+ status = GdipCreateFromHDC(hdc, &graphics);
+ expect(Ok, status);
+ ok(graphics != NULL, "Expected graphics to be initialized\n");
+
+ status = GdipCreateSolidFill((ARGB)0xffff00ff, (GpSolidFill**)&brush);
+ expect(Ok, status);
+ ok(brush != NULL, "Expected brush to be initialized\n");
+
+ status = GdipFillRectangles(NULL, brush, rects, 2);
+ expect(InvalidParameter, status);
+
+ status = GdipFillRectangles(graphics, NULL, rects, 2);
+ expect(InvalidParameter, status);
+
+ status = GdipFillRectangles(graphics, brush, NULL, 2);
+ expect(InvalidParameter, status);
+
+ status = GdipFillRectangles(graphics, brush, rects, 0);
+ expect(InvalidParameter, status);
+
+ status = GdipFillRectangles(graphics, brush, rects, -1);
+ expect(InvalidParameter, status);
+
+ status = GdipFillRectangles(graphics, brush, rects, 1);
+ expect(Ok, status);
+
+ status = GdipFillRectangles(graphics, brush, rects, 2);
+ expect(Ok, status);
+
+ GdipDeleteBrush(brush);
+ GdipDeleteGraphics(graphics);
+
+ ReleaseDC(hwnd, hdc);
+}
+
+static void test_GdipGetVisibleClipBounds_memoryDC(void)
+{
+ HDC hdc,dc;
+ HBITMAP bmp;
+ HGDIOBJ old;
+ RECT rect;
+ POINT pt;
+ int width = 0;
+ int height = 0;
+ GpGraphics* graphics = NULL;
+ GpRect boundRect;
+ GpStatus status;
+
+ ok(GetClientRect(hwnd, &rect), "GetClientRect should have succeeded\n");
+ width = rect.right - rect.left;
+ height = rect.bottom - rect.top;
+
+ dc = GetDC(hwnd);
+ hdc = CreateCompatibleDC ( dc );
+ bmp = CreateCompatibleBitmap ( dc, width, height );
+ old = SelectObject (hdc, bmp);
+
+ /*change the window origin is the key test point*/
+ SetWindowOrgEx (hdc, rect.left+10, rect.top+10, &pt);
+
+ status = GdipCreateFromHDC(hdc, &graphics);
+ expect(Ok, status);
+
+ status = GdipGetVisibleClipBoundsI(graphics, &boundRect);
+ expect(Ok, status);
+
+ ok(boundRect.X==rect.left+10 &&
+ boundRect.Y==rect.top+10 &&
+ boundRect.Width==width &&
+ boundRect.Height==height, "Expected GdipGetVisibleClipBoundsI ok\n");
+
+ status = GdipSetClipRectI(graphics, 0, 0, width, height, CombineModeReplace);
+ expect(Ok, status);
+
+ status = GdipGetVisibleClipBoundsI(graphics, &boundRect);
+ expect(Ok, status);
+
+ ok(boundRect.X==rect.left+10 &&
+ boundRect.Y==rect.top+10 &&
+ boundRect.Width==width-10 &&
+ boundRect.Height==height-10, "Expected GdipGetVisibleClipBoundsI ok\n");
+
+ GdipDeleteGraphics(graphics);
+
+ SelectObject (hdc, old);
+ DeleteObject (bmp);
+ DeleteDC (hdc);
+ ReleaseDC(hwnd, dc);
+}
+
START_TEST(graphics)
{
struct GdiplusStartupInput gdiplusStartupInput;
class.style = CS_HREDRAW | CS_VREDRAW;
class.lpfnWndProc = DefWindowProcA;
class.hInstance = GetModuleHandleA(0);
- class.hIcon = LoadIcon(0, IDI_APPLICATION);
- class.hCursor = LoadCursor(NULL, IDC_ARROW);
+ class.hIcon = LoadIconA(0, (LPCSTR)IDI_APPLICATION);
+ class.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
class.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
RegisterClassA( &class );
hwnd = CreateWindowA( "gdiplus_test", "graphics test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
+ test_clipping();
+ test_clipping_2();
test_measured_extra_space();
test_measure_string();
test_font_height_scaling();
test_transform();
+ test_pen_thickness();
test_GdipMeasureString();
test_constructor_destructor();
test_save_restore();
test_clear();
test_textcontrast();
test_fromMemoryBitmap();
-#if CORE_6659_IS_FIXED
test_string_functions();
-#endif
test_get_set_interpolation();
test_get_set_textrenderinghint();
test_getdc_scaled();
test_alpha_hdc();
test_bitmapfromgraphics();
+ test_GdipFillRectangles();
+ test_GdipGetVisibleClipBounds_memoryDC();
GdiplusShutdown(gdiplusToken);
DestroyWindow( hwnd );