| Index: dm/DMSrcSink.cpp
|
| diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
|
| index f555b9fcbdba78f485e47b9baf4be67d2fa1d83c..9826f978224d74dfc5f543164fc84bb0121f7a02 100644
|
| --- a/dm/DMSrcSink.cpp
|
| +++ b/dm/DMSrcSink.cpp
|
| @@ -27,6 +27,7 @@
|
| #include "SkScanlineDecoder.h"
|
| #include "SkStream.h"
|
| #include "SkXMLWriter.h"
|
| +#include "SkScaledCodec.h"
|
|
|
| DEFINE_bool(multiPage, false, "For document-type backends, render the source"
|
| " into multiple pages");
|
| @@ -84,9 +85,13 @@ Error CodecSrc::draw(SkCanvas* canvas) const {
|
| if (!encoded) {
|
| return SkStringPrintf("Couldn't read %s.", fPath.c_str());
|
| }
|
| - SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(encoded));
|
| + SkAutoTDelete<SkCodec> codec(SkScaledCodec::NewFromData(encoded));
|
| if (NULL == codec.get()) {
|
| - return SkStringPrintf("Couldn't create codec for %s.", fPath.c_str());
|
| + // scaledCodec not supported, try normal codec
|
| + codec.reset(SkCodec::NewFromData(encoded));
|
| + if (NULL == codec.get()) {
|
| + return SkStringPrintf("Couldn't create codec for %s.", fPath.c_str());
|
| + }
|
| }
|
|
|
| // Choose the color type to decode to
|
| @@ -446,13 +451,16 @@ Error CodecSrc::draw(SkCanvas* canvas) const {
|
|
|
| SkISize CodecSrc::size() const {
|
| SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(fPath.c_str()));
|
| - SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(encoded));
|
| - if (NULL != codec) {
|
| - SkISize size = codec->getScaledDimensions(fScale);
|
| - return size;
|
| - } else {
|
| - return SkISize::Make(0, 0);
|
| + SkAutoTDelete<SkCodec> codec(SkScaledCodec::NewFromData(encoded));
|
| + if (NULL == codec) {
|
| + // scaledCodec not supported, try regular codec
|
| + codec.reset(SkCodec::NewFromData(encoded));
|
| + if (NULL == codec) {
|
| + return SkISize::Make(0, 0);
|
| + }
|
| }
|
| + SkISize size = codec->getScaledDimensions(fScale);
|
| + return size;
|
| }
|
|
|
| Name CodecSrc::name() const {
|
|
|