Make haveDecodedRow return void
The method already always returns true, except in a single case after
asserting.
Change-Id: Icf241a8af04220d459c0782ffd9b74c34c753236
Reviewed-on: https://skia-review.googlesource.com/37161
Reviewed-by: Chris Blume <cblume@chromium.org>
Commit-Queue: Leon Scroggins <scroggo@google.com>
diff --git a/src/codec/SkGifCodec.cpp b/src/codec/SkGifCodec.cpp
index 9f9f8a6..682b69f 100644
--- a/src/codec/SkGifCodec.cpp
+++ b/src/codec/SkGifCodec.cpp
@@ -421,7 +421,7 @@
}
}
-bool SkGifCodec::haveDecodedRow(int frameIndex, const unsigned char* rowBegin,
+void SkGifCodec::haveDecodedRow(int frameIndex, const unsigned char* rowBegin,
int rowNumber, int repeatCount, bool writeTransparentPixels)
{
const SkGIFFrameContext* frameContext = fReader->frameContext(frameIndex);
@@ -439,7 +439,7 @@
// FIXME: No need to make the checks on width/xBegin/xEnd for every row. We could instead do
// this once in prepareToDecode.
if (!width || (xBegin < 0) || (yBegin < 0) || (xEnd <= xBegin) || (yEnd <= yBegin))
- return true;
+ return;
// yBegin is the first row in the non-sampled image. dstRow will be the row in the output,
// after potentially scaling it.
@@ -456,7 +456,7 @@
dstRow = potentialRow / sampleY;
const int scaledHeight = get_scaled_dimension(this->dstInfo().height(), sampleY);
if (dstRow >= scaledHeight) {
- return true;
+ return;
}
foundNecessaryRow = true;
@@ -474,7 +474,7 @@
}
if (!foundNecessaryRow) {
- return true;
+ return;
}
} else {
// Make sure the repeatCount does not take us beyond the end of the dst
@@ -536,8 +536,7 @@
break;
default:
SkASSERT(false);
- return false;
- break;
+ return;
}
p.append(SkRasterPipeline::srcover);
p.append(storeDst, &dst);
@@ -555,6 +554,4 @@
memcpy(dst, copiedLine, bytesToCopy);
}
}
-
- return true;
}
diff --git a/src/codec/SkGifCodec.h b/src/codec/SkGifCodec.h
index 89c84bd..68f9749 100644
--- a/src/codec/SkGifCodec.h
+++ b/src/codec/SkGifCodec.h
@@ -32,7 +32,7 @@
static std::unique_ptr<SkCodec> MakeFromStream(std::unique_ptr<SkStream>, Result*);
// Callback for SkGifImageReader when a row is available.
- bool haveDecodedRow(int frameIndex, const unsigned char* rowBegin,
+ void haveDecodedRow(int frameIndex, const unsigned char* rowBegin,
int rowNumber, int repeatCount, bool writeTransparentPixels);
protected:
/*
diff --git a/third_party/gif/SkGifImageReader.cpp b/third_party/gif/SkGifImageReader.cpp
index e3b225d..ed20af0 100644
--- a/third_party/gif/SkGifImageReader.cpp
+++ b/third_party/gif/SkGifImageReader.cpp
@@ -97,7 +97,7 @@
#define GETINT16(p) ((p)[1]<<8|(p)[0])
// Send the data to the display front-end.
-bool SkGIFLZWContext::outputRow(const unsigned char* rowBegin)
+void SkGIFLZWContext::outputRow(const unsigned char* rowBegin)
{
int drowStart = irow;
int drowEnd = irow;
@@ -144,13 +144,12 @@
// Protect against too much image data.
if (drowStart >= m_frameContext->height())
- return true;
+ return;
// CALLBACK: Let the client know we have decoded a row.
const bool writeTransparentPixels = (SkCodec::kNone == m_frameContext->getRequiredFrame());
- if (!m_client->haveDecodedRow(m_frameContext->frameId(), rowBegin,
- drowStart, drowEnd - drowStart + 1, writeTransparentPixels))
- return false;
+ m_client->haveDecodedRow(m_frameContext->frameId(), rowBegin,
+ drowStart, drowEnd - drowStart + 1, writeTransparentPixels);
if (!m_frameContext->interlaced())
irow++;
@@ -194,7 +193,6 @@
}
} while (irow > (unsigned) (m_frameContext->height() - 1));
}
- return true;
}
// Perform Lempel-Ziv-Welch decoding.
@@ -287,8 +285,7 @@
// Output as many rows as possible.
unsigned char* rowBegin = rowBuffer.begin();
for (; rowBegin + width <= rowIter; rowBegin += width) {
- if (!outputRow(rowBegin))
- return false;
+ outputRow(rowBegin);
rowsRemaining--;
if (!rowsRemaining)
return true;
diff --git a/third_party/gif/SkGifImageReader.h b/third_party/gif/SkGifImageReader.h
index d87b68f..69045dd 100644
--- a/third_party/gif/SkGifImageReader.h
+++ b/third_party/gif/SkGifImageReader.h
@@ -110,7 +110,7 @@
{ }
bool prepareToDecode();
- bool outputRow(const unsigned char* rowBegin);
+ void outputRow(const unsigned char* rowBegin);
bool doLZW(const unsigned char* block, size_t bytesInBlock);
bool hasRemainingRows() { return SkToBool(rowsRemaining); }