OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkFlattenable.h" | 8 #include "SkFlattenable.h" |
9 #include "SkPtrRecorder.h" | 9 #include "SkPtrRecorder.h" |
10 #include "SkReadBuffer.h" | 10 #include "SkReadBuffer.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 } | 35 } |
36 | 36 |
37 const char* SkNamedFactorySet::getNextAddedFactoryName() { | 37 const char* SkNamedFactorySet::getNextAddedFactoryName() { |
38 if (fNextAddedFactory < fNames.count()) { | 38 if (fNextAddedFactory < fNames.count()) { |
39 return fNames[fNextAddedFactory++]; | 39 return fNames[fNextAddedFactory++]; |
40 } | 40 } |
41 return NULL; | 41 return NULL; |
42 } | 42 } |
43 | 43 |
44 /////////////////////////////////////////////////////////////////////////////// | 44 /////////////////////////////////////////////////////////////////////////////// |
45 | |
46 SkRefCntSet::~SkRefCntSet() { | |
47 // call this now, while our decPtr() is sill in scope | |
48 this->reset(); | |
49 } | |
50 | |
51 void SkRefCntSet::incPtr(void* ptr) { | |
52 ((SkRefCnt*)ptr)->ref(); | |
53 } | |
54 | |
55 void SkRefCntSet::decPtr(void* ptr) { | |
56 ((SkRefCnt*)ptr)->unref(); | |
57 } | |
58 | |
59 /////////////////////////////////////////////////////////////////////////////// | |
60 /////////////////////////////////////////////////////////////////////////////// | 45 /////////////////////////////////////////////////////////////////////////////// |
61 /////////////////////////////////////////////////////////////////////////////// | 46 /////////////////////////////////////////////////////////////////////////////// |
62 | 47 |
63 #define MAX_ENTRY_COUNT 1024 | 48 #define MAX_ENTRY_COUNT 1024 |
64 | 49 |
65 struct Entry { | 50 struct Entry { |
66 const char* fName; | 51 const char* fName; |
67 SkFlattenable::Factory fFactory; | 52 SkFlattenable::Factory fFactory; |
68 SkFlattenable::Type fType; | 53 SkFlattenable::Type fType; |
69 }; | 54 }; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 report_no_entries(__FUNCTION__); | 120 report_no_entries(__FUNCTION__); |
136 #endif | 121 #endif |
137 const Entry* entries = gEntries; | 122 const Entry* entries = gEntries; |
138 for (int i = gCount - 1; i >= 0; --i) { | 123 for (int i = gCount - 1; i >= 0; --i) { |
139 if (entries[i].fFactory == fact) { | 124 if (entries[i].fFactory == fact) { |
140 return entries[i].fName; | 125 return entries[i].fName; |
141 } | 126 } |
142 } | 127 } |
143 return NULL; | 128 return NULL; |
144 } | 129 } |
OLD | NEW |