OLD | NEW |
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 "SkBitmapCache.h" | 8 #include "SkBitmapCache.h" |
9 #include "SkMutex.h" | 9 #include "SkMutex.h" |
10 #include "SkPixelRef.h" | 10 #include "SkPixelRef.h" |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 this->onNotifyPixelsChanged(); | 349 this->onNotifyPixelsChanged(); |
350 } | 350 } |
351 | 351 |
352 void SkPixelRef::changeAlphaType(SkAlphaType at) { | 352 void SkPixelRef::changeAlphaType(SkAlphaType at) { |
353 *const_cast<SkImageInfo*>(&fInfo) = fInfo.makeAlphaType(at); | 353 *const_cast<SkImageInfo*>(&fInfo) = fInfo.makeAlphaType(at); |
354 } | 354 } |
355 | 355 |
356 void SkPixelRef::setImmutable() { | 356 void SkPixelRef::setImmutable() { |
357 fMutability = kImmutable; | 357 fMutability = kImmutable; |
358 } | 358 } |
| 359 |
| 360 void SkPixelRef::setImmutableWithID(uint32_t genID) { |
| 361 /* |
| 362 * We are forcing the genID to match an external value. The caller must ens
ure that this |
| 363 * value does not conflict with other content. |
| 364 * |
| 365 * One use is to force this pixelref's id to match an SkImage's id |
| 366 */ |
| 367 fMutability = kImmutable; |
| 368 fTaggedGenID.store(genID); |
| 369 } |
| 370 |
359 void SkPixelRef::setTemporarilyImmutable() { | 371 void SkPixelRef::setTemporarilyImmutable() { |
360 SkASSERT(fMutability != kImmutable); | 372 SkASSERT(fMutability != kImmutable); |
361 fMutability = kTemporarilyImmutable; | 373 fMutability = kTemporarilyImmutable; |
362 } | 374 } |
363 | 375 |
364 void SkPixelRef::restoreMutability() { | 376 void SkPixelRef::restoreMutability() { |
365 SkASSERT(fMutability != kImmutable); | 377 SkASSERT(fMutability != kImmutable); |
366 fMutability = kMutable; | 378 fMutability = kMutable; |
367 } | 379 } |
368 | 380 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 } | 415 } |
404 | 416 |
405 result->fUnlockProc = unlock_legacy_result; | 417 result->fUnlockProc = unlock_legacy_result; |
406 result->fUnlockContext = SkRef(this); // this is balanced in our fUnlockPr
oc | 418 result->fUnlockContext = SkRef(this); // this is balanced in our fUnlockPr
oc |
407 result->fCTable = fRec.fColorTable; | 419 result->fCTable = fRec.fColorTable; |
408 result->fPixels = fRec.fPixels; | 420 result->fPixels = fRec.fPixels; |
409 result->fRowBytes = fRec.fRowBytes; | 421 result->fRowBytes = fRec.fRowBytes; |
410 result->fSize.set(fInfo.width(), fInfo.height()); | 422 result->fSize.set(fInfo.width(), fInfo.height()); |
411 return true; | 423 return true; |
412 } | 424 } |
OLD | NEW |