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

Side by Side Diff: src/ports/SkImageGenerator_skia.cpp

Issue 980903002: Option for SkCodec to treat dst as all zeroes. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update SkBmpCodec to use new ZeroInitialized API. 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/lazy/SkDiscardablePixelRef.cpp ('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 2015 The Android Open Source Project 2 * Copyright 2015 The Android Open Source Project
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 "SkData.h" 8 #include "SkData.h"
9 #include "SkImageDecoder.h" 9 #include "SkImageDecoder.h"
10 #include "SkImageGenerator.h" 10 #include "SkImageGenerator.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 SkData* onRefEncodedData() SK_OVERRIDE { 46 SkData* onRefEncodedData() SK_OVERRIDE {
47 return SkRef(fData.get()); 47 return SkRef(fData.get());
48 } 48 }
49 49
50 virtual bool onGetInfo(SkImageInfo* info) SK_OVERRIDE { 50 virtual bool onGetInfo(SkImageInfo* info) SK_OVERRIDE {
51 *info = fInfo; 51 *info = fInfo;
52 return true; 52 return true;
53 } 53 }
54 54
55 virtual Result onGetPixels(const SkImageInfo& info, void* pixels, size_t row Bytes, 55 virtual Result onGetPixels(const SkImageInfo& info, void* pixels, size_t row Bytes,
56 const Options&,
56 SkPMColor ctableEntries[], int* ctableCount) SK_O VERRIDE { 57 SkPMColor ctableEntries[], int* ctableCount) SK_O VERRIDE {
57 SkMemoryStream stream(fData->data(), fData->size(), false); 58 SkMemoryStream stream(fData->data(), fData->size(), false);
58 SkAutoTUnref<BareMemoryAllocator> allocator(SkNEW_ARGS(BareMemoryAllocat or, 59 SkAutoTUnref<BareMemoryAllocator> allocator(SkNEW_ARGS(BareMemoryAllocat or,
59 (info, pixels, ro wBytes))); 60 (info, pixels, ro wBytes)));
60 fDecoder->setAllocator(allocator); 61 fDecoder->setAllocator(allocator);
61 fDecoder->setRequireUnpremultipliedColors(kUnpremul_SkAlphaType == info. alphaType()); 62 fDecoder->setRequireUnpremultipliedColors(kUnpremul_SkAlphaType == info. alphaType());
62 63
63 SkBitmap bm; 64 SkBitmap bm;
64 const SkImageDecoder::Result result = fDecoder->decode(&stream, &bm, inf o.colorType(), 65 const SkImageDecoder::Result result = fDecoder->decode(&stream, &bm, inf o.colorType(),
65 SkImageDecoder::k DecodePixels_Mode); 66 SkImageDecoder::k DecodePixels_Mode);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 108
108 SkBitmap bm; 109 SkBitmap bm;
109 stream.rewind(); 110 stream.rewind();
110 if (!decoder->decode(&stream, &bm, kUnknown_SkColorType, SkImageDecoder::kDe codeBounds_Mode)) { 111 if (!decoder->decode(&stream, &bm, kUnknown_SkColorType, SkImageDecoder::kDe codeBounds_Mode)) {
111 SkDELETE(decoder); 112 SkDELETE(decoder);
112 return NULL; 113 return NULL;
113 } 114 }
114 115
115 return SkNEW_ARGS(SkImageDecoderGenerator, (bm.info(), decoder, data)); 116 return SkNEW_ARGS(SkImageDecoderGenerator, (bm.info(), decoder, data));
116 } 117 }
OLDNEW
« no previous file with comments | « src/lazy/SkDiscardablePixelRef.cpp ('k') | tests/CachedDecodingPixelRefTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698