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

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

Issue 1518743002: Add reallyHasAlpha() to SkAndroidCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Change comment on onReallyHasAlpha Created 5 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
« no previous file with comments | « include/codec/SkCodec.h ('k') | src/codec/SkSampledCodec.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 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 #include "SkSampledCodec.h" 11 #include "SkSampledCodec.h"
12 #include "SkWebpAdapterCodec.h" 12 #include "SkWebpAdapterCodec.h"
13 13
14 static bool is_valid_sample_size(int sampleSize) { 14 static bool is_valid_sample_size(int sampleSize) {
15 // 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?
16 return sampleSize > 0; 16 return sampleSize > 0;
17 } 17 }
18 18
19 SkAndroidCodec::SkAndroidCodec(const SkImageInfo& info) 19 SkAndroidCodec::SkAndroidCodec(SkCodec* codec)
20 : fInfo(info) 20 : fInfo(codec->getInfo())
21 , fCodec(codec)
21 {} 22 {}
22 23
23 SkAndroidCodec* SkAndroidCodec::NewFromStream(SkStream* stream, SkPngChunkReader * chunkReader) { 24 SkAndroidCodec* SkAndroidCodec::NewFromStream(SkStream* stream, SkPngChunkReader * chunkReader) {
24 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream, chunkReader)); 25 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream, chunkReader));
25 if (nullptr == codec) { 26 if (nullptr == codec) {
26 return nullptr; 27 return nullptr;
27 } 28 }
28 29
29 switch (codec->getEncodedFormat()) { 30 switch (codec->getEncodedFormat()) {
30 case kWEBP_SkEncodedFormat: 31 case kWEBP_SkEncodedFormat:
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 } 122 }
122 } 123 }
123 124
124 return this->onGetAndroidPixels(info, pixels, rowBytes, *options); 125 return this->onGetAndroidPixels(info, pixels, rowBytes, *options);
125 } 126 }
126 127
127 SkCodec::Result SkAndroidCodec::getAndroidPixels(const SkImageInfo& info, void* pixels, 128 SkCodec::Result SkAndroidCodec::getAndroidPixels(const SkImageInfo& info, void* pixels,
128 size_t rowBytes) { 129 size_t rowBytes) {
129 return this->getAndroidPixels(info, pixels, rowBytes, nullptr); 130 return this->getAndroidPixels(info, pixels, rowBytes, nullptr);
130 } 131 }
OLDNEW
« no previous file with comments | « include/codec/SkCodec.h ('k') | src/codec/SkSampledCodec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698