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

Side by Side Diff: include/codec/SkAndroidCodec.h

Issue 1518743002: Add reallyHasAlpha() to SkAndroidCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « no previous file | include/codec/SkCodec.h » ('j') | include/codec/SkCodec.h » ('J')
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 #ifndef SkAndroidCodec_DEFINED 8 #ifndef SkAndroidCodec_DEFINED
9 #define SkAndroidCodec_DEFINED 9 #define SkAndroidCodec_DEFINED
10 10
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 const AndroidOptions* options); 201 const AndroidOptions* options);
202 202
203 /** 203 /**
204 * Simplified version of getAndroidPixels() where we supply the default And roidOptions. 204 * Simplified version of getAndroidPixels() where we supply the default And roidOptions.
205 * 205 *
206 * This will return an error if the info is kIndex_8_SkColorType and also w ill not perform 206 * This will return an error if the info is kIndex_8_SkColorType and also w ill not perform
207 * any scaling or subsetting. 207 * any scaling or subsetting.
208 */ 208 */
209 SkCodec::Result getAndroidPixels(const SkImageInfo& info, void* pixels, size _t rowBytes); 209 SkCodec::Result getAndroidPixels(const SkImageInfo& info, void* pixels, size _t rowBytes);
210 210
211 /**
212 * Some images may initially report that they have alpha due to the format
213 * of the encoded data, but then never use any colors which have alpha
214 * less than 100%. This function can be called *after* decoding to
215 * determine if such an image truly had alpha. Calling it before decoding
216 * is undefined.
217 * FIXME: see skbug.com/3582.
218 */
219 bool reallyHasAlpha() const {
scroggo 2015/12/10 17:02:32 With some changes, this doesn't even need to be vi
msarett 2015/12/10 17:41:18 I went halfway there. Can we save the actualCodec
scroggo 2015/12/10 18:29:42 fine with me
220 return this->onReallyHasAlpha();
221 }
222
211 protected: 223 protected:
212 224
213 SkAndroidCodec(const SkImageInfo&); 225 SkAndroidCodec(const SkImageInfo&);
214 226
215 virtual SkEncodedFormat onGetEncodedFormat() const = 0; 227 virtual SkEncodedFormat onGetEncodedFormat() const = 0;
216 228
217 virtual SkISize onGetSampledDimensions(int sampleSize) const = 0; 229 virtual SkISize onGetSampledDimensions(int sampleSize) const = 0;
218 230
219 virtual bool onGetSupportedSubset(SkIRect* desiredSubset) const = 0; 231 virtual bool onGetSupportedSubset(SkIRect* desiredSubset) const = 0;
220 232
221 virtual SkCodec::Result onGetAndroidPixels(const SkImageInfo& info, void* pi xels, 233 virtual SkCodec::Result onGetAndroidPixels(const SkImageInfo& info, void* pi xels,
222 size_t rowBytes, const AndroidOptions& options) = 0; 234 size_t rowBytes, const AndroidOptions& options) = 0;
223 235
236 virtual bool onReallyHasAlpha() const = 0;
237
224 private: 238 private:
225 239
226 // This will always be a reference to the info that is contained by the 240 // This will always be a reference to the info that is contained by the
227 // embedded SkCodec. 241 // embedded SkCodec.
228 const SkImageInfo& fInfo; 242 const SkImageInfo& fInfo;
229 }; 243 };
230 #endif // SkAndroidCodec_DEFINED 244 #endif // SkAndroidCodec_DEFINED
OLDNEW
« no previous file with comments | « no previous file | include/codec/SkCodec.h » ('j') | include/codec/SkCodec.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698