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 "SkPixelRef.h" | 8 #include "SkPixelRef.h" |
9 #include "SkThread.h" | 9 #include "SkThread.h" |
10 | 10 |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 } | 196 } |
197 | 197 |
198 uint32_t SkPixelRef::getGenerationID() const { | 198 uint32_t SkPixelRef::getGenerationID() const { |
199 if (0 == fGenerationID) { | 199 if (0 == fGenerationID) { |
200 fGenerationID = SkNextPixelRefGenerationID(); | 200 fGenerationID = SkNextPixelRefGenerationID(); |
201 fUniqueGenerationID = true; // The only time we can be sure of this! | 201 fUniqueGenerationID = true; // The only time we can be sure of this! |
202 } | 202 } |
203 return fGenerationID; | 203 return fGenerationID; |
204 } | 204 } |
205 | 205 |
| 206 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK |
| 207 uint32_t SkPixelRef::getStableID() const { |
| 208 if (0 == fStableID) { |
| 209 // Although it is okay for the stable ID to collide with a gen ID, it |
| 210 // is also okay for them not to collide, and this allows us to share |
| 211 // code. |
| 212 fStableID = SkNextPixelRefGenerationID(); |
| 213 } |
| 214 return fStableID; |
| 215 } |
| 216 #endif |
| 217 |
206 void SkPixelRef::addGenIDChangeListener(GenIDChangeListener* listener) { | 218 void SkPixelRef::addGenIDChangeListener(GenIDChangeListener* listener) { |
207 if (NULL == listener || !fUniqueGenerationID) { | 219 if (NULL == listener || !fUniqueGenerationID) { |
208 // No point in tracking this if we're not going to call it. | 220 // No point in tracking this if we're not going to call it. |
209 SkDELETE(listener); | 221 SkDELETE(listener); |
210 return; | 222 return; |
211 } | 223 } |
212 *fGenIDChangeListeners.append() = listener; | 224 *fGenIDChangeListeners.append() = listener; |
213 } | 225 } |
214 | 226 |
215 void SkPixelRef::callGenIDChangeListeners() { | 227 void SkPixelRef::callGenIDChangeListeners() { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 | 278 |
267 #ifdef SK_BUILD_FOR_ANDROID | 279 #ifdef SK_BUILD_FOR_ANDROID |
268 void SkPixelRef::globalRef(void* data) { | 280 void SkPixelRef::globalRef(void* data) { |
269 this->ref(); | 281 this->ref(); |
270 } | 282 } |
271 | 283 |
272 void SkPixelRef::globalUnref() { | 284 void SkPixelRef::globalUnref() { |
273 this->unref(); | 285 this->unref(); |
274 } | 286 } |
275 #endif | 287 #endif |
OLD | NEW |