| 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" |
| 11 #include "SkDraw.h" | 11 #include "SkDraw.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 "SkSmallAllocator.h" | 18 #include "SkSmallAllocator.h" |
| 19 #include "SkXfermode.h" | 19 #include "SkXfermode.h" |
| 20 #include "Test.h" | 20 #include "Test.h" |
| 21 | 21 |
| 22 static SkBitmap make_bm(int w, int h) { | 22 static SkBitmap make_bm(int w, int h) { |
| 23 SkBitmap bm; | 23 SkBitmap bm; |
| 24 bm.allocN32Pixels(w, h); | 24 bm.allocN32Pixels(w, h); |
| 25 return bm; | 25 return skstd::move(bm); |
| 26 } | 26 } |
| 27 | 27 |
| 28 // TODO: can this be derived from SkBaseDevice? | 28 // TODO: can this be derived from SkBaseDevice? |
| 29 class FakeDevice : public SkBitmapDevice { | 29 class FakeDevice : public SkBitmapDevice { |
| 30 public: | 30 public: |
| 31 FakeDevice() : INHERITED(make_bm(100, 100), SkSurfaceProps(0, kUnknown_SkPix
elGeometry)) { | 31 FakeDevice() : INHERITED(make_bm(100, 100), SkSurfaceProps(0, kUnknown_SkPix
elGeometry)) { |
| 32 } | 32 } |
| 33 | 33 |
| 34 void drawRect(const SkDraw& draw, const SkRect& r, const SkPaint& paint) ove
rride { | 34 void drawRect(const SkDraw& draw, const SkRect& r, const SkPaint& paint) ove
rride { |
| 35 fLastMatrix = *draw.fMatrix; | 35 fLastMatrix = *draw.fMatrix; |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 | 160 |
| 161 // Only two layers were added, so that should be the end. | 161 // Only two layers were added, so that should be the end. |
| 162 REPORTER_ASSERT(reporter, !context->next(&canvas, &paint)); | 162 REPORTER_ASSERT(reporter, !context->next(&canvas, &paint)); |
| 163 } | 163 } |
| 164 | 164 |
| 165 DEF_TEST(LayerDrawLooper, reporter) { | 165 DEF_TEST(LayerDrawLooper, reporter) { |
| 166 test_frontToBack(reporter); | 166 test_frontToBack(reporter); |
| 167 test_backToFront(reporter); | 167 test_backToFront(reporter); |
| 168 test_mixed(reporter); | 168 test_mixed(reporter); |
| 169 } | 169 } |
| OLD | NEW |