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

Side by Side Diff: src/core/SkPixelRef.cpp

Issue 752203002: Add an Android-framework-only stable ID to SkPixelRef. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Refine comments. Created 6 years 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 | « include/core/SkPixelRef.h ('k') | no next file » | 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 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 80
81 // just need a > 0 value, so pick a funny one to aid in debugging 81 // just need a > 0 value, so pick a funny one to aid in debugging
82 #define SKPIXELREF_PRELOCKED_LOCKCOUNT 123456789 82 #define SKPIXELREF_PRELOCKED_LOCKCOUNT 123456789
83 83
84 static SkImageInfo validate_info(const SkImageInfo& info) { 84 static SkImageInfo validate_info(const SkImageInfo& info) {
85 SkAlphaType newAlphaType = info.alphaType(); 85 SkAlphaType newAlphaType = info.alphaType();
86 SkAssertResult(SkColorTypeValidateAlphaType(info.colorType(), info.alphaType (), &newAlphaType)); 86 SkAssertResult(SkColorTypeValidateAlphaType(info.colorType(), info.alphaType (), &newAlphaType));
87 return info.makeAlphaType(newAlphaType); 87 return info.makeAlphaType(newAlphaType);
88 } 88 }
89 89
90 SkPixelRef::SkPixelRef(const SkImageInfo& info) : fInfo(validate_info(info)) { 90 SkPixelRef::SkPixelRef(const SkImageInfo& info)
91 : fInfo(validate_info(info))
92 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
93 , fStableID(SkNextPixelRefGenerationID())
94 #endif
95
96 {
91 this->setMutex(NULL); 97 this->setMutex(NULL);
92 fRec.zero(); 98 fRec.zero();
93 fLockCount = 0; 99 fLockCount = 0;
94 this->needsNewGenID(); 100 this->needsNewGenID();
95 fIsImmutable = false; 101 fIsImmutable = false;
96 fPreLocked = false; 102 fPreLocked = false;
97 } 103 }
98 104
99 105
100 SkPixelRef::SkPixelRef(const SkImageInfo& info, SkBaseMutex* mutex) : fInfo(vali date_info(info)) { 106 SkPixelRef::SkPixelRef(const SkImageInfo& info, SkBaseMutex* mutex)
107 : fInfo(validate_info(info))
108 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
109 , fStableID(SkNextPixelRefGenerationID())
110 #endif
111 {
101 this->setMutex(mutex); 112 this->setMutex(mutex);
102 fRec.zero(); 113 fRec.zero();
103 fLockCount = 0; 114 fLockCount = 0;
104 this->needsNewGenID(); 115 this->needsNewGenID();
105 fIsImmutable = false; 116 fIsImmutable = false;
106 fPreLocked = false; 117 fPreLocked = false;
107 } 118 }
108 119
109 SkPixelRef::~SkPixelRef() { 120 SkPixelRef::~SkPixelRef() {
110 this->callGenIDChangeListeners(); 121 this->callGenIDChangeListeners();
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 277
267 #ifdef SK_BUILD_FOR_ANDROID 278 #ifdef SK_BUILD_FOR_ANDROID
268 void SkPixelRef::globalRef(void* data) { 279 void SkPixelRef::globalRef(void* data) {
269 this->ref(); 280 this->ref();
270 } 281 }
271 282
272 void SkPixelRef::globalUnref() { 283 void SkPixelRef::globalUnref() {
273 this->unref(); 284 this->unref();
274 } 285 }
275 #endif 286 #endif
OLDNEW
« no previous file with comments | « include/core/SkPixelRef.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698