summaryrefslogtreecommitdiffstats
path: root/gfx/2d/DrawTargetRecording.h
diff options
context:
space:
mode:
Diffstat (limited to 'gfx/2d/DrawTargetRecording.h')
-rw-r--r--gfx/2d/DrawTargetRecording.h46
1 files changed, 45 insertions, 1 deletions
diff --git a/gfx/2d/DrawTargetRecording.h b/gfx/2d/DrawTargetRecording.h
index 239d7ccfd4..5b24bd2987 100644
--- a/gfx/2d/DrawTargetRecording.h
+++ b/gfx/2d/DrawTargetRecording.h
@@ -18,7 +18,7 @@ struct RemoteTextureOwnerId;
namespace gfx {
-class DrawTargetRecording : public DrawTarget {
+class DrawTargetRecording final : public DrawTarget {
public:
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(DrawTargetRecording, override)
DrawTargetRecording(DrawEventRecorder* aRecorder, DrawTarget* aDT,
@@ -71,6 +71,13 @@ class DrawTargetRecording : public DrawTarget {
const DrawSurfaceOptions& aSurfOptions = DrawSurfaceOptions(),
const DrawOptions& aOptions = DrawOptions()) override;
+ virtual void DrawSurfaceDescriptor(
+ const layers::SurfaceDescriptor& aDesc,
+ const RefPtr<layers::Image>& aImageOfSurfaceDescriptor, const Rect& aDest,
+ const Rect& aSource,
+ const DrawSurfaceOptions& aSurfOptions = DrawSurfaceOptions(),
+ const DrawOptions& aOptions = DrawOptions()) override;
+
virtual void DrawDependentSurface(uint64_t aId, const Rect& aDest) override;
virtual void DrawFilter(FilterNode* aNode, const Rect& aSourceRect,
@@ -369,6 +376,10 @@ class DrawTargetRecording : public DrawTarget {
void MarkClean() { mIsDirty = false; }
+ void SetOptimizeTransform(bool aOptimizeTransform) {
+ mOptimizeTransform = aOptimizeTransform;
+ }
+
private:
/**
* Used for creating a DrawTargetRecording for a CreateSimilarDrawTarget call.
@@ -380,6 +391,35 @@ class DrawTargetRecording : public DrawTarget {
DrawTargetRecording(const DrawTargetRecording* aDT, IntRect aRect,
SurfaceFormat aFormat);
+ void RecordTransform(const Matrix& aTransform) const;
+
+ void FlushTransform() const {
+ if (mTransformDirty) {
+ if (!mRecordedTransform.ExactlyEquals(mTransform)) {
+ RecordTransform(mTransform);
+ }
+ mTransformDirty = false;
+ }
+ }
+
+ void RecordEvent(const RecordedEvent& aEvent) const {
+ FlushTransform();
+ mRecorder->RecordEvent(aEvent);
+ }
+
+ void RecordEventSelf(const RecordedEvent& aEvent) const {
+ FlushTransform();
+ mRecorder->RecordEvent(this, aEvent);
+ }
+
+ void RecordEventSkipFlushTransform(const RecordedEvent& aEvent) const {
+ mRecorder->RecordEvent(aEvent);
+ }
+
+ void RecordEventSelfSkipFlushTransform(const RecordedEvent& aEvent) const {
+ mRecorder->RecordEvent(this, aEvent);
+ }
+
Path* GetPathForPathRecording(const Path* aPath) const;
already_AddRefed<PathRecording> EnsurePathStored(const Path* aPath);
void EnsurePatternDependenciesStored(const Pattern& aPattern);
@@ -403,6 +443,10 @@ class DrawTargetRecording : public DrawTarget {
std::vector<PushedLayer> mPushedLayers;
bool mIsDirty = false;
+ bool mOptimizeTransform = false;
+
+ // Last transform that was used in the recording.
+ mutable Matrix mRecordedTransform;
};
} // namespace gfx