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

Side by Side Diff: src/codec/SkSampledCodec.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/SkSampledCodec.h ('k') | src/codec/SkWebpAdapterCodec.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 "SkCodec.h" 8 #include "SkCodec.h"
9 #include "SkCodecPriv.h" 9 #include "SkCodecPriv.h"
10 #include "SkMath.h" 10 #include "SkMath.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 return preSampledSize; 63 return preSampledSize;
64 } 64 }
65 65
66 SkISize SkSampledCodec::onGetSampledDimensions(int sampleSize) const { 66 SkISize SkSampledCodec::onGetSampledDimensions(int sampleSize) const {
67 const SkISize size = this->accountForNativeScaling(&sampleSize); 67 const SkISize size = this->accountForNativeScaling(&sampleSize);
68 return SkISize::Make(get_scaled_dimension(size.width(), sampleSize), 68 return SkISize::Make(get_scaled_dimension(size.width(), sampleSize),
69 get_scaled_dimension(size.height(), sampleSize)); 69 get_scaled_dimension(size.height(), sampleSize));
70 } 70 }
71 71
72 SkCodec::Result SkSampledCodec::onGetAndroidPixels(const SkImageInfo& info, void * pixels, 72 SkCodec::Result SkSampledCodec::onGetAndroidPixels(const SkImageInfo& info, void * pixels,
73 size_t rowBytes, AndroidOptions& options) { 73 size_t rowBytes, const AndroidOptions& options) {
74 // Create an Options struct for the codec. 74 // Create an Options struct for the codec.
75 SkCodec::Options codecOptions; 75 SkCodec::Options codecOptions;
76 codecOptions.fZeroInitialized = options.fZeroInitialized; 76 codecOptions.fZeroInitialized = options.fZeroInitialized;
77 77
78 SkIRect* subset = options.fSubset; 78 SkIRect* subset = options.fSubset;
79 if (!subset || subset->size() == fCodec->getInfo().dimensions()) { 79 if (!subset || subset->size() == fCodec->getInfo().dimensions()) {
80 if (fCodec->dimensionsSupported(info.dimensions())) { 80 if (fCodec->dimensionsSupported(info.dimensions())) {
81 return fCodec->getPixels(info, pixels, rowBytes, &codecOptions, opti ons.fColorPtr, 81 return fCodec->getPixels(info, pixels, rowBytes, &codecOptions, opti ons.fColorPtr,
82 options.fColorCount); 82 options.fColorCount);
83 } 83 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 return SkCodec::kSuccess; 128 return SkCodec::kSuccess;
129 } 129 }
130 default: 130 default:
131 SkASSERT(false); 131 SkASSERT(false);
132 return SkCodec::kUnimplemented; 132 return SkCodec::kUnimplemented;
133 } 133 }
134 } 134 }
135 135
136 136
137 SkCodec::Result SkSampledCodec::sampledDecode(const SkImageInfo& info, void* pix els, 137 SkCodec::Result SkSampledCodec::sampledDecode(const SkImageInfo& info, void* pix els,
138 size_t rowBytes, AndroidOptions& options) { 138 size_t rowBytes, const AndroidOptions& options) {
139 // We should only call this function when sampling. 139 // We should only call this function when sampling.
140 SkASSERT(options.fSampleSize > 1); 140 SkASSERT(options.fSampleSize > 1);
141 141
142 // Create options struct for the codec. 142 // Create options struct for the codec.
143 SkCodec::Options sampledOptions; 143 SkCodec::Options sampledOptions;
144 sampledOptions.fZeroInitialized = options.fZeroInitialized; 144 sampledOptions.fZeroInitialized = options.fZeroInitialized;
145 145
146 // FIXME: This was already called by onGetAndroidPixels. Can we reduce that? 146 // FIXME: This was already called by onGetAndroidPixels. Can we reduce that?
147 int sampleSize = options.fSampleSize; 147 int sampleSize = options.fSampleSize;
148 int nativeSampleSize; 148 int nativeSampleSize;
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 // fCodec has already handled filling uninitialized memory. 247 // fCodec has already handled filling uninitialized memory.
248 return SkCodec::kIncompleteInput; 248 return SkCodec::kIncompleteInput;
249 } 249 }
250 return SkCodec::kSuccess; 250 return SkCodec::kSuccess;
251 } 251 }
252 default: 252 default:
253 SkASSERT(false); 253 SkASSERT(false);
254 return SkCodec::kUnimplemented; 254 return SkCodec::kUnimplemented;
255 } 255 }
256 } 256 }
OLDNEW
« no previous file with comments | « src/codec/SkSampledCodec.h ('k') | src/codec/SkWebpAdapterCodec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698