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

Side by Side Diff: include/core/SkFlattenable.h

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 | « gm/imagefiltersgraph.cpp ('k') | include/effects/SkLayerDrawLooper.h » ('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 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 #ifndef SkFlattenable_DEFINED 8 #ifndef SkFlattenable_DEFINED
9 #define SkFlattenable_DEFINED 9 #define SkFlattenable_DEFINED
10 10
(...skipping 30 matching lines...) Expand all
41 41
42 #define SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END \ 42 #define SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END \
43 } 43 }
44 44
45 #define SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(flattenable) \ 45 #define SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(flattenable) \
46 SkFlattenable::Register(#flattenable, flattenable::CreateProc, \ 46 SkFlattenable::Register(#flattenable, flattenable::CreateProc, \
47 flattenable::GetFlattenableType()); 47 flattenable::GetFlattenableType());
48 48
49 #define SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(flattenable) \ 49 #define SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(flattenable) \
50 private: \ 50 private: \
51 static SkFlattenable* CreateProc(SkReadBuffer&); \ 51 static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&); \
52 friend class SkFlattenable::PrivateInitializer; \ 52 friend class SkFlattenable::PrivateInitializer; \
53 public: \ 53 public: \
54 Factory getFactory() const override { return CreateProc; } 54 Factory getFactory() const override { return CreateProc; }
55 55
56 /** For SkFlattenable derived objects with a valid type 56 /** For SkFlattenable derived objects with a valid type
57 This macro should only be used in base class objects in core 57 This macro should only be used in base class objects in core
58 */ 58 */
59 #define SK_DEFINE_FLATTENABLE_TYPE(flattenable) \ 59 #define SK_DEFINE_FLATTENABLE_TYPE(flattenable) \
60 static Type GetFlattenableType() { \ 60 static Type GetFlattenableType() { \
61 return k##flattenable##_Type; \ 61 return k##flattenable##_Type; \
(...skipping 13 matching lines...) Expand all
75 kSkImageFilter_Type, 75 kSkImageFilter_Type,
76 kSkMaskFilter_Type, 76 kSkMaskFilter_Type,
77 kSkPathEffect_Type, 77 kSkPathEffect_Type,
78 kSkPixelRef_Type, 78 kSkPixelRef_Type,
79 kSkRasterizer_Type, 79 kSkRasterizer_Type,
80 kSkShader_Type, 80 kSkShader_Type,
81 kSkUnused_Type, // used to be SkUnitMapper 81 kSkUnused_Type, // used to be SkUnitMapper
82 kSkXfermode_Type, 82 kSkXfermode_Type,
83 }; 83 };
84 84
85 typedef SkFlattenable* (*Factory)(SkReadBuffer&); 85 typedef sk_sp<SkFlattenable> (*Factory)(SkReadBuffer&);
86 86
87 SkFlattenable() {} 87 SkFlattenable() {}
88 88
89 /** Implement this to return a factory function pointer that can be called 89 /** Implement this to return a factory function pointer that can be called
90 to recreate your class given a buffer (previously written to by your 90 to recreate your class given a buffer (previously written to by your
91 override of flatten(). 91 override of flatten().
92 */ 92 */
93 virtual Factory getFactory() const = 0; 93 virtual Factory getFactory() const = 0;
94 94
95 /** Returns the name of the object's class 95 /** Returns the name of the object's class
(...skipping 21 matching lines...) Expand all
117 117
118 private: 118 private:
119 static void InitializeFlattenablesIfNeeded(); 119 static void InitializeFlattenablesIfNeeded();
120 120
121 friend class SkGraphics; 121 friend class SkGraphics;
122 122
123 typedef SkRefCnt INHERITED; 123 typedef SkRefCnt INHERITED;
124 }; 124 };
125 125
126 #endif 126 #endif
OLDNEW
« no previous file with comments | « gm/imagefiltersgraph.cpp ('k') | include/effects/SkLayerDrawLooper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698