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

Unified Diff: src/codec/SkCodecAnimation.h

Issue 2045293002: Add support for multiple frames in SkCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Cache all frames in the GM Created 4 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/SkCodecAnimation.h
diff --git a/src/codec/SkCodecAnimation.h b/src/codec/SkCodecAnimation.h
new file mode 100644
index 0000000000000000000000000000000000000000..86ba21d16a06bbf3c60fbf1b4c7bbb749d725958
--- /dev/null
+++ b/src/codec/SkCodecAnimation.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2016 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkCodecAnimation_DEFINED
+#define SkCodecAnimation_DEFINED
+
+#include "SkRect.h"
+
+class SkCodecAnimation {
+public:
+ /**
+ * This specifies how the next frame is based on this frame.
+ *
+ * Names are based on the GIF 89a spec.
+ *
+ * The numbers correspond to values in a GIF.
+ */
+ enum DisposalMethod {
+ /**
+ * The next frame should be drawn on top of this one.
+ *
+ * In a GIF, a value of 0 (not specified) is also treated as Keep.
+ */
+ Keep_DisposalMethod = 1,
+
+ /**
+ * Similar to Keep, except the area inside this frame's rectangle
+ * should be cleared to the BackGround color (transparent) before
+ * drawing the next frame.
+ */
+ RestoreBGColor_DisposalMethod = 2,
+
+ /**
+ * The next frame should be drawn on top of the previous frame - i.e.
+ * disregarding this one.
+ *
+ * In a GIF, a value of 4 is treated as RestorePrevious.
msarett 2016/09/22 22:54:34 nit: also?
scroggo 2016/09/23 15:53:15 Haha, yes, that will be more clear.
+ */
+ RestorePrevious_DisposalMethod = 3,
+ };
+
+ struct FrameInfo {
+ DisposalMethod fDisposalMethod;
+
+ // The frame that this frame is drawn on top of, or
+ // SkCodec::kIndependentFrame.
+ size_t fRequiredFrame;
+
+ // The subset of the bounds that this frame describes.
+ SkIRect fFrameRect;
+
+ // How many 1/100 seconds to show this frame.
+ size_t fDuration;
+ };
+private:
+ SkCodecAnimation();
+};
+#endif // SkCodecAnimation_DEFINED

Powered by Google App Engine
This is Rietveld 408576698