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

Unified Diff: include/codec/SkCodec.h

Issue 980903002: Option for SkCodec to treat dst as all zeroes. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 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 | « no previous file | src/codec/SkCodec.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/codec/SkCodec.h
diff --git a/include/codec/SkCodec.h b/include/codec/SkCodec.h
index beb9cb97b32bdb51bed7cc4d76d24b968fe0858d..da55ea8d2044f008b79be1787c71743522c81134 100644
--- a/include/codec/SkCodec.h
+++ b/include/codec/SkCodec.h
@@ -48,6 +48,38 @@ public:
*/
SkISize getScaledDimensions(float desiredScale) const;
+ /**
+ * Whether or not the memory passed to getPixels is zero initialized.
+ */
+ enum ZeroInitialized {
scroggo 2015/03/05 16:12:23 I decided to go with ZeroInitialized instead of Sk
+ /**
+ * The memory passed to getPixels is zero initialized. The SkCodec
+ * may take advantage of this by skipping writing zeroes.
+ */
+ kYes_ZeroInitialized,
+ /**
+ * The memory passed to getPixels has not been initialized to zero,
+ * so the SkCodec must write all zeroes to memory.
+ *
+ * This is the default.
+ */
+ kNo_ZeroInitialized,
+ };
+
+ /**
+ * Specify whether this SkCodec should treat the memory passed to
+ * getPixels as zero initialized.
+ *
+ * The default is No.
+ */
+ void setZeroInitialized(ZeroInitialized zero) { fZeroInitialized = zero; }
scroggo 2015/03/05 16:12:23 It probably makes sense to include this as part of
+
+ /**
+ * Return whether this SkCodec considers memory passed to getPixels as
+ * zero initialized.
+ */
+ ZeroInitialized getZeroInitialized() const { return fZeroInitialized; }
+
protected:
SkCodec(const SkImageInfo&, SkStream*);
@@ -85,8 +117,9 @@ protected:
bool SK_WARN_UNUSED_RESULT rewindIfNeeded();
private:
- const SkImageInfo fInfo;
+ const SkImageInfo fInfo;
SkAutoTDelete<SkStream> fStream;
- bool fNeedsRewind;
+ bool fNeedsRewind;
+ ZeroInitialized fZeroInitialized;
};
#endif // SkCodec_DEFINED
« no previous file with comments | « no previous file | src/codec/SkCodec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698