OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "SkDeque.h" | 8 #include "SkDeque.h" |
9 #include "SkLayerRasterizer.h" | 9 #include "SkLayerRasterizer.h" |
10 #include "SkPaint.h" | 10 #include "SkPaint.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(DummyRasterizer); | 36 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(DummyRasterizer); |
37 | 37 |
38 private: | 38 private: |
39 static int gCount; | 39 static int gCount; |
40 | 40 |
41 typedef SkRasterizer INHERITED; | 41 typedef SkRasterizer INHERITED; |
42 }; | 42 }; |
43 | 43 |
44 int DummyRasterizer::gCount; | 44 int DummyRasterizer::gCount; |
45 | 45 |
46 SkFlattenable* DummyRasterizer::CreateProc(SkReadBuffer&) { return new DummyRast
erizer; } | 46 sk_sp<SkFlattenable> DummyRasterizer::CreateProc(SkReadBuffer&) { |
| 47 return sk_make_sp<DummyRasterizer>(); |
| 48 } |
47 | 49 |
48 // Check to make sure that the SkPaint in the layer has its destructor called. | 50 // Check to make sure that the SkPaint in the layer has its destructor called. |
49 DEF_TEST(LayerRasterizer_destructor, reporter) { | 51 DEF_TEST(LayerRasterizer_destructor, reporter) { |
50 { | 52 { |
51 SkPaint paint; | 53 SkPaint paint; |
52 paint.setRasterizer(sk_make_sp<DummyRasterizer>()); | 54 paint.setRasterizer(sk_make_sp<DummyRasterizer>()); |
53 REPORTER_ASSERT(reporter, DummyRasterizer::GetCount() == 1); | 55 REPORTER_ASSERT(reporter, DummyRasterizer::GetCount() == 1); |
54 | 56 |
55 SkLayerRasterizer::Builder builder; | 57 SkLayerRasterizer::Builder builder; |
56 builder.addLayer(paint); | 58 builder.addLayer(paint); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 } else { | 137 } else { |
136 REPORTER_ASSERT(reporter, equals(*recFirstCopy, *recOneLarger)); | 138 REPORTER_ASSERT(reporter, equals(*recFirstCopy, *recOneLarger)); |
137 } | 139 } |
138 } | 140 } |
139 } | 141 } |
140 | 142 |
141 DEF_TEST(LayerRasterizer_detachEmpty, reporter) { | 143 DEF_TEST(LayerRasterizer_detachEmpty, reporter) { |
142 SkLayerRasterizer::Builder builder; | 144 SkLayerRasterizer::Builder builder; |
143 REPORTER_ASSERT(reporter, nullptr == builder.detach()); | 145 REPORTER_ASSERT(reporter, nullptr == builder.detach()); |
144 } | 146 } |
OLD | NEW |