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

Side by Side Diff: src/lazy/SkCachingPixelRef.cpp

Issue 960563002: only notify bitmaps that have been added to the cache (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: address reviewer comments Created 5 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
« no previous file with comments | « src/gpu/SkGrPixelRef.cpp ('k') | tests/SkResourceCacheTest.cpp » ('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 2013 Google Inc. 2 * Copyright 2013 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 "SkCachingPixelRef.h" 8 #include "SkCachingPixelRef.h"
9 #include "SkBitmapCache.h" 9 #include "SkBitmapCache.h"
10 #include "SkRect.h" 10 #include "SkRect.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 fLockedBitmap.getPixels(), fRowBytes); 56 fLockedBitmap.getPixels(), fRowBytes);
57 switch (result) { 57 switch (result) {
58 case SkImageGenerator::kIncompleteInput: 58 case SkImageGenerator::kIncompleteInput:
59 case SkImageGenerator::kSuccess: 59 case SkImageGenerator::kSuccess:
60 break; 60 break;
61 default: 61 default:
62 fErrorInDecoding = true; 62 fErrorInDecoding = true;
63 return false; 63 return false;
64 } 64 }
65 fLockedBitmap.setImmutable(); 65 fLockedBitmap.setImmutable();
66 SkBitmapCache::Add( 66 SkBitmapCache::Add(this, info.bounds(), fLockedBitmap);
67 this->getGenerationID(), info.bounds(), fLockedBitmap);
68 } 67 }
69 68
70 // Now bitmap should contain a concrete PixelRef of the decoded image. 69 // Now bitmap should contain a concrete PixelRef of the decoded image.
71 void* pixels = fLockedBitmap.getPixels(); 70 void* pixels = fLockedBitmap.getPixels();
72 SkASSERT(pixels != NULL); 71 SkASSERT(pixels != NULL);
73 rec->fPixels = pixels; 72 rec->fPixels = pixels;
74 rec->fColorTable = NULL; 73 rec->fColorTable = NULL;
75 rec->fRowBytes = fLockedBitmap.rowBytes(); 74 rec->fRowBytes = fLockedBitmap.rowBytes();
76 return true; 75 return true;
77 } 76 }
78 77
79 void SkCachingPixelRef::onUnlockPixels() { 78 void SkCachingPixelRef::onUnlockPixels() {
80 fLockedBitmap.reset(); 79 fLockedBitmap.reset();
81 } 80 }
OLDNEW
« no previous file with comments | « src/gpu/SkGrPixelRef.cpp ('k') | tests/SkResourceCacheTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698