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

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

Issue 103753007: Revert of Change SkDecodingImageGenerator API (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years 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/lazy/SkDiscardablePixelRef.h ('k') | tests/CachedDecodingPixelRefTest.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 "SkDiscardablePixelRef.h" 8 #include "SkDiscardablePixelRef.h"
9 #include "SkDiscardableMemory.h" 9 #include "SkDiscardableMemory.h"
10 #include "SkImageGenerator.h" 10 #include "SkImageGenerator.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 return pixels; 65 return pixels;
66 } 66 }
67 void SkDiscardablePixelRef::onUnlockPixels() { 67 void SkDiscardablePixelRef::onUnlockPixels() {
68 fDiscardableMemory->unlock(); 68 fDiscardableMemory->unlock();
69 } 69 }
70 70
71 bool SkInstallDiscardablePixelRef(SkImageGenerator* generator, 71 bool SkInstallDiscardablePixelRef(SkImageGenerator* generator,
72 SkBitmap* dst, 72 SkBitmap* dst,
73 SkDiscardableMemory::Factory* factory) { 73 SkDiscardableMemory::Factory* factory) {
74 SkImageInfo info; 74 SkImageInfo info;
75 SkAutoTDelete<SkImageGenerator> autoGenerator(generator); 75 SkASSERT(generator != NULL);
76 if ((NULL == autoGenerator.get()) 76 if ((NULL == generator)
77 || (!autoGenerator->getInfo(&info)) 77 || (!generator->getInfo(&info))
78 || (!dst->setConfig(info, 0))) { 78 || (!dst->setConfig(info, 0))) {
79 SkDELETE(generator);
79 return false; 80 return false;
80 } 81 }
81 SkASSERT(dst->config() != SkBitmap::kNo_Config); 82 SkASSERT(dst->config() != SkBitmap::kNo_Config);
82 if (dst->empty()) { // Use a normal pixelref. 83 if (dst->empty()) { // Use a normal pixelref.
84 SkDELETE(generator); // Do not need this anymore.
83 return dst->allocPixels(NULL, NULL); 85 return dst->allocPixels(NULL, NULL);
84 } 86 }
85 SkAutoTUnref<SkDiscardablePixelRef> ref( 87 SkAutoTUnref<SkDiscardablePixelRef> ref(SkNEW_ARGS(SkDiscardablePixelRef,
86 SkNEW_ARGS(SkDiscardablePixelRef, 88 (info, generator, dst->rowBytes(), factory)));
87 (info, autoGenerator.detach(), dst->rowBytes(), factory)));
88 dst->setPixelRef(ref); 89 dst->setPixelRef(ref);
89 return true; 90 return true;
90 } 91 }
OLDNEW
« no previous file with comments | « src/lazy/SkDiscardablePixelRef.h ('k') | tests/CachedDecodingPixelRefTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698