Skip to content

Commit

Permalink
Bug 1875364 - Make recordings cache current filter rather than includ…
Browse files Browse the repository at this point in the history
…e for each event. r=gfx-reviewers,lsalzman

This patch also makes it so that creating a new draw target or filter
node will set the current, as well as making destruction of a draw
target use the current pointer.

Differential Revision: https://phabricator.services.mozilla.com/D199023

UltraBlame original commit: b6393478fdf670fcce10fd4334c2601561eaea5d
  • Loading branch information
marco-c committed Jan 19, 2024
1 parent b71b330 commit 7b3c03d
Show file tree
Hide file tree
Showing 9 changed files with 670 additions and 225 deletions.
30 changes: 29 additions & 1 deletion gfx/2d/DrawEventRecorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void
DrawEventRecorderPrivate
:
:
SetDrawTarget
RecordSetCurrentDrawTarget
(
ReferencePtr
aDT
Expand Down Expand Up @@ -100,6 +100,34 @@ void
DrawEventRecorderPrivate
:
:
RecordSetCurrentFilterNode
(
ReferencePtr
aFilter
)
{
NS_ASSERT_OWNINGTHREAD
(
DrawEventRecorderPrivate
)
;
RecordEvent
(
RecordedSetCurrentFilterNode
(
aFilter
)
)
;
mCurrentFilter
=
aFilter
;
}
void
DrawEventRecorderPrivate
:
:
StoreExternalSurfaceRecording
(
SourceSurface
Expand Down
168 changes: 165 additions & 3 deletions gfx/2d/DrawEventRecorder.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ class
DrawTargetRecording
;
class
FilterNodeRecording
;
class
PathRecording
;
class
Expand Down Expand Up @@ -377,7 +380,7 @@ mCurrentDT
dt
)
{
SetDrawTarget
RecordSetCurrentDrawTarget
(
dt
)
Expand All @@ -390,14 +393,27 @@ aEvent
;
}
void
SetDrawTarget
RecordSetCurrentDrawTarget
(
ReferencePtr
aDT
)
;
void
ClearDrawTarget
SetCurrentDrawTarget
(
DrawTargetRecording
*
aDT
)
{
mCurrentDT
=
aDT
;
}
void
ClearCurrentDrawTarget
(
DrawTargetRecording
*
Expand All @@ -424,6 +440,149 @@ nullptr
}
}
void
RecordEvent
(
FilterNodeRecording
*
aFilter
const
RecordedEvent
&
aEvent
)
{
ReferencePtr
filter
=
aFilter
;
if
(
mCurrentFilter
!
=
filter
)
{
RecordSetCurrentFilterNode
(
filter
)
;
}
RecordEvent
(
aEvent
)
;
}
void
RecordSetCurrentFilterNode
(
ReferencePtr
aFilter
)
;
void
SetCurrentFilterNode
(
FilterNodeRecording
*
aFilter
)
{
mCurrentFilter
=
aFilter
;
}
void
ClearCurrentFilterNode
(
FilterNodeRecording
*
aFilter
)
{
ReferencePtr
filter
=
aFilter
;
if
(
mCurrentFilter
=
=
filter
)
{
mCurrentFilter
=
nullptr
;
}
}
void
RecordEvent
(
DrawTargetRecording
*
aDT
FilterNodeRecording
*
aFilter
const
RecordedEvent
&
aEvent
)
{
ReferencePtr
dt
=
aDT
;
if
(
mCurrentDT
!
=
dt
)
{
RecordSetCurrentDrawTarget
(
dt
)
;
}
ReferencePtr
filter
=
aFilter
;
if
(
mCurrentFilter
!
=
filter
)
{
RecordSetCurrentFilterNode
(
filter
)
;
}
RecordEvent
(
aEvent
)
;
}
void
AddStoredObject
(
const
Expand Down Expand Up @@ -992,6 +1151,9 @@ mStoredSurfaces
ReferencePtr
mCurrentDT
;
ReferencePtr
mCurrentFilter
;
ExternalSurfacesHolder
mExternalSurfaces
;
Expand Down
Loading

0 comments on commit 7b3c03d

Please sign in to comment.