| 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&) { | 46 SkFlattenable* DummyRasterizer::CreateProc(SkReadBuffer&) { return new DummyRast
erizer; } |
| 47 return SkNEW(DummyRasterizer); | |
| 48 } | |
| 49 | 47 |
| 50 // Check to make sure that the SkPaint in the layer has its destructor called. | 48 // Check to make sure that the SkPaint in the layer has its destructor called. |
| 51 DEF_TEST(LayerRasterizer_destructor, reporter) { | 49 DEF_TEST(LayerRasterizer_destructor, reporter) { |
| 52 { | 50 { |
| 53 SkPaint paint; | 51 SkPaint paint; |
| 54 paint.setRasterizer(SkNEW(DummyRasterizer))->unref(); | 52 paint.setRasterizer(new DummyRasterizer)->unref(); |
| 55 REPORTER_ASSERT(reporter, DummyRasterizer::GetCount() == 1); | 53 REPORTER_ASSERT(reporter, DummyRasterizer::GetCount() == 1); |
| 56 | 54 |
| 57 SkLayerRasterizer::Builder builder; | 55 SkLayerRasterizer::Builder builder; |
| 58 builder.addLayer(paint); | 56 builder.addLayer(paint); |
| 59 } | 57 } |
| 60 REPORTER_ASSERT(reporter, DummyRasterizer::GetCount() == 0); | 58 REPORTER_ASSERT(reporter, DummyRasterizer::GetCount() == 0); |
| 61 } | 59 } |
| 62 | 60 |
| 63 class LayerRasterizerTester { | 61 class LayerRasterizerTester { |
| 64 public: | 62 public: |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 } else { | 135 } else { |
| 138 REPORTER_ASSERT(reporter, equals(*recFirstCopy, *recOneLarger)); | 136 REPORTER_ASSERT(reporter, equals(*recFirstCopy, *recOneLarger)); |
| 139 } | 137 } |
| 140 } | 138 } |
| 141 } | 139 } |
| 142 | 140 |
| 143 DEF_TEST(LayerRasterizer_detachEmpty, reporter) { | 141 DEF_TEST(LayerRasterizer_detachEmpty, reporter) { |
| 144 SkLayerRasterizer::Builder builder; | 142 SkLayerRasterizer::Builder builder; |
| 145 REPORTER_ASSERT(reporter, NULL == builder.detachRasterizer()); | 143 REPORTER_ASSERT(reporter, NULL == builder.detachRasterizer()); |
| 146 } | 144 } |
| OLD | NEW |