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

Unified Diff: src/codec/SkScaledCodec.cpp

Issue 1320273004: Revert of Scanline decoding for gifs (Closed) Base URL: https://skia.googlesource.com/skia.git@real-bmp-scan
Patch Set: Created 5 years, 3 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/SkCodec_libgif.cpp ('k') | src/codec/SkScanlineDecoder.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codec/SkScaledCodec.cpp
diff --git a/src/codec/SkScaledCodec.cpp b/src/codec/SkScaledCodec.cpp
index cf678db8565d0b131d359b28ab6256379e825971..a9e067eaaf6f07a0ba553436f2bda13d7fa0179b 100644
--- a/src/codec/SkScaledCodec.cpp
+++ b/src/codec/SkScaledCodec.cpp
@@ -43,6 +43,15 @@
{}
SkScaledCodec::~SkScaledCodec() {}
+
+// returns a scaled dimension based on the original dimension and the sampleSize
+// NOTE: we round down here for scaled dimension to match the behavior of SkImageDecoder
+static int get_scaled_dimension(int srcDimension, int sampleSize) {
+ if (sampleSize > srcDimension) {
+ return 1;
+ }
+ return srcDimension / sampleSize;
+}
static SkISize best_scaled_dimensions(const SkISize& origDims, const SkISize& nativeDims,
const SkISize& scaledCodecDims, float desiredScale) {
@@ -188,25 +197,7 @@
Result result = fScanlineDecoder->start(requestedInfo, &options, ctable, ctableCount);
if (kSuccess == result) {
// native decode supported
- switch (fScanlineDecoder->getScanlineOrder()) {
- case SkScanlineDecoder::kTopDown_SkScanlineOrder:
- case SkScanlineDecoder::kBottomUp_SkScanlineOrder:
- case SkScanlineDecoder::kNone_SkScanlineOrder:
- return fScanlineDecoder->getScanlines(dst, requestedInfo.height(), rowBytes);
- case SkScanlineDecoder::kOutOfOrder_SkScanlineOrder: {
- for (int y = 0; y < requestedInfo.height(); y++) {
- int dstY = fScanlineDecoder->getY();
- void* dstPtr = SkTAddOffset<void>(dst, rowBytes * dstY);
- result = fScanlineDecoder->getScanlines(dstPtr, 1, rowBytes);
- // FIXME (msarett): Make the SkCodec base class take care of filling
- // uninitialized pixels so we can return immediately on kIncompleteInput.
- if (kSuccess != result && kIncompleteInput != result) {
- return result;
- }
- }
- return result;
- }
- }
+ return fScanlineDecoder->getScanlines(dst, requestedInfo.height(), rowBytes);
}
if (kInvalidScale != result) {
@@ -255,7 +246,7 @@
}
dst = SkTAddOffset<void>(dst, rowBytes);
}
- return result;
+ return kSuccess;
}
case SkScanlineDecoder::kBottomUp_SkScanlineOrder:
case SkScanlineDecoder::kOutOfOrder_SkScanlineOrder: {
@@ -274,13 +265,13 @@
}
}
}
- return result;
+ return kSuccess;
}
case SkScanlineDecoder::kNone_SkScanlineOrder: {
SkAutoMalloc storage(srcHeight * rowBytes);
uint8_t* storagePtr = static_cast<uint8_t*>(storage.get());
result = fScanlineDecoder->getScanlines(storagePtr, srcHeight, rowBytes);
- if (kSuccess != result && kIncompleteInput != result) {
+ if (kSuccess != result) {
return result;
}
storagePtr += Y0 * rowBytes;
@@ -289,7 +280,7 @@
storagePtr += sampleY * rowBytes;
dst = SkTAddOffset<void>(dst, rowBytes);
}
- return result;
+ return kSuccess;
}
default:
SkASSERT(false);
« no previous file with comments | « src/codec/SkCodec_libgif.cpp ('k') | src/codec/SkScanlineDecoder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698