| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 /* Description: | 9 /* Description: |
| 10 * This test defines a series of elementatry test steps that perform | 10 * This test defines a series of elementatry test steps that perform |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 #include "SkPath.h" | 56 #include "SkPath.h" |
| 57 #include "SkPicture.h" | 57 #include "SkPicture.h" |
| 58 #include "SkPictureRecord.h" | 58 #include "SkPictureRecord.h" |
| 59 #include "SkProxyCanvas.h" | 59 #include "SkProxyCanvas.h" |
| 60 #include "SkRect.h" | 60 #include "SkRect.h" |
| 61 #include "SkRegion.h" | 61 #include "SkRegion.h" |
| 62 #include "SkShader.h" | 62 #include "SkShader.h" |
| 63 #include "SkStream.h" | 63 #include "SkStream.h" |
| 64 #include "SkTDArray.h" | 64 #include "SkTDArray.h" |
| 65 #include "Test.h" | 65 #include "Test.h" |
| 66 #include "TestClassDef.h" |
| 66 | 67 |
| 67 class Canvas2CanvasClipVisitor : public SkCanvas::ClipVisitor { | 68 class Canvas2CanvasClipVisitor : public SkCanvas::ClipVisitor { |
| 68 public: | 69 public: |
| 69 Canvas2CanvasClipVisitor(SkCanvas* target) : fTarget(target) {} | 70 Canvas2CanvasClipVisitor(SkCanvas* target) : fTarget(target) {} |
| 70 | 71 |
| 71 virtual void clipRect(const SkRect& r, SkRegion::Op op, bool aa) { | 72 virtual void clipRect(const SkRect& r, SkRegion::Op op, bool aa) { |
| 72 fTarget->clipRect(r, op, aa); | 73 fTarget->clipRect(r, op, aa); |
| 73 } | 74 } |
| 74 virtual void clipPath(const SkPath& p, SkRegion::Op op, bool aa) { | 75 virtual void clipPath(const SkPath& p, SkRegion::Op op, bool aa) { |
| 75 fTarget->clipPath(p, op, aa); | 76 fTarget->clipPath(p, op, aa); |
| (...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 | 895 |
| 895 if (false) { // avoid bit rot, suppress warning | 896 if (false) { // avoid bit rot, suppress warning |
| 896 TestNWayCanvasStateConsistency(reporter, testStep, referenceCanvas); | 897 TestNWayCanvasStateConsistency(reporter, testStep, referenceCanvas); |
| 897 } | 898 } |
| 898 | 899 |
| 899 if (false) { // avoid bit rot, suppress warning | 900 if (false) { // avoid bit rot, suppress warning |
| 900 test_clipVisitor(reporter, &referenceCanvas); | 901 test_clipVisitor(reporter, &referenceCanvas); |
| 901 } | 902 } |
| 902 } | 903 } |
| 903 | 904 |
| 904 static void TestCanvas(skiatest::Reporter* reporter) { | 905 DEF_TEST(Canvas, reporter) { |
| 905 // Init global here because bitmap pixels cannot be alocated during | 906 // Init global here because bitmap pixels cannot be alocated during |
| 906 // static initialization | 907 // static initialization |
| 907 kTestBitmap = testBitmap(); | 908 kTestBitmap = testBitmap(); |
| 908 | 909 |
| 909 for (int testStep = 0; testStep < testStepArray().count(); testStep++) { | 910 for (int testStep = 0; testStep < testStepArray().count(); testStep++) { |
| 910 TestOverrideStateConsistency(reporter, testStepArray()[testStep]); | 911 TestOverrideStateConsistency(reporter, testStepArray()[testStep]); |
| 911 SkPictureTester::TestPictureFlattenedObjectReuse(reporter, | 912 SkPictureTester::TestPictureFlattenedObjectReuse(reporter, |
| 912 testStepArray()[testStep], 0); | 913 testStepArray()[testStep], 0); |
| 913 if (testStepArray()[testStep]->enablePdfTesting()) { | 914 if (testStepArray()[testStep]->enablePdfTesting()) { |
| 914 TestPdfDevice(reporter, testStepArray()[testStep]); | 915 TestPdfDevice(reporter, testStepArray()[testStep]); |
| 915 } | 916 } |
| 916 } | 917 } |
| 917 | 918 |
| 918 // Explicitly call reset(), so we don't leak the pixels (since kTestBitmap i
s a global) | 919 // Explicitly call reset(), so we don't leak the pixels (since kTestBitmap i
s a global) |
| 919 kTestBitmap.reset(); | 920 kTestBitmap.reset(); |
| 920 } | 921 } |
| 921 | |
| 922 #include "TestClassDef.h" | |
| 923 DEFINE_TESTCLASS("Canvas", TestCanvasClass, TestCanvas) | |
| OLD | NEW |