| Index: tests/DrawPathTest.cpp
|
| diff --git a/tests/DrawPathTest.cpp b/tests/DrawPathTest.cpp
|
| index 67af75568a5aa3570e69faea6a1626a7297575c9..2af4224c9c4cfaa51c0d885a319dc96e64027b12 100644
|
| --- a/tests/DrawPathTest.cpp
|
| +++ b/tests/DrawPathTest.cpp
|
| @@ -17,7 +17,7 @@
|
| SkPMColor pixel[1];
|
| output.installPixels(SkImageInfo::MakeN32Premul(1, 1), pixel, 4);
|
|
|
| - SkSurface* surf = SkSurface::NewRasterN32Premul(300, 33300);
|
| + SkSurface* surf = SkSurface::NewRasterPMColor(300, 33300);
|
| SkCanvas* canvas = surf->getCanvas();
|
|
|
| SkRect r = { 0, 33000, 300, 33300 };
|
| @@ -94,11 +94,11 @@
|
| moveToH(&path, &data[0]);
|
| cubicToH(&path, &data[2]);
|
|
|
| - SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(640, 480));
|
| -
|
| - SkPaint paint;
|
| - paint.setAntiAlias(true);
|
| - surface->getCanvas()->drawPath(path, paint);
|
| + SkAutoTUnref<SkCanvas> canvas(SkCanvas::NewRasterN32(640, 480));
|
| +
|
| + SkPaint paint;
|
| + paint.setAntiAlias(true);
|
| + canvas->drawPath(path, paint);
|
| }
|
|
|
| // This used to assert in debug builds (and crash writing bad memory in release)
|
| @@ -125,36 +125,38 @@
|
| static void test_inversepathwithclip() {
|
| SkPath path;
|
|
|
| - path.moveTo(0, 20);
|
| - path.quadTo(10, 10, 20, 20);
|
| + path.moveTo(0, SkIntToScalar(20));
|
| + path.quadTo(SkIntToScalar(10), SkIntToScalar(10),
|
| + SkIntToScalar(20), SkIntToScalar(20));
|
| path.toggleInverseFillType();
|
|
|
| SkPaint paint;
|
|
|
| - SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(640, 480));
|
| - SkCanvas* canvas = surface->getCanvas();
|
| - canvas->save();
|
| - canvas->clipRect(SkRect::MakeWH(19, 11));
|
| + SkAutoTUnref<SkCanvas> canvas(SkCanvas::NewRasterN32(640, 480));
|
| + canvas.get()->save();
|
| + canvas.get()->clipRect(SkRect::MakeWH(SkIntToScalar(19), SkIntToScalar(11)));
|
|
|
| paint.setAntiAlias(false);
|
| - canvas->drawPath(path, paint);
|
| - paint.setAntiAlias(true);
|
| - canvas->drawPath(path, paint);
|
| -
|
| - canvas->restore();
|
| + canvas.get()->drawPath(path, paint);
|
| + paint.setAntiAlias(true);
|
| + canvas.get()->drawPath(path, paint);
|
| +
|
| + canvas.get()->restore();
|
|
|
| // Now do the test again, with the path flipped, so we only draw in the
|
| // top half of our bounds, and have the clip intersect our bounds at the
|
| // bottom.
|
| path.reset(); // preserves our filltype
|
| - path.moveTo(0, 10);
|
| - path.quadTo(10, 20, 20, 10);
|
| - canvas->clipRect(SkRect::MakeXYWH(0, 19, 19, 11));
|
| + path.moveTo(0, SkIntToScalar(10));
|
| + path.quadTo(SkIntToScalar(10), SkIntToScalar(20),
|
| + SkIntToScalar(20), SkIntToScalar(10));
|
| + canvas.get()->clipRect(SkRect::MakeXYWH(SkIntToScalar(0), SkIntToScalar(19),
|
| + SkIntToScalar(19), SkIntToScalar(11)));
|
|
|
| paint.setAntiAlias(false);
|
| - canvas->drawPath(path, paint);
|
| - paint.setAntiAlias(true);
|
| - canvas->drawPath(path, paint);
|
| + canvas.get()->drawPath(path, paint);
|
| + paint.setAntiAlias(true);
|
| + canvas.get()->drawPath(path, paint);
|
| }
|
|
|
| static void test_bug533() {
|
| @@ -170,8 +172,8 @@
|
| SkPaint paint;
|
| paint.setAntiAlias(true);
|
|
|
| - SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(640, 480));
|
| - surface->getCanvas()->drawPath(path, paint);
|
| + SkAutoTUnref<SkCanvas> canvas(SkCanvas::NewRasterN32(640, 480));
|
| + canvas.get()->drawPath(path, paint);
|
| }
|
|
|
| static void test_crbug_140642() {
|
| @@ -212,8 +214,8 @@
|
| SkPaint paint;
|
| paint.setAntiAlias(true);
|
|
|
| - SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(640, 480));
|
| - surface->getCanvas()->drawPath(path, paint);
|
| + SkAutoTUnref<SkCanvas> canvas(SkCanvas::NewRasterN32(640, 480));
|
| + canvas.get()->drawPath(path, paint);
|
| }
|
|
|
| // we used to assert if the bounds of the device (clip) was larger than 32K
|
| @@ -222,13 +224,13 @@
|
| static void test_giantaa() {
|
| const int W = 400;
|
| const int H = 400;
|
| - SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(33000, 10));
|
| + SkAutoTUnref<SkCanvas> canvas(SkCanvas::NewRasterN32(33000, 10));
|
|
|
| SkPaint paint;
|
| paint.setAntiAlias(true);
|
| SkPath path;
|
| path.addOval(SkRect::MakeXYWH(-10, -10, 20 + W, 20 + H));
|
| - surface->getCanvas()->drawPath(path, paint);
|
| + canvas.get()->drawPath(path, paint);
|
| }
|
|
|
| // Extremely large path_length/dash_length ratios may cause infinite looping
|
|
|