aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec/SkIcoCodec.cpp
diff options
context:
space:
mode:
authorGravatar msarett <msarett@google.com>2016-04-18 16:20:00 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-04-18 16:20:00 -0700
commitf682d9ad70d690a343bc15e26ef321d86770be41 (patch)
treed060890436619e2f3a03789400ed8276f421e5ce /src/codec/SkIcoCodec.cpp
parentbde57ed11b8a6bd6da6043189e000c58bf146422 (diff)
Add SkEncodedInfo to report properties of encoded image data
All this does is build an SkEncodedInfo for each codec, and then convert it to an SkImageInfo. In future steps I intend to: (1) Use SkEncodedInfo in place of SrcConfig in SkSwizzler. (2) Support more conversions in SkSwizzler (non-native BGRA/RGBA, 16-bit components, float, fixed point) (3) Investigate optimizing conversions from encoded data to linear color spaces. BUG=skia:4133 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1820073002 Review URL: https://codereview.chromium.org/1820073002
Diffstat (limited to 'src/codec/SkIcoCodec.cpp')
-rw-r--r--src/codec/SkIcoCodec.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/codec/SkIcoCodec.cpp b/src/codec/SkIcoCodec.cpp
index d74c150ff5..0e81b72407 100644
--- a/src/codec/SkIcoCodec.cpp
+++ b/src/codec/SkIcoCodec.cpp
@@ -168,20 +168,22 @@ SkCodec* SkIcoCodec::NewFromStream(SkStream* stream) {
maxIndex = i;
}
}
- SkImageInfo info = codecs->operator[](maxIndex)->getInfo();
+ int width = codecs->operator[](maxIndex)->getInfo().width();
+ int height = codecs->operator[](maxIndex)->getInfo().height();
+ SkEncodedInfo info = codecs->operator[](maxIndex)->getEncodedInfo();
// Note that stream is owned by the embedded codec, the ico does not need
// direct access to the stream.
- return new SkIcoCodec(info, codecs.release());
+ return new SkIcoCodec(width, height, info, codecs.release());
}
/*
* Creates an instance of the decoder
* Called only by NewFromStream
*/
-SkIcoCodec::SkIcoCodec(const SkImageInfo& info,
+SkIcoCodec::SkIcoCodec(int width, int height, const SkEncodedInfo& info,
SkTArray<SkAutoTDelete<SkCodec>, true>* codecs)
- : INHERITED(info, nullptr)
+ : INHERITED(width, height, info, nullptr)
, fEmbeddedCodecs(codecs)
, fCurrScanlineCodec(nullptr)
{}