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

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

Issue 1017293002: guarded change to SkImageGenerator to make getInfo() const (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 9 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/images/SkDecodingImageGenerator.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 "SkBitmapCache.h" 9 #include "SkBitmapCache.h"
10 #include "SkRect.h" 10 #include "SkRect.h"
11 11
12 bool SkCachingPixelRef::Install(SkImageGenerator* generator, 12 bool SkCachingPixelRef::Install(SkImageGenerator* generator,
13 SkBitmap* dst) { 13 SkBitmap* dst) {
14 SkImageInfo info;
15 SkASSERT(dst != NULL); 14 SkASSERT(dst != NULL);
16 if ((NULL == generator) 15 if (NULL == generator) {
17 || !(generator->getInfo(&info)) 16 return false;
18 || !dst->setInfo(info)) { 17 }
18 const SkImageInfo info = generator->getInfo();
19 if (!dst->setInfo(info)) {
19 SkDELETE(generator); 20 SkDELETE(generator);
20 return false; 21 return false;
21 } 22 }
22 SkAutoTUnref<SkCachingPixelRef> ref(SkNEW_ARGS(SkCachingPixelRef, 23 SkAutoTUnref<SkCachingPixelRef> ref(SkNEW_ARGS(SkCachingPixelRef,
23 (info, generator, dst->rowBytes()))); 24 (info, generator, dst->rowBytes())));
24 dst->setPixelRef(ref); 25 dst->setPixelRef(ref);
25 return true; 26 return true;
26 } 27 }
27 28
28 SkCachingPixelRef::SkCachingPixelRef(const SkImageInfo& info, 29 SkCachingPixelRef::SkCachingPixelRef(const SkImageInfo& info,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 SkASSERT(pixels != NULL); 72 SkASSERT(pixels != NULL);
72 rec->fPixels = pixels; 73 rec->fPixels = pixels;
73 rec->fColorTable = NULL; 74 rec->fColorTable = NULL;
74 rec->fRowBytes = fLockedBitmap.rowBytes(); 75 rec->fRowBytes = fLockedBitmap.rowBytes();
75 return true; 76 return true;
76 } 77 }
77 78
78 void SkCachingPixelRef::onUnlockPixels() { 79 void SkCachingPixelRef::onUnlockPixels() {
79 fLockedBitmap.reset(); 80 fLockedBitmap.reset();
80 } 81 }
OLDNEW
« no previous file with comments | « src/images/SkDecodingImageGenerator.cpp ('k') | src/lazy/SkDiscardablePixelRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698