aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec/SkCodecPriv.h
diff options
context:
space:
mode:
authorGravatar msarett <msarett@google.com>2015-09-04 13:28:25 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-09-04 13:28:26 -0700
commite9c10b9121887e8c300bd41357461418e061984d (patch)
tree8bcbf4fdcb69d2a747de67d76980c382eb78ada6 /src/codec/SkCodecPriv.h
parent92602963498f75f8ff26c8550c178fc95e06c400 (diff)
Scanline decoding for gifs
Diffstat (limited to 'src/codec/SkCodecPriv.h')
-rw-r--r--src/codec/SkCodecPriv.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/codec/SkCodecPriv.h b/src/codec/SkCodecPriv.h
index 726074195d..2769cec1cd 100644
--- a/src/codec/SkCodecPriv.h
+++ b/src/codec/SkCodecPriv.h
@@ -31,6 +31,17 @@
SkSwizzler::GetResult(zeroAlpha, maxAlpha);
/*
+ * 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;
+}
+
+/*
* Returns the first coordinate that we will keep during a scaled decode.
* The output can be interpreted as an x-coordinate or a y-coordinate.
*
@@ -137,7 +148,7 @@ static inline void copy_color_table(const SkImageInfo& dstInfo, SkColorTable* co
SkASSERT(nullptr != inputColorPtr);
SkASSERT(nullptr != inputColorCount);
SkASSERT(nullptr != colorTable);
- memcpy(inputColorPtr, colorTable->readColors(), *inputColorCount * 4);
+ memcpy(inputColorPtr, colorTable->readColors(), *inputColorCount * sizeof(SkPMColor));
}
}