| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |