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

Unified Diff: src/codec/SkPngCodec.cpp

Issue 2247743002: Fix color xform width bug when scaling/subsetting (Closed) Base URL: https://skia.googlesource.com/skia.git@skipstuff
Patch Set: Rebase Created 4 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/SkPngCodec.h ('k') | src/codec/SkSwizzler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codec/SkPngCodec.cpp
diff --git a/src/codec/SkPngCodec.cpp b/src/codec/SkPngCodec.cpp
index 0d13e6ac2e70fc73606e99e65e3e15c36f67f6db..2b52ab72d75d6faa9b72047aa24df93699686778 100644
--- a/src/codec/SkPngCodec.cpp
+++ b/src/codec/SkPngCodec.cpp
@@ -358,9 +358,8 @@ static bool png_conversion_possible(const SkImageInfo& dst, const SkImageInfo& s
}
}
-void SkPngCodec::allocateStorage(const SkImageInfo& dstInfo) {
- const int width = this->getInfo().width();
- size_t colorXformBytes = fColorXform ? width * sizeof(uint32_t) : 0;
+void SkPngCodec::allocateStorage() {
+ size_t colorXformBytes = fColorXform ? fSwizzler->swizzleWidth() * sizeof(uint32_t) : 0;
fStorage.reset(SkAlign4(fSrcRowBytes) + colorXformBytes);
fSwizzlerSrcRow = fStorage.get();
@@ -384,7 +383,7 @@ public:
return kInvalidConversion;
}
- this->allocateStorage(dstInfo);
+ this->allocateStorage();
return kSuccess;
}
@@ -413,7 +412,7 @@ public:
fSwizzler->swizzle(swizzlerDstRow, fSwizzlerSrcRow);
if (fColorXform) {
- fColorXform->apply(dst, (const uint32_t*) swizzlerDstRow, dstInfo.width(),
+ fColorXform->apply(dst, (const uint32_t*) swizzlerDstRow, fSwizzler->swizzleWidth(),
dstInfo.colorType(), xformAlphaType);
dst = SkTAddOffset<void>(dst, rowBytes);
}
@@ -464,7 +463,7 @@ public:
return kInvalidConversion;
}
- this->allocateStorage(dstInfo);
+ this->allocateStorage();
fCanSkipRewind = true;
return SkCodec::kSuccess;
}
@@ -515,8 +514,9 @@ public:
if (fColorXform) {
if (fColorXform) {
- fColorXform->apply(dst, (const uint32_t*) swizzlerDstRow, dstInfo.width(),
- dstInfo.colorType(), xformAlphaType);
+ fColorXform->apply(dst, (const uint32_t*) swizzlerDstRow,
+ fSwizzler->swizzleWidth(), dstInfo.colorType(),
+ xformAlphaType);
dst = SkTAddOffset<void>(dst, rowBytes);
}
}
@@ -865,7 +865,7 @@ SkCodec::Result SkPngCodec::onGetPixels(const SkImageInfo& dstInfo, void* dst,
return kUnimplemented;
}
- this->allocateStorage(dstInfo);
+ this->allocateStorage();
int count = this->readRows(dstInfo, dst, rowBytes, dstInfo.height(), 0);
if (count > dstInfo.height()) {
*rowsDecoded = count;
« no previous file with comments | « src/codec/SkPngCodec.h ('k') | src/codec/SkSwizzler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698