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

Unified Diff: tests/CanvasTest.cpp

Issue 190923002: Add deduping capability to SkPathHeap (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 9 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') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/CanvasTest.cpp
===================================================================
--- tests/CanvasTest.cpp (revision 13690)
+++ tests/CanvasTest.cpp (working copy)
@@ -196,13 +196,26 @@
return matrix;
}
const SkMatrix kTestMatrix = testMatrix();
-static SkPath testPath() {
+static SkPath test_path() {
SkPath path;
path.addRect(SkRect::MakeXYWH(SkIntToScalar(0), SkIntToScalar(0),
SkIntToScalar(2), SkIntToScalar(1)));
return path;
}
-const SkPath kTestPath = testPath();
+const SkPath kTestPath = test_path();
+static SkPath test_nearly_zero_length_path() {
+ SkPath path;
+ SkPoint pt1 = { 0, 0 };
+ SkPoint pt2 = { 0, SK_ScalarNearlyZero };
+ SkPoint pt3 = { SkIntToScalar(1), 0 };
+ SkPoint pt4 = { SkIntToScalar(1), SK_ScalarNearlyZero/2 };
+ path.moveTo(pt1);
+ path.lineTo(pt2);
+ path.lineTo(pt3);
+ path.lineTo(pt4);
+ return path;
+}
+const SkPath kNearlyZeroLengthPath = test_nearly_zero_length_path();
static SkRegion testRegion() {
SkRegion region;
SkIRect rect = SkIRect::MakeXYWH(0, 0, 2, 1);
@@ -449,17 +462,7 @@
paint.setStrokeWidth(SkIntToScalar(1));
paint.setStyle(SkPaint::kStroke_Style);
- SkPath path;
- SkPoint pt1 = { 0, 0 };
- SkPoint pt2 = { 0, SK_ScalarNearlyZero };
- SkPoint pt3 = { SkIntToScalar(1), 0 };
- SkPoint pt4 = { SkIntToScalar(1), SK_ScalarNearlyZero/2 };
- path.moveTo(pt1);
- path.lineTo(pt2);
- path.lineTo(pt3);
- path.lineTo(pt4);
-
- canvas->drawPath(path, paint);
+ canvas->drawPath(kNearlyZeroLengthPath, paint);
}
TEST_STEP(DrawNearlyZeroLengthPath, DrawNearlyZeroLengthPathTestStep);
« no previous file with comments | « src/core/SkPictureRecord.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698