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

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

Issue 387313004: remove SK_SUPPORT_LEGACY_PIXELREF_UNFLATTENABLE code (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 5 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 | « src/core/SkMallocPixelRef.cpp ('k') | src/core/SkScaledImageCache.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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "SkPixelRef.h" 8 #include "SkPixelRef.h"
9 #include "SkReadBuffer.h" 9 #include "SkReadBuffer.h"
10 #include "SkWriteBuffer.h" 10 #include "SkWriteBuffer.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 const_cast<SkAlphaType*>(&fInfo. fAlphaType))); 101 const_cast<SkAlphaType*>(&fInfo. fAlphaType)));
102 102
103 this->setMutex(mutex); 103 this->setMutex(mutex);
104 fRec.zero(); 104 fRec.zero();
105 fLockCount = 0; 105 fLockCount = 0;
106 this->needsNewGenID(); 106 this->needsNewGenID();
107 fIsImmutable = false; 107 fIsImmutable = false;
108 fPreLocked = false; 108 fPreLocked = false;
109 } 109 }
110 110
111 #ifdef SK_SUPPORT_LEGACY_PIXELREF_UNFLATTENABLE
112 static SkImageInfo read_info(SkReadBuffer& buffer) {
113 SkImageInfo info;
114 info.unflatten(buffer);
115 return info;
116 }
117
118 SkPixelRef::SkPixelRef(SkReadBuffer& buffer, SkBaseMutex* mutex)
119 : INHERITED(buffer)
120 , fInfo(read_info(buffer))
121 {
122 SkDEBUGCODE(SkAlphaType alphaType;)
123 SkASSERT(SkColorTypeValidateAlphaType(fInfo.colorType(), fInfo.alphaType(), &alphaType));
124 SkASSERT(fInfo.fAlphaType == alphaType);
125
126 this->setMutex(mutex);
127 fRec.zero();
128 fLockCount = 0;
129 fIsImmutable = buffer.readBool();
130 fGenerationID = buffer.readUInt();
131 fUniqueGenerationID = false; // Conservatively assuming the original still exists.
132 fPreLocked = false;
133 }
134 #endif
135
136 SkPixelRef::~SkPixelRef() { 111 SkPixelRef::~SkPixelRef() {
137 this->callGenIDChangeListeners(); 112 this->callGenIDChangeListeners();
138 } 113 }
139 114
140 void SkPixelRef::needsNewGenID() { 115 void SkPixelRef::needsNewGenID() {
141 fGenerationID = 0; 116 fGenerationID = 0;
142 fUniqueGenerationID = false; 117 fUniqueGenerationID = false;
143 } 118 }
144 119
145 void SkPixelRef::cloneGenID(const SkPixelRef& that) { 120 void SkPixelRef::cloneGenID(const SkPixelRef& that) {
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 263
289 #ifdef SK_BUILD_FOR_ANDROID 264 #ifdef SK_BUILD_FOR_ANDROID
290 void SkPixelRef::globalRef(void* data) { 265 void SkPixelRef::globalRef(void* data) {
291 this->ref(); 266 this->ref();
292 } 267 }
293 268
294 void SkPixelRef::globalUnref() { 269 void SkPixelRef::globalUnref() {
295 this->unref(); 270 this->unref();
296 } 271 }
297 #endif 272 #endif
OLDNEW
« no previous file with comments | « src/core/SkMallocPixelRef.cpp ('k') | src/core/SkScaledImageCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698