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

Unified Diff: src/images/SkScaledBitmapSampler.h

Issue 25354004: Allow sampling GIF images during decode. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Switch back to using kIndex8 Created 7 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/images/SkImageDecoder_libgif.cpp ('k') | src/images/SkScaledBitmapSampler.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/images/SkScaledBitmapSampler.h
diff --git a/src/images/SkScaledBitmapSampler.h b/src/images/SkScaledBitmapSampler.h
index a293fe7ebb728d2ea88d1f95fbc3f5f341231042..e6c4577174c3551afbdf1b228b658d1b668113fe 100644
--- a/src/images/SkScaledBitmapSampler.h
+++ b/src/images/SkScaledBitmapSampler.h
@@ -22,6 +22,7 @@ public:
int scaledHeight() const { return fScaledHeight; }
int srcY0() const { return fY0; }
+ int srcDX() const { return fDX; }
int srcDY() const { return fDY; }
enum SrcConfig {
@@ -42,6 +43,12 @@ public:
// returns true if the row had non-opaque alpha in it
bool next(const uint8_t* SK_RESTRICT src);
+ // Like next(), but specifies the y value of the source row, so the
+ // rows can come in any order. If the row is not part of the output
+ // sample, it will be skipped. Only sampleInterlaced OR next should
+ // be called for one SkScaledBitmapSampler.
+ bool sampleInterlaced(const uint8_t* SK_RESTRICT src, int srcY);
+
typedef bool (*RowProc)(void* SK_RESTRICT dstRow,
const uint8_t* SK_RESTRICT src,
int width, int deltaSrc, int y,
@@ -56,6 +63,18 @@ private:
int fDX; // step between X samples
int fDY; // step between Y samples
+#ifdef SK_DEBUG
+ // Keep track of whether the caller is using next or sampleInterlaced.
+ // Only one can be used per sampler.
+ enum SampleMode {
+ kUninitialized_SampleMode,
+ kConsecutive_SampleMode,
+ kInterlaced_SampleMode,
+ };
+
+ SampleMode fSampleMode;
+#endif
+
// setup state
char* fDstRow; // points into bitmap's pixels
size_t fDstRowBytes;
« no previous file with comments | « src/images/SkImageDecoder_libgif.cpp ('k') | src/images/SkScaledBitmapSampler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698