aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec/SkCodec_wbmp.cpp
diff options
context:
space:
mode:
authorGravatar emmaleer <emmaleer@google.com>2015-08-14 07:44:46 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-08-14 07:44:46 -0700
commit8f4ba76742c329bc4d5e1b8ca376d27922bd00b1 (patch)
treeee3b69a6972cb3e16e4c0e85723477bea9dd5387 /src/codec/SkCodec_wbmp.cpp
parent1bef9f59c566cc54c2259cc4d0171c115157cd1c (diff)
SkScaledCodec class
This class does scaling by using a scanlineDecoder. getScanlines and skipScanlines are used for y sampling, the swizzler is used for x sampling this class is currently only working for png and jpeg images I will update other Codec types to work soon For SkJpegCodec to implement width wise swizzling it now uses a swizzler. I ran performance tests on this change. Here are the performance test results: https://docs.google.com/a/google.com/spreadsheets/d/1D7-Q_GXD_dI68LZO005NNvb8Wq2Ee0wEBEPG72671yw/edit?usp=sharing BUG=skia: Committed: https://skia.googlesource.com/skia/+/0944100ac89f797714eeae0cf2875e2335ff52ee Committed: https://skia.googlesource.com/skia/+/d518ea7927f9f4e0ed5b4134d1b4f48243855a47 Committed: https://skia.googlesource.com/skia/+/b157917507d4f7d2651f0aeb566d31603cc02240 Review URL: https://codereview.chromium.org/1260673002
Diffstat (limited to 'src/codec/SkCodec_wbmp.cpp')
-rw-r--r--src/codec/SkCodec_wbmp.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/codec/SkCodec_wbmp.cpp b/src/codec/SkCodec_wbmp.cpp
index 6f98294fc6..3081a3bba9 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;