summaryrefslogtreecommitdiffstats
path: root/image/AnimationParams.h
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-11-20 20:38:49 +0100
committerwolfbeast <mcwerewolf@gmail.com>2018-11-20 20:38:49 +0100
commit807acf738f63d95fbecfb9129092aaa2379889ba (patch)
treed701e0f93dca6b66759a784e7d8a53f18d66ff3c /image/AnimationParams.h
parent238b430ec0446d08a8fd513ae7b4000b5996fd69 (diff)
downloadUXP-807acf738f63d95fbecfb9129092aaa2379889ba.tar
UXP-807acf738f63d95fbecfb9129092aaa2379889ba.tar.gz
UXP-807acf738f63d95fbecfb9129092aaa2379889ba.tar.lz
UXP-807acf738f63d95fbecfb9129092aaa2379889ba.tar.xz
UXP-807acf738f63d95fbecfb9129092aaa2379889ba.zip
Bug 1462355 - Part 1a. Make imgFrame animation parameters threadsafe.
We currently choose to set the animation parameters (blend method, blend rect, disposal method, timeout) in imgFrame::Finish instead of imgFrame::InitForDecoder. The decoders themselves already have access to the necessary information at the time InitForDecoder is called, so there is no reason to do this. Moving the configuration to initialization will allow us to relax the mutex protection on these parameters. This part simply reorganizes imgFrame, and subsequent parts will introduce the necessary changes to SurfacePipe and decoders.
Diffstat (limited to 'image/AnimationParams.h')
-rw-r--r--image/AnimationParams.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/image/AnimationParams.h b/image/AnimationParams.h
new file mode 100644
index 000000000..916ba7e40
--- /dev/null
+++ b/image/AnimationParams.h
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef mozilla_image_AnimationParams_h
+#define mozilla_image_AnimationParams_h
+
+#include <stdint.h>
+#include "mozilla/gfx/Rect.h"
+#include "FrameTimeout.h"
+
+namespace mozilla {
+namespace image {
+
+enum class BlendMethod : int8_t {
+ // All color components of the frame, including alpha, overwrite the current
+ // contents of the frame's output buffer region.
+ SOURCE,
+
+ // The frame should be composited onto the output buffer based on its alpha,
+ // using a simple OVER operation.
+ OVER
+};
+
+enum class DisposalMethod : int8_t {
+ CLEAR_ALL = -1, // Clear the whole image, revealing what's underneath.
+ NOT_SPECIFIED, // Leave the frame and let the new frame draw on top.
+ KEEP, // Leave the frame and let the new frame draw on top.
+ CLEAR, // Clear the frame's area, revealing what's underneath.
+ RESTORE_PREVIOUS // Restore the previous (composited) frame.
+};
+
+struct AnimationParams
+{
+ gfx::IntRect mBlendRect;
+ FrameTimeout mTimeout;
+ uint32_t mFrameNum;
+ BlendMethod mBlendMethod;
+ DisposalMethod mDisposalMethod;
+};
+
+} // namespace image
+} // namespace mozilla