Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Unified Diff: src/codec/SkCodec_wbmp.cpp

Issue 1260673002: SkScaledCodec class (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Stop DM from running large interlaced images on 32-bit Ubuntu GCE bots b/c they are running out of … Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/codec/SkCodec_libpng.cpp ('k') | src/codec/SkJpegCodec.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « src/codec/SkCodec_libpng.cpp ('k') | src/codec/SkJpegCodec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698