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

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

Issue 137263009: change setAlphaType to not modify the pixelref's genID (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « src/core/SkBitmap.cpp ('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 /* 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 "SkFlattenableBuffers.h" 9 #include "SkFlattenableBuffers.h"
10 #include "SkThread.h" 10 #include "SkThread.h"
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 // We don't invalidate ourselves if we think another SkPixelRef is sharing o ur genID. 247 // We don't invalidate ourselves if we think another SkPixelRef is sharing o ur genID.
248 if (fUniqueGenerationID) { 248 if (fUniqueGenerationID) {
249 for (int i = 0; i < fGenIDChangeListeners.count(); i++) { 249 for (int i = 0; i < fGenIDChangeListeners.count(); i++) {
250 fGenIDChangeListeners[i]->onChange(); 250 fGenIDChangeListeners[i]->onChange();
251 } 251 }
252 } 252 }
253 // Listeners get at most one shot, so whether these triggered or not, blow t hem away. 253 // Listeners get at most one shot, so whether these triggered or not, blow t hem away.
254 fGenIDChangeListeners.deleteAll(); 254 fGenIDChangeListeners.deleteAll();
255 } 255 }
256 256
257 void SkPixelRef::notifyPixelsChanged(SkAlphaType at) { 257 void SkPixelRef::notifyPixelsChanged() {
258 #ifdef SK_DEBUG 258 #ifdef SK_DEBUG
259 if (fIsImmutable) { 259 if (fIsImmutable) {
260 SkDebugf("========== notifyPixelsChanged called on immutable pixelref"); 260 SkDebugf("========== notifyPixelsChanged called on immutable pixelref");
261 } 261 }
262 #endif 262 #endif
263 *const_cast<SkAlphaType*>(&fInfo.fAlphaType) = at;
264 this->callGenIDChangeListeners(); 263 this->callGenIDChangeListeners();
265 this->needsNewGenID(); 264 this->needsNewGenID();
266 } 265 }
267 266
267 void SkPixelRef::changeAlphaType(SkAlphaType at) {
268 *const_cast<SkAlphaType*>(&fInfo.fAlphaType) = at;
269 }
270
268 void SkPixelRef::setImmutable() { 271 void SkPixelRef::setImmutable() {
269 fIsImmutable = true; 272 fIsImmutable = true;
270 } 273 }
271 274
272 bool SkPixelRef::readPixels(SkBitmap* dst, const SkIRect* subset) { 275 bool SkPixelRef::readPixels(SkBitmap* dst, const SkIRect* subset) {
273 return this->onReadPixels(dst, subset); 276 return this->onReadPixels(dst, subset);
274 } 277 }
275 278
276 bool SkPixelRef::onReadPixels(SkBitmap* dst, const SkIRect* subset) { 279 bool SkPixelRef::onReadPixels(SkBitmap* dst, const SkIRect* subset) {
277 return false; 280 return false;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 315
313 #ifdef SK_BUILD_FOR_ANDROID 316 #ifdef SK_BUILD_FOR_ANDROID
314 void SkPixelRef::globalRef(void* data) { 317 void SkPixelRef::globalRef(void* data) {
315 this->ref(); 318 this->ref();
316 } 319 }
317 320
318 void SkPixelRef::globalUnref() { 321 void SkPixelRef::globalUnref() {
319 this->unref(); 322 this->unref();
320 } 323 }
321 #endif 324 #endif
OLDNEW
« no previous file with comments | « src/core/SkBitmap.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698