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

Side by Side Diff: src/images/SkDecodingImageGenerator.cpp

Issue 111713002: Sk_API for SkImageGenerator and SkInstallDiscardablePixelRef (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase 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 | « include/core/SkImageGenerator.h ('k') | src/lazy/SkDiscardablePixelRef.h » ('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 "SkDecodingImageGenerator.h" 8 #include "SkDecodingImageGenerator.h"
9 #include "SkData.h" 9 #include "SkData.h"
10 #include "SkDiscardablePixelRef.h"
11 #include "SkImageDecoder.h" 10 #include "SkImageDecoder.h"
11 #include "SkImageGenerator.h"
12 #include "SkImagePriv.h" 12 #include "SkImagePriv.h"
13 #include "SkStream.h" 13 #include "SkStream.h"
14 14
15 15
16 namespace { 16 namespace {
17 /** 17 /**
18 * Special allocator used by getPixels(). Uses preallocated memory 18 * Special allocator used by getPixels(). Uses preallocated memory
19 * provided. 19 * provided.
20 */ 20 */
21 class TargetAllocator : public SkBitmap::Allocator { 21 class TargetAllocator : public SkBitmap::Allocator {
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 SkBitmap bm8888; 184 SkBitmap bm8888;
185 bitmap.copyTo(&bm8888, SkBitmap::kARGB_8888_Config, &allocator); 185 bitmap.copyTo(&bm8888, SkBitmap::kARGB_8888_Config, &allocator);
186 } 186 }
187 return true; 187 return true;
188 } 188 }
189 bool SkDecodingImageGenerator::Install(SkData* data, SkBitmap* dst, 189 bool SkDecodingImageGenerator::Install(SkData* data, SkBitmap* dst,
190 SkDiscardableMemory::Factory* factory) { 190 SkDiscardableMemory::Factory* factory) {
191 SkASSERT(data != NULL); 191 SkASSERT(data != NULL);
192 SkASSERT(dst != NULL); 192 SkASSERT(dst != NULL);
193 SkImageGenerator* gen(SkNEW_ARGS(SkDecodingImageGenerator, (data))); 193 SkImageGenerator* gen(SkNEW_ARGS(SkDecodingImageGenerator, (data)));
194 return SkDiscardablePixelRef::Install(gen, dst, factory); 194 return SkInstallDiscardablePixelRef(gen, dst, factory);
195 } 195 }
196 196
197 bool SkDecodingImageGenerator::Install(SkStreamRewindable* stream, 197 bool SkDecodingImageGenerator::Install(SkStreamRewindable* stream,
198 SkBitmap* dst, 198 SkBitmap* dst,
199 SkDiscardableMemory::Factory* factory) { 199 SkDiscardableMemory::Factory* factory) {
200 SkASSERT(stream != NULL); 200 SkASSERT(stream != NULL);
201 SkASSERT(dst != NULL); 201 SkASSERT(dst != NULL);
202 if ((stream == NULL) || !stream->unique()) { 202 if ((stream == NULL) || !stream->unique()) {
203 SkSafeUnref(stream); 203 SkSafeUnref(stream);
204 return false; 204 return false;
205 } 205 }
206 SkImageGenerator* gen(SkNEW_ARGS(SkDecodingImageGenerator, (stream))); 206 SkImageGenerator* gen(SkNEW_ARGS(SkDecodingImageGenerator, (stream)));
207 return SkDiscardablePixelRef::Install(gen, dst, factory); 207 return SkInstallDiscardablePixelRef(gen, dst, factory);
208 } 208 }
OLDNEW
« no previous file with comments | « include/core/SkImageGenerator.h ('k') | src/lazy/SkDiscardablePixelRef.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698