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

Side by Side Diff: src/codec/SkAndroidCodec.cpp

Issue 1635443002: Revert of Prototype of RAW decoding in Skia. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 11 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 | « resources/sample_1mp.dng ('k') | src/codec/SkCodec.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 Google Inc. 2 * Copyright 2015 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 "SkAndroidCodec.h" 8 #include "SkAndroidCodec.h"
9 #include "SkCodec.h" 9 #include "SkCodec.h"
10 #include "SkCodecPriv.h" 10 #include "SkCodecPriv.h"
11 #ifdef SK_CODEC_DECODES_RAW
12 #include "SkRawAdapterCodec.h"
13 #endif
14 #include "SkSampledCodec.h" 11 #include "SkSampledCodec.h"
15 #include "SkWebpAdapterCodec.h" 12 #include "SkWebpAdapterCodec.h"
16 13
17 static bool is_valid_sample_size(int sampleSize) { 14 static bool is_valid_sample_size(int sampleSize) {
18 // FIXME: As Leon has mentioned elsewhere, surely there is also a maximum sa mpleSize? 15 // FIXME: As Leon has mentioned elsewhere, surely there is also a maximum sa mpleSize?
19 return sampleSize > 0; 16 return sampleSize > 0;
20 } 17 }
21 18
22 SkAndroidCodec::SkAndroidCodec(SkCodec* codec) 19 SkAndroidCodec::SkAndroidCodec(SkCodec* codec)
23 : fInfo(codec->getInfo()) 20 : fInfo(codec->getInfo())
24 , fCodec(codec) 21 , fCodec(codec)
25 {} 22 {}
26 23
27 SkAndroidCodec* SkAndroidCodec::NewFromStream(SkStream* stream, SkPngChunkReader * chunkReader) { 24 SkAndroidCodec* SkAndroidCodec::NewFromStream(SkStream* stream, SkPngChunkReader * chunkReader) {
28 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream, chunkReader)); 25 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream, chunkReader));
29 if (nullptr == codec) { 26 if (nullptr == codec) {
30 return nullptr; 27 return nullptr;
31 } 28 }
32 29
33 switch (codec->getEncodedFormat()) { 30 switch (codec->getEncodedFormat()) {
34 case kWEBP_SkEncodedFormat: 31 case kWEBP_SkEncodedFormat:
35 return new SkWebpAdapterCodec((SkWebpCodec*) codec.detach()); 32 return new SkWebpAdapterCodec((SkWebpCodec*) codec.detach());
36 case kPNG_SkEncodedFormat: 33 case kPNG_SkEncodedFormat:
37 case kJPEG_SkEncodedFormat: 34 case kJPEG_SkEncodedFormat:
38 case kWBMP_SkEncodedFormat: 35 case kWBMP_SkEncodedFormat:
39 case kBMP_SkEncodedFormat: 36 case kBMP_SkEncodedFormat:
40 case kGIF_SkEncodedFormat: 37 case kGIF_SkEncodedFormat:
41 case kICO_SkEncodedFormat: 38 case kICO_SkEncodedFormat:
42 return new SkSampledCodec(codec.detach()); 39 return new SkSampledCodec(codec.detach());
43 #ifdef SK_CODEC_DECODES_RAW
44 case kRAW_SkEncodedFormat:
45 return new SkRawAdapterCodec((SkRawCodec*)codec.detach());
46 #endif
47 default: 40 default:
48 return nullptr; 41 return nullptr;
49 } 42 }
50 } 43 }
51 44
52 SkAndroidCodec* SkAndroidCodec::NewFromData(SkData* data, SkPngChunkReader* chun kReader) { 45 SkAndroidCodec* SkAndroidCodec::NewFromData(SkData* data, SkPngChunkReader* chun kReader) {
53 if (!data) { 46 if (!data) {
54 return nullptr; 47 return nullptr;
55 } 48 }
56 49
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 } 175 }
183 } 176 }
184 177
185 return this->onGetAndroidPixels(info, pixels, rowBytes, *options); 178 return this->onGetAndroidPixels(info, pixels, rowBytes, *options);
186 } 179 }
187 180
188 SkCodec::Result SkAndroidCodec::getAndroidPixels(const SkImageInfo& info, void* pixels, 181 SkCodec::Result SkAndroidCodec::getAndroidPixels(const SkImageInfo& info, void* pixels,
189 size_t rowBytes) { 182 size_t rowBytes) {
190 return this->getAndroidPixels(info, pixels, rowBytes, nullptr); 183 return this->getAndroidPixels(info, pixels, rowBytes, nullptr);
191 } 184 }
OLDNEW
« no previous file with comments | « resources/sample_1mp.dng ('k') | src/codec/SkCodec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698