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

Unified Diff: src/codec/SkBmpMaskCodec.cpp

Issue 1332053002: Fill incomplete images in SkCodec parent class (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Use aligned memory in swizzler test 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/SkBmpMaskCodec.h ('k') | src/codec/SkBmpRLECodec.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codec/SkBmpMaskCodec.cpp
diff --git a/src/codec/SkBmpMaskCodec.cpp b/src/codec/SkBmpMaskCodec.cpp
index 81067c7711bbb70177bd653dcc1d4cade892e5f3..336698d319d2e8f96c10a2b60da755040535f150 100644
--- a/src/codec/SkBmpMaskCodec.cpp
+++ b/src/codec/SkBmpMaskCodec.cpp
@@ -29,7 +29,8 @@ SkCodec::Result SkBmpMaskCodec::onGetPixels(const SkImageInfo& dstInfo,
void* dst, size_t dstRowBytes,
const Options& opts,
SkPMColor* inputColorPtr,
- int* inputColorCount) {
+ int* inputColorCount,
+ int* rowsDecoded) {
if (opts.fSubset) {
// Subsets are not supported.
return kUnimplemented;
@@ -49,7 +50,12 @@ SkCodec::Result SkBmpMaskCodec::onGetPixels(const SkImageInfo& dstInfo,
return result;
}
- return this->decodeRows(dstInfo, dst, dstRowBytes, opts);
+ uint32_t rows = this->decodeRows(dstInfo, dst, dstRowBytes, opts);
+ if (rows != dstInfo.height()) {
+ *rowsDecoded = rows;
+ return kIncompleteInput;
+ }
+ return kSuccess;
}
bool SkBmpMaskCodec::initializeSwizzler(const SkImageInfo& dstInfo) {
@@ -78,7 +84,7 @@ SkCodec::Result SkBmpMaskCodec::prepareToDecode(const SkImageInfo& dstInfo,
/*
* Performs the decoding
*/
-SkCodec::Result SkBmpMaskCodec::decodeRows(const SkImageInfo& dstInfo,
+int SkBmpMaskCodec::decodeRows(const SkImageInfo& dstInfo,
void* dst, size_t dstRowBytes,
const Options& opts) {
// Iterate over rows of the image
@@ -88,12 +94,7 @@ SkCodec::Result SkBmpMaskCodec::decodeRows(const SkImageInfo& dstInfo,
// Read a row of the input
if (this->stream()->read(srcRow, fSrcRowBytes) != fSrcRowBytes) {
SkCodecPrintf("Warning: incomplete input stream.\n");
- // Fill the destination image on failure
- void* dstStart = this->getDstStartRow(dst, dstRowBytes, y);
- uint32_t fillColor = get_fill_color_or_index(dstInfo.alphaType());
- SkSwizzler::Fill(dstStart, dstInfo, dstRowBytes, height - y,
- fillColor, nullptr, opts.fZeroInitialized);
- return kIncompleteInput;
+ return y;
}
// Decode the row in destination format
@@ -103,5 +104,5 @@ SkCodec::Result SkBmpMaskCodec::decodeRows(const SkImageInfo& dstInfo,
}
// Finished decoding the entire image
- return kSuccess;
+ return height;
}
« no previous file with comments | « src/codec/SkBmpMaskCodec.h ('k') | src/codec/SkBmpRLECodec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698