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

Unified Diff: src/codec/SkCodec_wbmp.cpp

Issue 1321433002: Add subsetting to SkScaledCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@gif-scan
Patch Set: Created 5 years, 2 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
Index: src/codec/SkCodec_wbmp.cpp
diff --git a/src/codec/SkCodec_wbmp.cpp b/src/codec/SkCodec_wbmp.cpp
index af22e402ae64a40a0993ac83bb8879e20c8fae3d..ed3db50e6622c4a87a3591d61b460ba0f4582c9d 100644
--- a/src/codec/SkCodec_wbmp.cpp
+++ b/src/codec/SkCodec_wbmp.cpp
@@ -71,16 +71,16 @@ bool SkWbmpCodec::onRewind() {
return read_header(this->stream(), nullptr);
}
-SkSwizzler* SkWbmpCodec::initializeSwizzler(const SkImageInfo& info,
- const SkPMColor* ctable, const Options& opts) {
+SkSwizzler* SkWbmpCodec::initializeSwizzler(const SkImageInfo& info, const SkPMColor* ctable,
+ const Options& opts, int subsetLeft, int subsetWidth) {
// Create the swizzler based on the desired color type
switch (info.colorType()) {
case kIndex_8_SkColorType:
case kN32_SkColorType:
case kRGB_565_SkColorType:
case kGray_8_SkColorType:
- return SkSwizzler::CreateSwizzler(SkSwizzler::kBit, ctable, info, opts.fZeroInitialized,
- this->getInfo());
+ return SkSwizzler::CreateSwizzler(SkSwizzler::kBit, ctable, info, opts.fZeroInitialized,
+ this->getInfo(), subsetLeft, subsetWidth);
default:
return nullptr;
}
@@ -125,8 +125,9 @@ SkCodec::Result SkWbmpCodec::onGetPixels(const SkImageInfo& info,
// Initialize the swizzler
- SkAutoTDelete<SkSwizzler> swizzler(this->initializeSwizzler(info, ctable, options));
- if (nullptr == swizzler.get()) {
+ SkAutoTDelete<SkSwizzler> swizzler(this->initializeSwizzler(info, ctable, options, 0,
+ info.width()));
+ if (NULL == swizzler.get()) {
return kInvalidConversion;
}
@@ -173,7 +174,8 @@ int SkWbmpCodec::onGetScanlines(void* dst, int count, size_t dstRowBytes) {
}
SkCodec::Result SkWbmpCodec::onStartScanlineDecode(const SkImageInfo& dstInfo,
- const Options& options, SkPMColor inputColorTable[], int* inputColorCount) {
+ const Options& options, SkPMColor inputColorTable[], int* inputColorCount, int subsetLeft,
+ int subsetWidth) {
if (options.fSubset) {
// Subsets are not supported.
return kUnimplemented;
@@ -197,8 +199,8 @@ SkCodec::Result SkWbmpCodec::onStartScanlineDecode(const SkImageInfo& dstInfo,
}
// Initialize the swizzler
- fSwizzler.reset(this->initializeSwizzler(dstInfo,
- get_color_ptr(fColorTable.get()), options));
+ fSwizzler.reset(this->initializeSwizzler(dstInfo, get_color_ptr(fColorTable.get()), options,
+ subsetLeft, subsetWidth));
if (nullptr == fSwizzler.get()) {
return kInvalidConversion;
}

Powered by Google App Engine
This is Rietveld 408576698