| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 #include "Test.h" | 7 #include "Test.h" |
| 8 #include "SkBitmap.h" | 8 #include "SkBitmap.h" |
| 9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkDraw.h" | 10 #include "SkDraw.h" |
| 11 #include "SkDevice.h" | 11 #include "SkDevice.h" |
| 12 #include "SkLayerDrawLooper.h" | 12 #include "SkLayerDrawLooper.h" |
| 13 #include "SkMatrix.h" | 13 #include "SkMatrix.h" |
| 14 #include "SkPaint.h" | 14 #include "SkPaint.h" |
| 15 #include "SkRect.h" | 15 #include "SkRect.h" |
| 16 #include "SkRefCnt.h" | 16 #include "SkRefCnt.h" |
| 17 #include "SkScalar.h" | 17 #include "SkScalar.h" |
| 18 #include "SkXfermode.h" | 18 #include "SkXfermode.h" |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 class FakeDevice : public SkDevice { | 22 class FakeDevice : public SkDevice { |
| 23 public: | 23 public: |
| 24 FakeDevice() : SkDevice(SkBitmap::kARGB_8888_Config, 100, 100) { } | 24 FakeDevice() : SkDevice(SkBitmap::kARGB_8888_Config, 100, 100) { } |
| 25 | 25 |
| 26 virtual void drawRect(const SkDraw& draw, const SkRect& r, const SkPaint& pa
int) { | 26 virtual void drawRect(const SkDraw& draw, const SkRect& r, |
| 27 const SkPaint& paint) SK_OVERRIDE { |
| 27 fLastMatrix = *draw.fMatrix; | 28 fLastMatrix = *draw.fMatrix; |
| 28 SkDevice::drawRect(draw, r, paint); | 29 SkDevice::drawRect(draw, r, paint); |
| 29 } | 30 } |
| 30 | 31 |
| 31 SkMatrix fLastMatrix; | 32 SkMatrix fLastMatrix; |
| 32 }; | 33 }; |
| 33 | 34 |
| 34 } // namespace | 35 } // namespace |
| 35 | 36 |
| 36 static void test_frontToBack(skiatest::Reporter* reporter) { | 37 static void test_frontToBack(skiatest::Reporter* reporter) { |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 } | 146 } |
| 146 | 147 |
| 147 static void TestLayerDrawLooper(skiatest::Reporter* reporter) { | 148 static void TestLayerDrawLooper(skiatest::Reporter* reporter) { |
| 148 test_frontToBack(reporter); | 149 test_frontToBack(reporter); |
| 149 test_backToFront(reporter); | 150 test_backToFront(reporter); |
| 150 test_mixed(reporter); | 151 test_mixed(reporter); |
| 151 } | 152 } |
| 152 | 153 |
| 153 #include "TestClassDef.h" | 154 #include "TestClassDef.h" |
| 154 DEFINE_TESTCLASS("LayerDrawLooper", TestLayerDrawLooperClass, TestLayerDrawLoope
r) | 155 DEFINE_TESTCLASS("LayerDrawLooper", TestLayerDrawLooperClass, TestLayerDrawLoope
r) |
| OLD | NEW |