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/SkScaledCodec.cpp

Issue 1305123002: Scanline decoding for gifs (Closed) Base URL: https://skia.googlesource.com/skia.git@real-bmp-scan
Patch Set: Make kScanline_Mode test kOutOfOrder correctly in dm 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
Index: src/codec/SkScaledCodec.cpp
diff --git a/src/codec/SkScaledCodec.cpp b/src/codec/SkScaledCodec.cpp
index a9e067eaaf6f07a0ba553436f2bda13d7fa0179b..5027d52f88242e160ddcb245895179cb959f3430 100644
--- a/src/codec/SkScaledCodec.cpp
+++ b/src/codec/SkScaledCodec.cpp
@@ -44,15 +44,6 @@ SkScaledCodec::SkScaledCodec(SkScanlineDecoder* scanlineDecoder)
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) {
if (nativeDims == scaledCodecDims) {
@@ -197,7 +188,23 @@ SkCodec::Result SkScaledCodec::onGetPixels(const SkImageInfo& requestedInfo, voi
Result result = fScanlineDecoder->start(requestedInfo, &options, ctable, ctableCount);
if (kSuccess == result) {
// native decode supported
- return fScanlineDecoder->getScanlines(dst, requestedInfo.height(), rowBytes);
+ 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);
+ if (kSuccess != result && kIncompleteInput != result) {
scroggo 2015/09/02 22:45:48 Again, I am concerned about accepting kIncomplete
msarett 2015/09/03 17:13:31 I would agree that we should return result at the
scroggo 2015/09/04 18:42:09 I'm happy with a FIXME. I think I understand what'
msarett 2015/09/04 19:52:47 I think we can improve on this... FIXME sounds go
+ return result;
+ }
+ }
+ return kSuccess;
+ }
+ }
}
if (kInvalidScale != result) {

Powered by Google App Engine
This is Rietveld 408576698