diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-03-07 18:42:15 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-03-07 18:42:15 +0000 |
commit | 8c2ee5963505cdbe128f68d67f064a3901d22a3c (patch) | |
tree | abb06d179c019cb80fe7bbdc78abb5a66d9e113b /tests | |
parent | 0fd5270ad69f5b99852d544158c989d2deda2c11 (diff) |
Once Chromium starts holding on to paths and we can actually reuse cached path data (e.g., masks & geometry) we will need a way to preserve that reuse in the skps. This CL begins adding that capability. More analysis & profiling needs to be done before it is always enabled.
When enabled it does make the disabled path de-duping test in the Canvas unit test pass.
BUG=skia:507
R=bsalomon@google.com, mtklein@google.com
Author: robertphillips@google.com
Review URL: https://codereview.chromium.org/190923002
git-svn-id: http://skia.googlecode.com/svn/trunk@13709 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests')
-rw-r--r-- | tests/CanvasTest.cpp | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/tests/CanvasTest.cpp b/tests/CanvasTest.cpp index c9a7db18e9..b3a63f1cbe 100644 --- a/tests/CanvasTest.cpp +++ b/tests/CanvasTest.cpp @@ -196,13 +196,26 @@ static SkMatrix testMatrix() { 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 @@ static void DrawNearlyZeroLengthPathTestStep(SkCanvas* canvas, 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); |