Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: tests/LayerRasterizerTest.cpp

Issue 1855733002: change flattenable factory to return sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tests/ImageFilterTest.cpp ('k') | tests/PDFPrimitivesTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « tests/ImageFilterTest.cpp ('k') | tests/PDFPrimitivesTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698