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

Unified Diff: src/codec/SkBmpCodec.cpp

Issue 1321433002: Add subsetting to SkScaledCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@gif-scan
Patch Set: Rebase - it compiles but I'm sure everything is broken 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
« no previous file with comments | « src/codec/SkBmpCodec.h ('k') | src/codec/SkBmpMaskCodec.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codec/SkBmpCodec.cpp
diff --git a/src/codec/SkBmpCodec.cpp b/src/codec/SkBmpCodec.cpp
index 1aa43f583cbcc2a536c6f1b8e8fb6dd15acb7be5..d455db45688fe819deeff2f23b4eb721892d8036 100644
--- a/src/codec/SkBmpCodec.cpp
+++ b/src/codec/SkBmpCodec.cpp
@@ -535,10 +535,18 @@ SkBmpCodec::SkBmpCodec(const SkImageInfo& info, SkStream* stream,
: INHERITED(info, stream)
, fBitsPerPixel(bitsPerPixel)
, fRowOrder(rowOrder)
+ , fSubsetLeft(0)
+ , fSubsetWidth(this->getInfo().width())
{}
bool SkBmpCodec::onRewind() {
- return SkBmpCodec::ReadHeader(this->stream(), this->inIco(), nullptr);
+ if (!SkBmpCodec::ReadHeader(this->stream(), this->inIco(), nullptr)) {
+ return false;
+ }
+
+ fSubsetLeft = 0;
+ fSubsetWidth = this->getInfo().width();
+ return true;
}
int32_t SkBmpCodec::getDstRow(int32_t y, int32_t height) const {
@@ -563,7 +571,8 @@ uint32_t SkBmpCodec::computeNumColors(uint32_t numColors) {
}
SkCodec::Result SkBmpCodec::onStartScanlineDecode(const SkImageInfo& dstInfo,
- const SkCodec::Options& options, SkPMColor inputColorPtr[], int* inputColorCount) {
+ const SkCodec::Options& options, SkPMColor inputColorPtr[], int* inputColorCount,
+ int subsetLeft, int subsetWidth) {
if (options.fSubset) {
// Subsets are not supported.
return kUnimplemented;
@@ -573,7 +582,9 @@ SkCodec::Result SkBmpCodec::onStartScanlineDecode(const SkImageInfo& dstInfo,
return kInvalidConversion;
}
- return prepareToDecode(dstInfo, options, inputColorPtr, inputColorCount);
+ this->fSubsetLeft = subsetLeft;
+ this->fSubsetWidth = subsetWidth;
+ return this->prepareToDecode(dstInfo, options, inputColorPtr, inputColorCount);
}
int SkBmpCodec::onGetScanlines(void* dst, int count, size_t rowBytes) {
« no previous file with comments | « src/codec/SkBmpCodec.h ('k') | src/codec/SkBmpMaskCodec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698