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

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

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