aboutsummaryrefslogtreecommitdiffhomepage
path: root/dm
diff options
context:
space:
mode:
authorGravatar msarett <msarett@google.com>2015-03-25 05:27:48 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-03-25 05:27:48 -0700
commit9bde918754bc292469d801f156f3b626eb3db780 (patch)
treec59c3026e31c8712a415c5adba11dfd391329506 /dm
parent6adf849f4eedd19591ce35129a846209e7e6393b (diff)
Enabling ico decoding with use of png and bmp decoders
BUG=skia:3257 NOPRESUBMIT=true Review URL: https://codereview.chromium.org/1011343003
Diffstat (limited to 'dm')
-rw-r--r--dm/DM.cpp4
-rw-r--r--dm/DMSrcSink.cpp6
2 files changed, 8 insertions, 2 deletions
diff --git a/dm/DM.cpp b/dm/DM.cpp
index 833af0edba..44090ca1ce 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -146,7 +146,9 @@ static void push_src(const char* tag, Src* s) {
static bool codec_supported(const char* ext) {
// FIXME: Once other versions of SkCodec are available, we can add them to this
// list (and eventually we can remove this check once they are all supported).
- return strcmp(ext, "png") == 0 || strcmp(ext, "PNG") == 0;
+ return strcmp(ext, "png") == 0 || strcmp(ext, "PNG") == 0 ||
+ strcmp(ext, "bmp") == 0 || strcmp(ext, "BMP") == 0 ||
+ strcmp(ext, "ico") == 0 || strcmp(ext, "ICO") == 0;
}
static void gather_srcs() {
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index 638f670834..fe31d61ef0 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -88,7 +88,11 @@ Error CodecSrc::draw(SkCanvas* canvas) const {
SkISize CodecSrc::size() const {
SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(fPath.c_str()));
SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(encoded));
- return codec->getInfo().dimensions();
+ if (NULL != codec) {
+ return codec->getInfo().dimensions();
+ } else {
+ return SkISize::Make(0, 0);
+ }
}
Name CodecSrc::name() const {