ReleaseDC(hwnd, hdc);
}
+static void test_GdipFillPath(void)
+{
+ GpStatus status;
+ GpGraphics *graphics;
+ GpSolidFill *brush;
+ GpPath *path;
+ HDC hdc = GetDC(hwnd);
+
+ 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)0xffffffff, &brush);
+ expect(Ok, status);
+ ok(brush != NULL, "Expected brush to be initialized\n");
+ status = GdipCreatePath(FillModeAlternate, &path);
+ expect(Ok, status);
+ ok(path != NULL, "Expected path to be initialized\n");
+
+ /* Empty path */
+ GdipResetPath(path);
+ status = GdipFillPath(graphics, (GpBrush *)brush, path);
+ expect(Ok, status);
+
+ /* Not closed path */
+ GdipResetPath(path);
+ status = GdipAddPathLineI(path, 0, 0, 2, 2);
+ expect(Ok, status);
+ status = GdipAddPathLineI(path, 2, 2, 4, 0);
+ expect(Ok, status);
+ status = GdipFillPath(graphics, (GpBrush *)brush, path);
+ expect(Ok, status);
+
+ /* Closed path */
+ GdipResetPath(path);
+ status = GdipAddPathRectangle(path, 0, 0, 4, 4);
+ expect(Ok, status);
+ status = GdipFillPath(graphics, (GpBrush *)brush, path);
+ expect(Ok, status);
+
+ GdipDeletePath(path);
+ GdipDeleteBrush((GpBrush *)brush);
+ GdipDeleteGraphics(graphics);
+ ReleaseDC(hwnd, hdc);
+}
+
static void test_Get_Release_DC(void)
{
GpStatus status;
expect(0xff, color);
GdipDeleteGraphics(graphics);
+ GdipDeleteRegion(clip);
ReleaseDC(hwnd, hdc);
}
expect(Ok, status);
expect(UnitPixel, font_unit);
- for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(td); i++)
{
GpImage *image;
expect(Ok, status);
expect(unit, font_unit);
- for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(td); i++)
{
REAL unit_scale;
GpImage *image;
}
/* Font with units = UnitWorld */
- for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(td); i++)
{
GpPointF pt = {0.0, 100.0};
GpImage* image;
GpPointF ptf[2];
UINT i;
- for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(td); i++)
{
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;
BitmapData bd;
INT min, max, size;
- for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(td); i++)
{
status = GdipCreateBitmapFromScan0(100, 100, 0, PixelFormat24bppRGB, NULL, &u.bitmap);
expect(Ok, status);
test_GdipDrawImagePointsRect();
test_GdipFillClosedCurve();
test_GdipFillClosedCurveI();
+ test_GdipFillPath();
test_GdipDrawString();
test_GdipGetNearestColor();
test_GdipGetVisibleClipBounds();
status = GdipAddPathLine2(path, &(line2_points[6]), 3);
expect(Ok, status);
- ok_path(path, line2_path, sizeof(line2_path)/sizeof(path_test_t), FALSE);
+ ok_path(path, line2_path, ARRAY_SIZE(line2_path), FALSE);
GdipDeletePath(path);
}
status = GdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, 50.0, 0.0);
expect(Ok, status);
- ok_path(path, arc_path, sizeof(arc_path)/sizeof(path_test_t), FALSE);
+ ok_path(path, arc_path, ARRAY_SIZE(arc_path), FALSE);
GdipDeletePath(path);
}
status = GdipAddPathPath(path1, path2, TRUE);
expect(Ok, status);
- ok_path(path1, pathpath_path, sizeof(pathpath_path)/sizeof(path_test_t), FALSE);
+ ok_path(path1, pathpath_path, ARRAY_SIZE(pathpath_path), FALSE);
GdipDeletePath(path1);
GdipDeletePath(path2);
status = GdipAddPathEllipse(path, 10.0, 300.0, 0.0, 1.0);
expect(Ok, status);
- ok_path(path, ellipse_path, sizeof(ellipse_path)/sizeof(path_test_t), FALSE);
+ ok_path(path, ellipse_path, ARRAY_SIZE(ellipse_path), FALSE);
GdipDeletePath(path);
}
status = GdipAddPathLineI(path, 35.0, 35.0, 36.0, 38.0);
expect(Ok, status);
- ok_path(path, linei_path, sizeof(linei_path)/sizeof(path_test_t), FALSE);
+ ok_path(path, linei_path, ARRAY_SIZE(linei_path), FALSE);
GdipDeletePath(path);
}
status = GdipAddPathPolygon(path, points, 5);
expect(Ok, status);
/* check resulting path */
- ok_path(path, poly_path, sizeof(poly_path)/sizeof(path_test_t), FALSE);
+ ok_path(path, poly_path, ARRAY_SIZE(poly_path), FALSE);
GdipDeletePath(path);
}
status = GdipAddPathRectangle(path, 100.0, 50.0, 120.0, 30.0);
expect(Ok, status);
- ok_path(path, rect_path, sizeof(rect_path)/sizeof(path_test_t), FALSE);
+ ok_path(path, rect_path, ARRAY_SIZE(rect_path), FALSE);
GdipDeletePath(path);
status = GdipAddPathRectangles(path, (GDIPCONST GpRectF*)&rects, 2);
expect(Ok, status);
- ok_path(path, rect_path, sizeof(rect_path)/sizeof(path_test_t), FALSE);
+ ok_path(path, rect_path, ARRAY_SIZE(rect_path), FALSE);
GdipDeletePath(path);
}
/* add to empty path */
status = GdipAddPathCurve2(path, points, 4, 1.0);
expect(Ok, status);
- ok_path(path, addcurve_path, sizeof(addcurve_path)/sizeof(path_test_t), FALSE);
+ ok_path(path, addcurve_path, ARRAY_SIZE(addcurve_path), FALSE);
GdipDeletePath(path);
/* add to notempty path and opened figure */
GdipAddPathLine(path, 100.0, 120.0, 123.0, 10.0);
status = GdipAddPathCurve2(path, points, 4, 1.0);
expect(Ok, status);
- ok_path(path, addcurve_path2, sizeof(addcurve_path2)/sizeof(path_test_t), FALSE);
+ ok_path(path, addcurve_path2, ARRAY_SIZE(addcurve_path2), FALSE);
/* NULL args */
GdipResetPath(path);
/* use all points */
status = GdipAddPathCurve3(path, points, 4, 0, 3, 1.0);
expect(Ok, status);
- ok_path(path, addcurve_path, sizeof(addcurve_path)/sizeof(path_test_t), FALSE);
+ ok_path(path, addcurve_path, ARRAY_SIZE(addcurve_path), FALSE);
GdipResetPath(path);
status = GdipAddPathCurve3(path, points, 4, 1, 2, 1.0);
expect(Ok, status);
- ok_path(path, addcurve_path3, sizeof(addcurve_path3)/sizeof(path_test_t), FALSE);
+ ok_path(path, addcurve_path3, ARRAY_SIZE(addcurve_path3), FALSE);
GdipDeletePath(path);
}
/* add to empty path */
status = GdipAddPathClosedCurve2(path, points, 4, 1.0);
expect(Ok, status);
- ok_path(path, addclosedcurve_path, sizeof(addclosedcurve_path)/sizeof(path_test_t), FALSE);
+ ok_path(path, addclosedcurve_path, ARRAY_SIZE(addclosedcurve_path), FALSE);
GdipDeletePath(path);
}
status = GdipReversePath(path);
expect(Ok, status);
- ok_path(path, reverse_path, sizeof(reverse_path)/sizeof(path_test_t), FALSE);
+ ok_path(path, reverse_path, ARRAY_SIZE(reverse_path), FALSE);
GdipDeletePath(path);
}
status = GdipAddPathPie(path, 0.0, 0.0, 100.0, 50.0, 10.0, 50.0);
expect(Ok, status);
- ok_path(path, addpie_path, sizeof(addpie_path)/sizeof(path_test_t), FALSE);
+ ok_path(path, addpie_path, ARRAY_SIZE(addpie_path), FALSE);
status = GdipResetPath(path);
expect(Ok, status);
/* zero width base ellipse */
status = GdipAddPathPie(path, 0.0, 0.0, 0.0, 60.0, -90.0, 24.0);
expect(InvalidParameter, status);
- ok_path(path, addpie_path2, sizeof(addpie_path2)/sizeof(path_test_t), FALSE);
+ ok_path(path, addpie_path2, ARRAY_SIZE(addpie_path2), FALSE);
status = GdipResetPath(path);
expect(Ok, status);
/* zero height base ellipse */
status = GdipAddPathPie(path, 0.0, 0.0, 60.0, 0.0 , -90.0, 24.0);
expect(InvalidParameter, status);
- ok_path(path, addpie_path3, sizeof(addpie_path3)/sizeof(path_test_t), FALSE);
+ ok_path(path, addpie_path3, ARRAY_SIZE(addpie_path3), FALSE);
GdipDeletePath(path);
}
status = GdipFlattenPath(path, NULL, 1.0);
expect(Ok, status);
- ok_path(path, flattenellipse_path, sizeof(flattenellipse_path)/sizeof(path_test_t), TRUE);
+ ok_path(path, flattenellipse_path, ARRAY_SIZE(flattenellipse_path), TRUE);
status = GdipResetPath(path);
expect(Ok, status);
expect(Ok, status);
status = GdipFlattenPath(path, NULL, 1.0);
expect(Ok, status);
- ok_path(path, flattenline_path, sizeof(flattenline_path)/sizeof(path_test_t), FALSE);
+ ok_path(path, flattenline_path, ARRAY_SIZE(flattenline_path), FALSE);
status = GdipResetPath(path);
expect(Ok, status);
expect(Ok, status);
status = GdipFlattenPath(path, NULL, 1.0);
expect(Ok, status);
- ok_path(path, flattenarc_path, sizeof(flattenarc_path)/sizeof(path_test_t), TRUE);
+ ok_path(path, flattenarc_path, ARRAY_SIZE(flattenarc_path), TRUE);
/* easy case - quater of a full circle */
status = GdipResetPath(path);
expect(Ok, status);
status = GdipFlattenPath(path, NULL, 1.0);
expect(Ok, status);
- ok_path(path, flattenquater_path, sizeof(flattenquater_path)/sizeof(path_test_t), FALSE);
+ ok_path(path, flattenquater_path, ARRAY_SIZE(flattenquater_path), FALSE);
GdipDeleteMatrix(m);
GdipDeletePath(path);
status = GdipWidenPath(path, pen, m, 1.0);
expect(Ok, status);
- ok_path(path, widenline_path, sizeof(widenline_path)/sizeof(path_test_t), FALSE);
+ ok_path(path, widenline_path, ARRAY_SIZE(widenline_path), FALSE);
/* horizontal 2x stretch */
status = GdipResetPath(path);
status = GdipWidenPath(path, pen, m, 1.0);
expect(Ok, status);
- ok_path(path, widenline_path, sizeof(widenline_path)/sizeof(path_test_t), FALSE);
+ ok_path(path, widenline_path, ARRAY_SIZE(widenline_path), FALSE);
/* vertical 2x stretch */
status = GdipResetPath(path);
status = GdipWidenPath(path, pen, m, 1.0);
expect(Ok, status);
- ok_path(path, widenline_path, sizeof(widenline_path)/sizeof(path_test_t), FALSE);
+ ok_path(path, widenline_path, ARRAY_SIZE(widenline_path), FALSE);
status = GdipScaleMatrix(m, 1.0, 0.5, MatrixOrderAppend);
expect(Ok, status);
status = GdipWidenPath(path, pen, m, 1.0);
expect(Ok, status);
- ok_path(path, widenline_dash_path, sizeof(widenline_dash_path)/sizeof(path_test_t), FALSE);
+ ok_path(path, widenline_dash_path, ARRAY_SIZE(widenline_dash_path), FALSE);
status = GdipSetPenDashStyle(pen, DashStyleSolid);
expect(Ok, status);
status = GdipWidenPath(path, pen, m, 1.0);
expect(Ok, status);
- ok_path(path, widenline_path, sizeof(widenline_path)/sizeof(path_test_t), FALSE);
+ ok_path(path, widenline_path, ARRAY_SIZE(widenline_path), FALSE);
/* horizontal 2x stretch */
status = GdipResetPath(path);
status = GdipWidenPath(path, pen, m, 1.0);
expect(Ok, status);
- ok_path(path, widenline_path, sizeof(widenline_path)/sizeof(path_test_t), FALSE);
+ ok_path(path, widenline_path, ARRAY_SIZE(widenline_path), FALSE);
/* vertical 2x stretch */
status = GdipResetPath(path);
status = GdipWidenPath(path, pen, m, 1.0);
expect(Ok, status);
- ok_path(path, widenline_wide_path, sizeof(widenline_wide_path)/sizeof(path_test_t), FALSE);
+ ok_path(path, widenline_wide_path, ARRAY_SIZE(widenline_wide_path), FALSE);
status = GdipScaleMatrix(m, 1.0, 0.5, MatrixOrderAppend);
expect(Ok, status);
status = GdipWidenPath(path, pen, m, 1.0);
expect(Ok, status);
- ok_path(path, widenline_path, sizeof(widenline_path)/sizeof(path_test_t), FALSE);
+ ok_path(path, widenline_path, ARRAY_SIZE(widenline_path), FALSE);
/* pen width = 0 pixels - native fails to widen but can draw with this pen */
GdipDeletePen(pen);
char buffer[39];
char buffer2[39];
- StringFromGUID2(got, bufferW, sizeof(bufferW)/sizeof(bufferW[0]));
- WideCharToMultiByte(CP_ACP, 0, bufferW, sizeof(bufferW)/sizeof(bufferW[0]), buffer, sizeof(buffer), NULL, NULL);
- StringFromGUID2(expected, bufferW, sizeof(bufferW)/sizeof(bufferW[0]));
- WideCharToMultiByte(CP_ACP, 0, bufferW, sizeof(bufferW)/sizeof(bufferW[0]), buffer2, sizeof(buffer2), NULL, NULL);
+ StringFromGUID2(got, bufferW, ARRAY_SIZE(bufferW));
+ WideCharToMultiByte(CP_ACP, 0, bufferW, ARRAY_SIZE(bufferW), buffer, sizeof(buffer), NULL, NULL);
+ StringFromGUID2(expected, bufferW, ARRAY_SIZE(bufferW));
+ WideCharToMultiByte(CP_ACP, 0, bufferW, ARRAY_SIZE(bufferW), buffer2, sizeof(buffer2), NULL, NULL);
todo_wine_if (todo)
ok_(__FILE__, line)(IsEqualGUID(expected, got), "Expected %s, got %s\n", buffer2, buffer);
}
char buf[256];
} item;
- for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(td); i++)
{
image = load_image(td[i].image_data, td[i].image_size);
if (!image)
prop_count = 0xdeadbeef;
status = GdipGetPropertyCount(image, &prop_count);
expect(Ok, status);
- ok(prop_count == sizeof(td)/sizeof(td[0]) ||
- broken(prop_count == sizeof(td)/sizeof(td[0]) - 1) /* Win7 SP0 */,
- "expected property count %u, got %u\n", (UINT)(sizeof(td)/sizeof(td[0])), prop_count);
+ ok(prop_count == ARRAY_SIZE(td) ||
+ broken(prop_count == ARRAY_SIZE(td) - 1) /* Win7 SP0 */,
+ "expected property count %u, got %u\n", (UINT) ARRAY_SIZE(td), prop_count);
prop_id = HeapAlloc(GetProcessHeap(), 0, prop_count * sizeof(*prop_id));
prop_count = 0xdeadbeef;
status = GdipGetPropertyCount(image, &prop_count);
expect(Ok, status);
- ok(prop_count == sizeof(td)/sizeof(td[0]),
- "expected property count %u, got %u\n", (UINT)(sizeof(td)/sizeof(td[0])), prop_count);
+ ok(prop_count == ARRAY_SIZE(td),
+ "expected property count %u, got %u\n", (UINT) ARRAY_SIZE(td), prop_count);
prop_id = HeapAlloc(GetProcessHeap(), 0, prop_count * sizeof(*prop_id));
} palette;
ARGB *entries = palette.pal.Entries;
- for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(td); i++)
{
BYTE pixels[sizeof(pixels_24)];
memcpy(pixels, pixels_24, sizeof(pixels_24));
BitmapData data;
UINT i, ret;
- for (i = 0; i < sizeof(fmt)/sizeof(fmt[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(fmt); i++)
{
status = GdipCreateBitmapFromScan0(1, 1, 0, fmt[i], NULL, &bitmap);
ok(status == Ok || broken(status == InvalidParameter) /* before win7 */,
status = GdipSetInterpolationMode(graphics, InterpolationModeNearestNeighbor);
expect(Ok, status);
- for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(td); i++)
{
status = GdipSetPixelOffsetMode(graphics, td[i].pixel_offset_mode);
expect(Ok, status);
status = GdipGetPropertyCount(image, &prop_count);
expect(Ok, status);
- ok(prop_count == sizeof(td)/sizeof(td[0]) || broken(prop_count == 1) /* before win7 */,
- "expected property count %u, got %u\n", (UINT)(sizeof(td)/sizeof(td[0])), prop_count);
+ ok(prop_count == ARRAY_SIZE(td) || broken(prop_count == 1) /* before win7 */,
+ "expected property count %u, got %u\n", (UINT) ARRAY_SIZE(td), prop_count);
- if (prop_count != sizeof(td)/sizeof(td[0]))
+ if (prop_count != ARRAY_SIZE(td))
{
GdipDisposeImage(image);
return;
status = GdipCreateBitmapFromScan0(1, 1, 0, PixelFormat24bppRGB, NULL, &bm);
ok(status == Ok, "GdipCreateBitmapFromScan0 error %d\n", status);
- for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(td); i++)
{
ret = get_encoder_clsid(td[i].mime, &format, &clsid);
ok(ret, "%s encoder is not in the list\n", wine_dbgstr_w(td[i].mime));
stat = pGdipCreateEffect(noneffect, &effect);
todo_wine expect(Win32Error, stat);
- for(i=0; i < sizeof(effectlist) / sizeof(effectlist[0]); i++)
+ for(i=0; i < ARRAY_SIZE(effectlist); i++)
{
stat = pGdipCreateEffect(*effectlist[i], &effect);
todo_wine expect(Ok, stat);
expect(Ok, stat);
expect(256, num);
- for (i = 0; i < sizeof(test_formats)/sizeof(test_formats[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(test_formats); i++)
{
num = 0;
stat = pGdipBitmapGetHistogramSize(test_formats[i], &num);
UINT flags;
int i;
- for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(td); i++)
{
memcpy(buf, png_1x1_data, sizeof(png_1x1_data));
buf[24] = td[i].bit_depth;