Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(427)

Unified Diff: tests/PictureTest.cpp

Issue 251533004: First pass at GPU veto (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Add counting of AA hairline stroked concave paths Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkPictureRecord.cpp ('k') | tools/skpinfo.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/PictureTest.cpp
===================================================================
--- tests/PictureTest.cpp (revision 14349)
+++ tests/PictureTest.cpp (working copy)
@@ -8,6 +8,7 @@
#include "SkBitmapDevice.h"
#include "SkCanvas.h"
#include "SkColorPriv.h"
+#include "SkDashPathEffect.h"
#include "SkData.h"
#include "SkDecodingImageGenerator.h"
#include "SkError.h"
@@ -694,6 +695,76 @@
}
}
+static void test_gpu_veto(skiatest::Reporter* reporter) {
+
+ SkPictureRecorder recorder;
+
+ SkCanvas* canvas = recorder.beginRecording(100, 100, NULL, 0);
+ {
+ SkPath path;
+ path.moveTo(0, 0);
+ path.lineTo(50, 50);
+
+ SkScalar intervals[] = { 1.0f, 1.0f };
+ SkAutoTUnref<SkDashPathEffect> dash(SkDashPathEffect::Create(intervals, 2, 0));
+
+ SkPaint paint;
+ paint.setStyle(SkPaint::kStroke_Style);
+ paint.setPathEffect(dash);
+
+ canvas->drawPath(path, paint);
+ }
+ SkAutoTUnref<SkPicture> picture(recorder.endRecording());
+ // path effects currently render an SkPicture undesireable for GPU rendering
+ REPORTER_ASSERT(reporter, !picture->suitableForGpuRasterization(NULL));
+
+ canvas = recorder.beginRecording(100, 100, NULL, 0);
+ {
+ SkPath path;
+
+ path.moveTo(0, 0);
+ path.lineTo(0, 50);
+ path.lineTo(25, 25);
+ path.lineTo(50, 50);
+ path.lineTo(50, 0);
+ path.close();
+ REPORTER_ASSERT(reporter, !path.isConvex());
+
+ SkPaint paint;
+ paint.setAntiAlias(true);
+ for (int i = 0; i < 50; ++i) {
+ canvas->drawPath(path, paint);
+ }
+ }
+ picture.reset(recorder.endRecording());
+ // A lot of AA concave paths currently render an SkPicture undesireable for GPU rendering
+ REPORTER_ASSERT(reporter, !picture->suitableForGpuRasterization(NULL));
+
+ canvas = recorder.beginRecording(100, 100, NULL, 0);
+ {
+ SkPath path;
+
+ path.moveTo(0, 0);
+ path.lineTo(0, 50);
+ path.lineTo(25, 25);
+ path.lineTo(50, 50);
+ path.lineTo(50, 0);
+ path.close();
+ REPORTER_ASSERT(reporter, !path.isConvex());
+
+ SkPaint paint;
+ paint.setAntiAlias(true);
+ paint.setStyle(SkPaint::kStroke_Style);
+ paint.setStrokeWidth(0);
+ for (int i = 0; i < 50; ++i) {
+ canvas->drawPath(path, paint);
+ }
+ }
+ picture.reset(recorder.endRecording());
+ // hairline stroked AA concave paths are fine for GPU rendering
+ REPORTER_ASSERT(reporter, picture->suitableForGpuRasterization(NULL));
+}
+
static void set_canvas_to_save_count_4(SkCanvas* canvas) {
canvas->restoreToCount(1);
canvas->save();
@@ -1197,6 +1268,7 @@
#endif
test_unbalanced_save_restores(reporter);
test_peephole();
+ test_gpu_veto(reporter);
test_gatherpixelrefs(reporter);
test_gatherpixelrefsandrects(reporter);
test_bitmap_with_encoded_data(reporter);
« no previous file with comments | « src/core/SkPictureRecord.cpp ('k') | tools/skpinfo.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698