Index: src/codec/SkCodec_wbmp.cpp |
diff --git a/src/codec/SkCodec_wbmp.cpp b/src/codec/SkCodec_wbmp.cpp |
index 6f98294fc65f3cc950b68c255ac9978f8ac428c0..3081a3bba9c47b45af5c376616465e507ef65873 100644 |
--- a/src/codec/SkCodec_wbmp.cpp |
+++ b/src/codec/SkCodec_wbmp.cpp |
@@ -9,6 +9,7 @@ |
#include "SkCodecPriv.h" |
#include "SkColorPriv.h" |
#include "SkColorTable.h" |
+#include "SkScaledCodec.h" |
#include "SkStream.h" |
#include "SkCodec_wbmp.h" |
@@ -80,8 +81,8 @@ SkSwizzler* SkWbmpCodec::initializeSwizzler(const SkImageInfo& info, |
case kIndex_8_SkColorType: |
case kN32_SkColorType: |
case kGray_8_SkColorType: |
- return SkSwizzler::CreateSwizzler( |
- SkSwizzler::kBit, ctable, info, opts.fZeroInitialized); |
+ return SkSwizzler::CreateSwizzler(SkSwizzler::kBit, ctable, info, opts.fZeroInitialized, |
+ this->getInfo()); |
default: |
return NULL; |
} |
@@ -201,7 +202,9 @@ public: |
return SkCodec::kUnimplemented; |
} |
if (dstInfo.dimensions() != this->getInfo().dimensions()) { |
- return SkCodec::kInvalidScale; |
+ if (!SkScaledCodec::DimensionsSupportedForSampling(this->getInfo(), dstInfo)) { |
+ return SkCodec::kInvalidScale; |
+ } |
} |
if (!valid_alpha(dstInfo.alphaType(), this->getInfo().alphaType())) { |
@@ -220,12 +223,16 @@ public: |
fSwizzler.reset(fCodec->initializeSwizzler(dstInfo, |
get_color_ptr(fColorTable.get()), options)); |
if (NULL == fSwizzler.get()) { |
- return SkCodec::kInvalidInput; |
+ return SkCodec::kInvalidConversion; |
} |
return SkCodec::kSuccess; |
} |
+ SkEncodedFormat onGetEncodedFormat() const { |
+ return kWBMP_SkEncodedFormat; |
+ } |
+ |
private: |
SkAutoTDelete<SkWbmpCodec> fCodec; |
SkAutoTUnref<SkColorTable> fColorTable; |