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

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

Issue 103033002: Big Cleanup: SkBitmapFactory, SkLazyPixelRef, SkImageCache (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
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
10 #include "SkBitmapFactory.h"
11 #include "SkData.h" 9 #include "SkData.h"
12 #include "SkDiscardablePixelRef.h" 10 #include "SkDiscardablePixelRef.h"
13 #include "SkImageDecoder.h" 11 #include "SkImageDecoder.h"
14 12
15 SkDecodingImageGenerator::SkDecodingImageGenerator(SkData* data) 13 SkDecodingImageGenerator::SkDecodingImageGenerator(SkData* data)
16 : fData(data) { 14 : fData(data) {
17 SkASSERT(fData != NULL); 15 SkASSERT(fData != NULL);
18 fData->ref(); 16 fData->ref();
19 } 17 }
20 18
(...skipping 10 matching lines...) Expand all
31 SkASSERT(info != NULL); 29 SkASSERT(info != NULL);
32 return SkImageDecoder::DecodeMemoryToTarget(fData->data(), 30 return SkImageDecoder::DecodeMemoryToTarget(fData->data(),
33 fData->size(), 31 fData->size(),
34 info, NULL); 32 info, NULL);
35 } 33 }
36 34
37 bool SkDecodingImageGenerator::getPixels(const SkImageInfo& info, 35 bool SkDecodingImageGenerator::getPixels(const SkImageInfo& info,
38 void* pixels, 36 void* pixels,
39 size_t rowBytes) { 37 size_t rowBytes) {
40 SkASSERT(pixels != NULL); 38 SkASSERT(pixels != NULL);
41 SkBitmapFactory::Target target = {pixels, rowBytes}; 39 SkImageDecoder::Target target = {pixels, rowBytes};
42 SkImageInfo tmpInfo = info; 40 SkImageInfo tmpInfo = info;
43 return SkImageDecoder::DecodeMemoryToTarget(fData->data(), 41 return SkImageDecoder::DecodeMemoryToTarget(fData->data(),
44 fData->size(), 42 fData->size(),
45 &tmpInfo, &target); 43 &tmpInfo, &target);
46 } 44 }
47 bool SkDecodingImageGenerator::Install(SkData* data, SkBitmap* dst) { 45 bool SkDecodingImageGenerator::Install(SkData* data, SkBitmap* dst,
46 SkDiscardableMemory::Factory* factory) {
48 SkASSERT(data != NULL); 47 SkASSERT(data != NULL);
49 SkASSERT(dst != NULL); 48 SkASSERT(dst != NULL);
50 SkImageGenerator* gen(SkNEW_ARGS(SkDecodingImageGenerator, (data))); 49 SkImageGenerator* gen(SkNEW_ARGS(SkDecodingImageGenerator, (data)));
51 return SkDiscardablePixelRef::Install(gen, dst); 50 return SkDiscardablePixelRef::Install(gen, dst, factory);
52 } 51 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698