| 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 15 matching lines...) Expand all  Loading... | 
| 26         gCount++; | 26         gCount++; | 
| 27     } | 27     } | 
| 28 | 28 | 
| 29     ~DummyRasterizer() { | 29     ~DummyRasterizer() { | 
| 30         // Not threadsafe. Only used in one thread. | 30         // Not threadsafe. Only used in one thread. | 
| 31         gCount--; | 31         gCount--; | 
| 32     } | 32     } | 
| 33 | 33 | 
| 34     static int GetCount() { return gCount; } | 34     static int GetCount() { return gCount; } | 
| 35 | 35 | 
| 36     SK_DECLARE_NOT_FLATTENABLE_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&) { | 
|  | 47     return SkNEW(DummyRasterizer); | 
|  | 48 } | 
|  | 49 | 
| 46 // 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. | 
| 47 DEF_TEST(LayerRasterizer_destructor, reporter) { | 51 DEF_TEST(LayerRasterizer_destructor, reporter) { | 
| 48     { | 52     { | 
| 49         SkPaint paint; | 53         SkPaint paint; | 
| 50         paint.setRasterizer(SkNEW(DummyRasterizer))->unref(); | 54         paint.setRasterizer(SkNEW(DummyRasterizer))->unref(); | 
| 51         REPORTER_ASSERT(reporter, DummyRasterizer::GetCount() == 1); | 55         REPORTER_ASSERT(reporter, DummyRasterizer::GetCount() == 1); | 
| 52 | 56 | 
| 53         SkLayerRasterizer::Builder builder; | 57         SkLayerRasterizer::Builder builder; | 
| 54         builder.addLayer(paint); | 58         builder.addLayer(paint); | 
| 55     } | 59     } | 
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 133         } else { | 137         } else { | 
| 134             REPORTER_ASSERT(reporter, equals(*recFirstCopy, *recOneLarger)); | 138             REPORTER_ASSERT(reporter, equals(*recFirstCopy, *recOneLarger)); | 
| 135         } | 139         } | 
| 136     } | 140     } | 
| 137 } | 141 } | 
| 138 | 142 | 
| 139 DEF_TEST(LayerRasterizer_detachEmpty, reporter) { | 143 DEF_TEST(LayerRasterizer_detachEmpty, reporter) { | 
| 140     SkLayerRasterizer::Builder builder; | 144     SkLayerRasterizer::Builder builder; | 
| 141     REPORTER_ASSERT(reporter, NULL == builder.detachRasterizer()); | 145     REPORTER_ASSERT(reporter, NULL == builder.detachRasterizer()); | 
| 142 } | 146 } | 
| OLD | NEW | 
|---|