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() { | 257 void SkPixelRef::notifyPixelsChanged(SkAlphaType at) { |
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; |
263 this->callGenIDChangeListeners(); | 264 this->callGenIDChangeListeners(); |
264 this->needsNewGenID(); | 265 this->needsNewGenID(); |
265 } | 266 } |
266 | 267 |
267 void SkPixelRef::setImmutable() { | 268 void SkPixelRef::setImmutable() { |
268 fIsImmutable = true; | 269 fIsImmutable = true; |
269 } | 270 } |
270 | 271 |
271 bool SkPixelRef::readPixels(SkBitmap* dst, const SkIRect* subset) { | 272 bool SkPixelRef::readPixels(SkBitmap* dst, const SkIRect* subset) { |
272 return this->onReadPixels(dst, subset); | 273 return this->onReadPixels(dst, subset); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 | 312 |
312 #ifdef SK_BUILD_FOR_ANDROID | 313 #ifdef SK_BUILD_FOR_ANDROID |
313 void SkPixelRef::globalRef(void* data) { | 314 void SkPixelRef::globalRef(void* data) { |
314 this->ref(); | 315 this->ref(); |
315 } | 316 } |
316 | 317 |
317 void SkPixelRef::globalUnref() { | 318 void SkPixelRef::globalUnref() { |
318 this->unref(); | 319 this->unref(); |
319 } | 320 } |
320 #endif | 321 #endif |
OLD | NEW |