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

Unified Diff: src/codec/SkCodec_libpng.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_libpng.cpp
diff --git a/src/codec/SkCodec_libpng.cpp b/src/codec/SkCodec_libpng.cpp
index 7021349ee4f9b5d2ed27637f580e6f9a4efe92f4..ccb9a6766762cab6b2241079e1b22c8eb6d711c0 100644
--- a/src/codec/SkCodec_libpng.cpp
+++ b/src/codec/SkCodec_libpng.cpp
@@ -394,7 +394,9 @@ void SkPngCodec::destroyReadStruct() {
SkCodec::Result SkPngCodec::initializeSwizzler(const SkImageInfo& requestedInfo,
const Options& options,
SkPMColor ctable[],
- int* ctableCount) {
+ int* ctableCount,
+ int subsetLeft,
+ int subsetWidth) {
// FIXME: Could we use the return value of setjmp to specify the type of
// error?
if (setjmp(png_jmpbuf(fPng_ptr))) {
@@ -436,7 +438,7 @@ SkCodec::Result SkPngCodec::initializeSwizzler(const SkImageInfo& requestedInfo,
// Create the swizzler. SkPngCodec retains ownership of the color table.
const SkPMColor* colors = get_color_ptr(fColorTable.get());
fSwizzler.reset(SkSwizzler::CreateSwizzler(fSrcConfig, colors, requestedInfo,
- options.fZeroInitialized, this->getInfo()));
+ options.fZeroInitialized, this->getInfo(), subsetLeft, subsetWidth));
if (!fSwizzler) {
// FIXME: CreateSwizzler could fail for another reason.
return kUnimplemented;
@@ -480,8 +482,8 @@ SkCodec::Result SkPngCodec::onGetPixels(const SkImageInfo& requestedInfo, void*
}
// Note that ctable and ctableCount may be modified if there is a color table
- const Result result = this->initializeSwizzler(requestedInfo, options,
- ctable, ctableCount);
+ const Result result = this->initializeSwizzler(requestedInfo, options, ctable, ctableCount, 0,
+ requestedInfo.width());
if (result != kSuccess) {
return result;
}
@@ -614,7 +616,7 @@ public:
{}
Result onStartScanlineDecode(const SkImageInfo& dstInfo, const Options& options,
- SkPMColor ctable[], int* ctableCount) override {
+ SkPMColor ctable[], int* ctableCount, int subsetLeft, int subsetWidth) override {
if (!conversion_possible(dstInfo, this->getInfo())) {
return kInvalidConversion;
}
@@ -627,7 +629,7 @@ public:
}
const Result result = this->initializeSwizzler(dstInfo, options, ctable,
- ctableCount);
+ ctableCount, subsetLeft, subsetWidth);
if (result != kSuccess) {
return result;
}
@@ -708,8 +710,7 @@ public:
}
Result onStartScanlineDecode(const SkImageInfo& dstInfo, const Options& options,
- SkPMColor ctable[], int* ctableCount) override
- {
+ SkPMColor ctable[], int* ctableCount, int subsetLeft, int subsetWidth) override {
if (!conversion_possible(dstInfo, this->getInfo())) {
return kInvalidConversion;
}
@@ -722,7 +723,7 @@ public:
}
const Result result = this->initializeSwizzler(dstInfo, options, ctable,
- ctableCount);
+ ctableCount, subsetLeft, subsetWidth);
if (result != kSuccess) {
return result;
}

Powered by Google App Engine
This is Rietveld 408576698