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

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

Issue 137133003: Revert of add SkBitmap::installPixelRef() (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 11 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/image/SkSurface_Raster.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 (!generator || !generator->getInfo(&info)) { 15 if ((NULL == generator)
16 || !(generator->getInfo(&info))
17 || !dst->setConfig(info, 0)) {
16 SkDELETE(generator); 18 SkDELETE(generator);
17 return false; 19 return false;
18 } 20 }
19 SkAutoTUnref<SkCachingPixelRef> ref(SkNEW_ARGS(SkCachingPixelRef, 21 SkAutoTUnref<SkCachingPixelRef> ref(SkNEW_ARGS(SkCachingPixelRef,
20 (info, generator, dst->rowBytes()))); 22 (info, generator, dst->rowBytes())));
21 dst->installPixelRef(ref); 23 dst->setPixelRef(ref);
22 return true; 24 return true;
23 } 25 }
24 26
25 SkCachingPixelRef::SkCachingPixelRef(const SkImageInfo& info, 27 SkCachingPixelRef::SkCachingPixelRef(const SkImageInfo& info,
26 SkImageGenerator* generator, 28 SkImageGenerator* generator,
27 size_t rowBytes) 29 size_t rowBytes)
28 : INHERITED(info) 30 : INHERITED(info)
29 , fImageGenerator(generator) 31 , fImageGenerator(generator)
30 , fErrorInDecoding(false) 32 , fErrorInDecoding(false)
31 , fScaledCacheId(NULL) 33 , fScaledCacheId(NULL)
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 rec->fColorTable = NULL; 88 rec->fColorTable = NULL;
87 rec->fRowBytes = bitmap.rowBytes(); 89 rec->fRowBytes = bitmap.rowBytes();
88 return true; 90 return true;
89 } 91 }
90 92
91 void SkCachingPixelRef::onUnlockPixels() { 93 void SkCachingPixelRef::onUnlockPixels() {
92 SkASSERT(fScaledCacheId != NULL); 94 SkASSERT(fScaledCacheId != NULL);
93 SkScaledImageCache::Unlock( static_cast<SkScaledImageCache::ID*>(fScaledCach eId)); 95 SkScaledImageCache::Unlock( static_cast<SkScaledImageCache::ID*>(fScaledCach eId));
94 fScaledCacheId = NULL; 96 fScaledCacheId = NULL;
95 } 97 }
OLDNEW
« no previous file with comments | « src/image/SkSurface_Raster.cpp ('k') | src/lazy/SkDiscardablePixelRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698