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

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

Issue 1262923003: cache private readback for gpu-images (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: address items in #4 Created 5 years, 4 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/SkBitmapCache.cpp ('k') | src/image/SkImage_Gpu.h » ('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 * 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
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
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 }
OLDNEW
« no previous file with comments | « src/core/SkBitmapCache.cpp ('k') | src/image/SkImage_Gpu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698