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 a6ffea5 commit 0b77d52
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 @@ -188,7 +188,7 @@ void
DrawEventRecorderPrivate
:
:
SetDrawTarget
RecordSetCurrentDrawTarget
(
ReferencePtr
aDT
Expand Down Expand Up @@ -216,6 +216,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 @@ -205,6 +205,9 @@ class
DrawTargetRecording
;
class
FilterNodeRecording
;
class
PathRecording
;
class
Expand Down Expand Up @@ -550,7 +553,7 @@ mCurrentDT
dt
)
{
SetDrawTarget
RecordSetCurrentDrawTarget
(
dt
)
Expand All @@ -563,14 +566,27 @@ aEvent
;
}
void
SetDrawTarget
RecordSetCurrentDrawTarget
(
ReferencePtr
aDT
)
;
void
ClearDrawTarget
SetCurrentDrawTarget
(
DrawTargetRecording
*
aDT
)
{
mCurrentDT
=
aDT
;
}
void
ClearCurrentDrawTarget
(
DrawTargetRecording
*
Expand All @@ -597,6 +613,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 @@ -1449,6 +1608,9 @@ mStoredSurfaces
ReferencePtr
mCurrentDT
;
ReferencePtr
mCurrentFilter
;
ExternalSurfacesHolder
mExternalSurfaces
;
Expand Down
Loading

0 comments on commit 0b77d52

Please sign in to comment.