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

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

Issue 308683005: setConfig -> setInfo (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: missed one setConfig (release only) Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « src/images/SkImageRef.cpp ('k') | src/lazy/SkDiscardablePixelRef.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 "SkScaledImageCache.h" 9 #include "SkScaledImageCache.h"
10 10
11 bool SkCachingPixelRef::Install(SkImageGenerator* generator, 11 bool SkCachingPixelRef::Install(SkImageGenerator* generator,
12 SkBitmap* dst) { 12 SkBitmap* dst) {
13 SkImageInfo info; 13 SkImageInfo info;
14 SkASSERT(dst != NULL); 14 SkASSERT(dst != NULL);
15 if ((NULL == generator) 15 if ((NULL == generator)
16 || !(generator->getInfo(&info)) 16 || !(generator->getInfo(&info))
17 || !dst->setConfig(info, 0)) { 17 || !dst->setInfo(info)) {
18 SkDELETE(generator); 18 SkDELETE(generator);
19 return false; 19 return false;
20 } 20 }
21 SkAutoTUnref<SkCachingPixelRef> ref(SkNEW_ARGS(SkCachingPixelRef, 21 SkAutoTUnref<SkCachingPixelRef> ref(SkNEW_ARGS(SkCachingPixelRef,
22 (info, generator, dst->rowBytes()))); 22 (info, generator, dst->rowBytes())));
23 dst->setPixelRef(ref); 23 dst->setPixelRef(ref);
24 return true; 24 return true;
25 } 25 }
26 26
27 SkCachingPixelRef::SkCachingPixelRef(const SkImageInfo& info, 27 SkCachingPixelRef::SkCachingPixelRef(const SkImageInfo& info,
(...skipping 19 matching lines...) Expand all
47 47
48 const SkImageInfo& info = this->info(); 48 const SkImageInfo& info = this->info();
49 SkBitmap bitmap; 49 SkBitmap bitmap;
50 SkASSERT(NULL == fScaledCacheId); 50 SkASSERT(NULL == fScaledCacheId);
51 fScaledCacheId = SkScaledImageCache::FindAndLock(this->getGenerationID(), 51 fScaledCacheId = SkScaledImageCache::FindAndLock(this->getGenerationID(),
52 info.fWidth, 52 info.fWidth,
53 info.fHeight, 53 info.fHeight,
54 &bitmap); 54 &bitmap);
55 if (NULL == fScaledCacheId) { 55 if (NULL == fScaledCacheId) {
56 // Cache has been purged, must re-decode. 56 // Cache has been purged, must re-decode.
57 if ((!bitmap.setConfig(info, fRowBytes)) || !bitmap.allocPixels()) { 57 if ((!bitmap.setInfo(info, fRowBytes)) || !bitmap.allocPixels()) {
58 fErrorInDecoding = true; 58 fErrorInDecoding = true;
59 return false; 59 return false;
60 } 60 }
61 SkAutoLockPixels autoLockPixels(bitmap); 61 SkAutoLockPixels autoLockPixels(bitmap);
62 if (!fImageGenerator->getPixels(info, bitmap.getPixels(), fRowBytes)) { 62 if (!fImageGenerator->getPixels(info, bitmap.getPixels(), fRowBytes)) {
63 fErrorInDecoding = true; 63 fErrorInDecoding = true;
64 return false; 64 return false;
65 } 65 }
66 fScaledCacheId = SkScaledImageCache::AddAndLock(this->getGenerationID(), 66 fScaledCacheId = SkScaledImageCache::AddAndLock(this->getGenerationID(),
67 info.fWidth, 67 info.fWidth,
(...skipping 20 matching lines...) Expand all
88 rec->fColorTable = NULL; 88 rec->fColorTable = NULL;
89 rec->fRowBytes = bitmap.rowBytes(); 89 rec->fRowBytes = bitmap.rowBytes();
90 return true; 90 return true;
91 } 91 }
92 92
93 void SkCachingPixelRef::onUnlockPixels() { 93 void SkCachingPixelRef::onUnlockPixels() {
94 SkASSERT(fScaledCacheId != NULL); 94 SkASSERT(fScaledCacheId != NULL);
95 SkScaledImageCache::Unlock( static_cast<SkScaledImageCache::ID*>(fScaledCach eId)); 95 SkScaledImageCache::Unlock( static_cast<SkScaledImageCache::ID*>(fScaledCach eId));
96 fScaledCacheId = NULL; 96 fScaledCacheId = NULL;
97 } 97 }
OLDNEW
« no previous file with comments | « src/images/SkImageRef.cpp ('k') | src/lazy/SkDiscardablePixelRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698