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

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

Issue 1411693005: Make AndroidOptions const (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month 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/codec/SkWebpAdapterCodec.h ('k') | no next file » | 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 "SkCodec.h" 8 #include "SkCodec.h"
9 #include "SkCodecPriv.h" 9 #include "SkCodecPriv.h"
10 #include "SkWebpAdapterCodec.h" 10 #include "SkWebpAdapterCodec.h"
11 11
12 SkWebpAdapterCodec::SkWebpAdapterCodec(SkWebpCodec* codec) 12 SkWebpAdapterCodec::SkWebpAdapterCodec(SkWebpCodec* codec)
13 : INHERITED(codec->getInfo()) 13 : INHERITED(codec->getInfo())
14 , fCodec(codec) 14 , fCodec(codec)
15 {} 15 {}
16 16
17 SkISize SkWebpAdapterCodec::onGetSampledDimensions(int sampleSize) const { 17 SkISize SkWebpAdapterCodec::onGetSampledDimensions(int sampleSize) const {
18 float scale = get_scale_from_sample_size(sampleSize); 18 float scale = get_scale_from_sample_size(sampleSize);
19 return fCodec->getScaledDimensions(scale); 19 return fCodec->getScaledDimensions(scale);
20 } 20 }
21 21
22 bool SkWebpAdapterCodec::onGetSupportedSubset(SkIRect* desiredSubset) const { 22 bool SkWebpAdapterCodec::onGetSupportedSubset(SkIRect* desiredSubset) const {
23 return fCodec->getValidSubset(desiredSubset); 23 return fCodec->getValidSubset(desiredSubset);
24 } 24 }
25 25
26 SkCodec::Result SkWebpAdapterCodec::onGetAndroidPixels(const SkImageInfo& info, void* pixels, 26 SkCodec::Result SkWebpAdapterCodec::onGetAndroidPixels(const SkImageInfo& info, void* pixels,
27 size_t rowBytes, AndroidOptions& options) { 27 size_t rowBytes, const AndroidOptions& options) {
28 // SkWebpCodec will support pretty much any dimensions that we provide, but we want 28 // SkWebpCodec will support pretty much any dimensions that we provide, but we want
29 // to be stricter about the type of scaling that we allow, so we will add an extra 29 // to be stricter about the type of scaling that we allow, so we will add an extra
30 // check here. 30 // check here.
31 SkISize supportedSize; 31 SkISize supportedSize;
32 if (!options.fSubset) { 32 if (!options.fSubset) {
33 supportedSize = this->onGetSampledDimensions(options.fSampleSize); 33 supportedSize = this->onGetSampledDimensions(options.fSampleSize);
34 } else { 34 } else {
35 supportedSize = this->getSampledSubsetDimensions(options.fSampleSize, *o ptions.fSubset); 35 supportedSize = this->getSampledSubsetDimensions(options.fSampleSize, *o ptions.fSubset);
36 } 36 }
37 if (supportedSize != info.dimensions()) { 37 if (supportedSize != info.dimensions()) {
38 return SkCodec::kInvalidParameters; 38 return SkCodec::kInvalidParameters;
39 } 39 }
40 40
41 SkCodec::Options codecOptions; 41 SkCodec::Options codecOptions;
42 codecOptions.fZeroInitialized = options.fZeroInitialized; 42 codecOptions.fZeroInitialized = options.fZeroInitialized;
43 codecOptions.fSubset = options.fSubset; 43 codecOptions.fSubset = options.fSubset;
44 return fCodec->getPixels(info, pixels, rowBytes, &codecOptions, options.fCol orPtr, 44 return fCodec->getPixels(info, pixels, rowBytes, &codecOptions, options.fCol orPtr,
45 options.fColorCount); 45 options.fColorCount);
46 } 46 }
OLDNEW
« no previous file with comments | « src/codec/SkWebpAdapterCodec.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698