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 | 7 |
8 #include "SkBitmap.h" | 8 #include "SkBitmap.h" |
9 #include "SkBitmapDevice.h" | 9 #include "SkBitmapDevice.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 return bm; | 25 return bm; |
26 } | 26 } |
27 | 27 |
28 class FakeDevice : public SkBitmapDevice { | 28 class FakeDevice : public SkBitmapDevice { |
29 public: | 29 public: |
30 FakeDevice() : SkBitmapDevice(make_bm(100, 100)) { } | 30 FakeDevice() : SkBitmapDevice(make_bm(100, 100)) { } |
31 | 31 |
32 virtual void drawRect(const SkDraw& draw, const SkRect& r, | 32 virtual void drawRect(const SkDraw& draw, const SkRect& r, |
33 const SkPaint& paint) SK_OVERRIDE { | 33 const SkPaint& paint) SK_OVERRIDE { |
34 fLastMatrix = *draw.fMatrix; | 34 fLastMatrix = *draw.fMatrix; |
35 INHERITED::drawRect(draw, r, paint); | 35 this->INHERITED::drawRect(draw, r, paint); |
36 } | 36 } |
37 | 37 |
38 SkMatrix fLastMatrix; | 38 SkMatrix fLastMatrix; |
39 | 39 |
40 private: | 40 private: |
41 typedef SkBitmapDevice INHERITED; | 41 typedef SkBitmapDevice INHERITED; |
42 }; | 42 }; |
43 | 43 |
44 static void test_frontToBack(skiatest::Reporter* reporter) { | 44 static void test_frontToBack(skiatest::Reporter* reporter) { |
45 SkLayerDrawLooper::Builder looperBuilder; | 45 SkLayerDrawLooper::Builder looperBuilder; |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 | 159 |
160 // Only two layers were added, so that should be the end. | 160 // Only two layers were added, so that should be the end. |
161 REPORTER_ASSERT(reporter, !context->next(&canvas, &paint)); | 161 REPORTER_ASSERT(reporter, !context->next(&canvas, &paint)); |
162 } | 162 } |
163 | 163 |
164 DEF_TEST(LayerDrawLooper, reporter) { | 164 DEF_TEST(LayerDrawLooper, reporter) { |
165 test_frontToBack(reporter); | 165 test_frontToBack(reporter); |
166 test_backToFront(reporter); | 166 test_backToFront(reporter); |
167 test_mixed(reporter); | 167 test_mixed(reporter); |
168 } | 168 } |
OLD | NEW |