aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec/SkCodec_libico.cpp
diff options
context:
space:
mode:
authorGravatar scroggo <scroggo@chromium.org>2015-07-22 07:16:20 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-07-22 07:16:20 -0700
commitb636b45971bc5e64e3b103169577cbc874bc064d (patch)
tree17579347d627ede9bdc4e675b22202f4191190f9 /src/codec/SkCodec_libico.cpp
parent8c0144ccb17220db9d5140ef5ee85d5bc7837513 (diff)
Add the ability to decode a subset to SkCodec
This allows codecs that support subsets natively (i.e. WEBP) to do so. Add a field on SkCodec::Options representing the subset. Add a method on SkCodec to find a valid subset which approximately matches a desired subset. Implement subset decodes in SkWebpCodec. Add a test in DM for decoding subsets. Notice that we only start on even boundaries. This is due to the way libwebp's API works. SkWEBPImageDecoder does not take this into account, which results in visual artifacts. FIXME: Subsets with scaling are not pixel identical, but close. (This may be fine, though - they are not perceptually different. We'll just need to mark another set of images in gold as valid, once https://skbug.com/4038 is fixed, so we can tests scaled webp without generating new images on each run.) Review URL: https://codereview.chromium.org/1240143002
Diffstat (limited to 'src/codec/SkCodec_libico.cpp')
-rw-r--r--src/codec/SkCodec_libico.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/codec/SkCodec_libico.cpp b/src/codec/SkCodec_libico.cpp
index 97404afed0..7df4879442 100644
--- a/src/codec/SkCodec_libico.cpp
+++ b/src/codec/SkCodec_libico.cpp
@@ -229,6 +229,10 @@ SkCodec::Result SkIcoCodec::onGetPixels(const SkImageInfo& dstInfo,
void* dst, size_t dstRowBytes,
const Options& opts, SkPMColor* ct,
int* ptr) {
+ if (opts.fSubset) {
+ // Subsets are not supported.
+ return kUnimplemented;
+ }
// We return invalid scale if there is no candidate image with matching
// dimensions.
Result result = kInvalidScale;