diff --git a/gfx/2d/DrawEventRecorder.cpp b/gfx/2d/DrawEventRecorder.cpp index 2946bc81f5278..878ea6abb9307 100644 --- a/gfx/2d/DrawEventRecorder.cpp +++ b/gfx/2d/DrawEventRecorder.cpp @@ -188,7 +188,7 @@ void DrawEventRecorderPrivate : : -SetDrawTarget +RecordSetCurrentDrawTarget ( ReferencePtr aDT @@ -216,6 +216,34 @@ void DrawEventRecorderPrivate : : +RecordSetCurrentFilterNode +( +ReferencePtr +aFilter +) +{ +NS_ASSERT_OWNINGTHREAD +( +DrawEventRecorderPrivate +) +; +RecordEvent +( +RecordedSetCurrentFilterNode +( +aFilter +) +) +; +mCurrentFilter += +aFilter +; +} +void +DrawEventRecorderPrivate +: +: StoreExternalSurfaceRecording ( SourceSurface diff --git a/gfx/2d/DrawEventRecorder.h b/gfx/2d/DrawEventRecorder.h index ba9fe36b6199c..2e075772fe193 100644 --- a/gfx/2d/DrawEventRecorder.h +++ b/gfx/2d/DrawEventRecorder.h @@ -205,6 +205,9 @@ class DrawTargetRecording ; class +FilterNodeRecording +; +class PathRecording ; class @@ -550,7 +553,7 @@ mCurrentDT dt ) { -SetDrawTarget +RecordSetCurrentDrawTarget ( dt ) @@ -563,14 +566,27 @@ aEvent ; } void -SetDrawTarget +RecordSetCurrentDrawTarget ( ReferencePtr aDT ) ; void -ClearDrawTarget +SetCurrentDrawTarget +( +DrawTargetRecording +* +aDT +) +{ +mCurrentDT += +aDT +; +} +void +ClearCurrentDrawTarget ( DrawTargetRecording * @@ -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 @@ -1449,6 +1608,9 @@ mStoredSurfaces ReferencePtr mCurrentDT ; +ReferencePtr +mCurrentFilter +; ExternalSurfacesHolder mExternalSurfaces ; diff --git a/gfx/2d/DrawTargetRecording.cpp b/gfx/2d/DrawTargetRecording.cpp index 6edc6ec151ec4..75f4b058798cd 100644 --- a/gfx/2d/DrawTargetRecording.cpp +++ b/gfx/2d/DrawTargetRecording.cpp @@ -864,13 +864,18 @@ mRecorder > RecordEvent ( +this RecordedFilterNodeDestruction ( -ReferencePtr -( -this ) ) +; +mRecorder +- +> +ClearCurrentFilterNode +( +this ) ; } @@ -899,9 +904,9 @@ mRecorder > RecordEvent ( +this RecordedFilterNodeSetInput ( -this aIndex aSurface ) @@ -935,9 +940,9 @@ mRecorder > RecordEvent ( +this RecordedFilterNodeSetInput ( -this aIndex aFilter ) @@ -968,10 +973,11 @@ mRecorder > RecordEvent ( +\ +this RecordedFilterNodeSetAttribute ( \ -this aIndex aValue \ @@ -1107,9 +1113,9 @@ mRecorder > RecordEvent ( +this RecordedFilterNodeSetAttribute ( -this aIndex aFloat aSize @@ -1218,6 +1224,14 @@ GetFormat ) ) ; +mRecorder +- +> +SetCurrentDrawTarget +( +this +) +; mFormat = mFinalDT @@ -1335,6 +1349,14 @@ snapshot ) ) ; +mRecorder +- +> +SetCurrentDrawTarget +( +this +) +; mFormat = mFinalDT @@ -1419,19 +1441,16 @@ mRecorder > RecordEvent ( +this RecordedDrawTargetDestruction ( -ReferencePtr -( -this -) ) ) ; mRecorder - > -ClearDrawTarget +ClearCurrentDrawTarget ( this ) @@ -3026,6 +3045,17 @@ if ( ! aNode +| +| +aNode +- +> +GetBackendType +( +) +! += +FILTER_BACKEND_RECORDING ) { return @@ -3048,9 +3078,16 @@ mRecorder RecordEvent ( this -RecordedDrawFilter +static_cast +< +FilterNodeRecording +* +> ( aNode +) +RecordedDrawFilter +( aSourceRect aDestPoint aOptions @@ -3073,7 +3110,7 @@ aType { RefPtr < -FilterNode +FilterNodeRecording > retNode = @@ -3096,6 +3133,14 @@ aType ) ) ; +mRecorder +- +> +SetCurrentFilterNode +( +retNode +) +; return retNode . @@ -4186,7 +4231,7 @@ const { RefPtr < -DrawTarget +DrawTargetRecording > similarDT ; @@ -4245,6 +4290,14 @@ aFormat ) ) ; +mRecorder +- +> +SetCurrentDrawTarget +( +similarDT +) +; } else if @@ -4387,11 +4440,9 @@ aFormat { RefPtr < -DrawTarget +DrawTargetRecording > similarDT -; -similarDT = new DrawTargetRecording @@ -4419,6 +4470,14 @@ aFormat ) ) ; +mRecorder +- +> +SetCurrentDrawTarget +( +similarDT +) +; similarDT - > @@ -4464,7 +4523,7 @@ aDestPoint { RefPtr < -DrawTarget +DrawTargetRecording > similarDT ; @@ -4520,6 +4579,14 @@ aDestPoint ) ) ; +mRecorder +- +> +SetCurrentDrawTarget +( +similarDT +) +; } else if @@ -5096,6 +5163,14 @@ nullptr ) ) ; +mRecorder +- +> +SetCurrentDrawTarget +( +this +) +; / / Add diff --git a/gfx/2d/InlineTranslator.h b/gfx/2d/InlineTranslator.h index 4c8d45a273580..5fa814805b782 100644 --- a/gfx/2d/InlineTranslator.h +++ b/gfx/2d/InlineTranslator.h @@ -704,36 +704,26 @@ aScaledFontResouce void RemoveDrawTarget ( -ReferencePtr -aRefPtr ) override { -ReferencePtr -currentDT -= -mCurrentDT -; if ( -currentDT -= -= -aRefPtr +mCurrentDT ) { -mCurrentDT -= -nullptr -; -} mDrawTargets . Remove ( -aRefPtr +mCurrentDT ) ; +mCurrentDT += +nullptr +; +} } bool SetCurrentDrawTarget @@ -793,17 +783,48 @@ aRefPtr void RemoveFilterNode ( -ReferencePtr -aRefPtr ) final { +if +( +mCurrentFilter +) +{ mFilterNodes . Remove ( +mCurrentFilter +) +; +mCurrentFilter += +nullptr +; +} +} +bool +SetCurrentFilterNode +( +ReferencePtr aRefPtr ) +override +{ +mCurrentFilter += +mFilterNodes +. +GetWeak +( +aRefPtr +) +; +return +! +! +mCurrentFilter ; } void diff --git a/gfx/2d/RecordedEvent.cpp b/gfx/2d/RecordedEvent.cpp index 9dc6f6485c245..71d3872965ccb 100644 --- a/gfx/2d/RecordedEvent.cpp +++ b/gfx/2d/RecordedEvent.cpp @@ -302,6 +302,14 @@ Destruction " ; case +SETCURRENTDRAWTARGET +: +return +" +SetCurrentDrawTarget +" +; +case FILLRECT : return @@ -502,6 +510,14 @@ FilterNodeDestruction " ; case +SETCURRENTFILTERNODE +: +return +" +SetCurrentFilterNode +" +; +case GRADIENTSTOPSCREATION : return diff --git a/gfx/2d/RecordedEvent.h b/gfx/2d/RecordedEvent.h index 708481d095d2f..27f4b71c2cf91 100644 --- a/gfx/2d/RecordedEvent.h +++ b/gfx/2d/RecordedEvent.h @@ -706,8 +706,6 @@ virtual void RemoveDrawTarget ( -ReferencePtr -aRefPtr ) = 0 @@ -791,12 +789,14 @@ virtual void RemoveFilterNode ( -mozilla -: -: -gfx -: -: +) += +0 +; +virtual +bool +SetCurrentFilterNode +( ReferencePtr aRefPtr ) @@ -1039,6 +1039,17 @@ return mCurrentDT ; } +FilterNode +* +GetCurrentFilterNode +( +) +const +{ +return +mCurrentFilter +; +} nsRefPtrHashtable < nsUint64HashKey @@ -1055,6 +1066,12 @@ mCurrentDT = nullptr ; +FilterNode +* +mCurrentFilter += +nullptr +; } ; struct @@ -2149,6 +2166,7 @@ SCALEDFONTDESTRUCTION MASKSURFACE FILTERNODECREATION FILTERNODEDESTRUCTION +SETCURRENTFILTERNODE DRAWFILTER FILTERNODESETATTRIBUTE FILTERNODESETINPUT diff --git a/gfx/2d/RecordedEventImpl.h b/gfx/2d/RecordedEventImpl.h index aed84ce6fecd6..a8f02e5991779 100644 --- a/gfx/2d/RecordedEventImpl.h +++ b/gfx/2d/RecordedEventImpl.h @@ -356,28 +356,15 @@ RecordedDrawTargetDestruction { public : -MOZ_IMPLICIT +explicit RecordedDrawTargetDestruction ( -ReferencePtr -aRefPtr ) : RecordedEventDerived ( DRAWTARGETDESTRUCTION ) -mRefPtr -( -aRefPtr -) -mBackendType -( -BackendType -: -: -NONE -) { } bool @@ -437,9 +424,6 @@ Destruction ReferencePtr mRefPtr ; -BackendType -mBackendType -; private : friend @@ -472,7 +456,7 @@ RecordedSetCurrentDrawTarget { public : -MOZ_IMPLICIT +explicit RecordedSetCurrentDrawTarget ( ReferencePtr @@ -4338,8 +4322,6 @@ public : RecordedDrawFilter ( -ReferencePtr -aNode const Rect & @@ -4358,10 +4340,6 @@ RecordedEventDerived ( DRAWFILTER ) -mNode -( -aNode -) mSourceRect ( aSourceRect @@ -4448,9 +4426,6 @@ S aStream ) ; -ReferencePtr -mNode -; Rect mSourceRect ; @@ -5315,16 +5290,113 @@ RecordedFilterNodeDestruction { public : +explicit +RecordedFilterNodeDestruction +( +) +: +RecordedEventDerived +( +FILTERNODEDESTRUCTION +) +{ +} +bool +PlayEvent +( +Translator +* +aTranslator +) +const +override +; +template +< +class +S +> +void +Record +( +S +& +aStream +) +const +; +void +OutputSimpleEventInfo +( +std +: +: +stringstream +& +aStringStream +) +const +override +; +std +: +: +string +GetName +( +) +const +override +{ +return +" +FilterNode +Destruction +" +; +} +private +: +friend +class +RecordedEvent +; +template +< +class +S +> MOZ_IMPLICIT RecordedFilterNodeDestruction ( +S +& +aStream +) +; +} +; +class +RecordedSetCurrentFilterNode +: +public +RecordedEventDerived +< +RecordedSetCurrentFilterNode +> +{ +public +: +explicit +RecordedSetCurrentFilterNode +( ReferencePtr aRefPtr ) : RecordedEventDerived ( -FILTERNODEDESTRUCTION +SETCURRENTFILTERNODE ) mRefPtr ( @@ -5381,27 +5453,26 @@ override { return " -FilterNode -Destruction +SetCurrentFilterNode " ; } +ReferencePtr +mRefPtr +; private : friend class RecordedEvent ; -ReferencePtr -mRefPtr -; template < class S > MOZ_IMPLICIT -RecordedFilterNodeDestruction +RecordedSetCurrentFilterNode ( S & @@ -7326,9 +7397,6 @@ T > RecordedFilterNodeSetAttribute ( -FilterNode -* -aNode uint32_t aIndex T @@ -7341,10 +7409,6 @@ RecordedEventDerived ( FILTERNODESETATTRIBUTE ) -mNode -( -aNode -) mIndex ( aIndex @@ -7383,9 +7447,6 @@ T } RecordedFilterNodeSetAttribute ( -FilterNode -* -aNode uint32_t aIndex const @@ -7400,10 +7461,6 @@ RecordedEventDerived ( FILTERNODESETATTRIBUTE ) -mNode -( -aNode -) mIndex ( aIndex @@ -7502,9 +7559,6 @@ friend class RecordedEvent ; -ReferencePtr -mNode -; uint32_t mIndex ; @@ -7548,9 +7602,6 @@ public : RecordedFilterNodeSetInput ( -FilterNode -* -aNode uint32_t aIndex FilterNode @@ -7562,10 +7613,6 @@ RecordedEventDerived ( FILTERNODESETINPUT ) -mNode -( -aNode -) mIndex ( aIndex @@ -7582,9 +7629,6 @@ nullptr } RecordedFilterNodeSetInput ( -FilterNode -* -aNode uint32_t aIndex SourceSurface @@ -7596,10 +7640,6 @@ RecordedEventDerived ( FILTERNODESETINPUT ) -mNode -( -aNode -) mIndex ( aIndex @@ -7673,9 +7713,6 @@ friend class RecordedEvent ; -ReferencePtr -mNode -; uint32_t mIndex ; @@ -9892,6 +9929,14 @@ dataRect ) ; } +aTranslator +- +> +SetCurrentDrawTarget +( +mRefPtr +) +; return true ; @@ -10325,7 +10370,6 @@ aTranslator > RemoveDrawTarget ( -mRefPtr ) ; return @@ -10349,12 +10393,6 @@ aStream ) const { -WriteElement -( -aStream -mRefPtr -) -; } template < @@ -10376,12 +10414,6 @@ RecordedEventDerived DRAWTARGETDESTRUCTION ) { -ReadElement -( -aStream -mRefPtr -) -; } inline void @@ -10623,6 +10655,14 @@ mRefPtr newDT ) ; +aTranslator +- +> +SetCurrentDrawTarget +( +mRefPtr +) +; return true ; @@ -11240,6 +11280,14 @@ mRefPtr newDT ) ; +aTranslator +- +> +SetCurrentDrawTarget +( +mRefPtr +) +; return true ; @@ -11343,6 +11391,14 @@ mRefPtr newDT ) ; +aTranslator +- +> +SetCurrentDrawTarget +( +mRefPtr +) +; return true ; @@ -16284,9 +16340,8 @@ filter aTranslator - > -LookupFilterNode +GetCurrentFilterNode ( -mNode ) ; if @@ -16334,12 +16389,6 @@ const WriteElement ( aStream -mNode -) -; -WriteElement -( -aStream mSourceRect ) ; @@ -16379,12 +16428,6 @@ DRAWFILTER ReadElement ( aStream -mNode -) -; -ReadElement -( -aStream mSourceRect ) ; @@ -16422,15 +16465,6 @@ aStringStream < " DrawFilter -( -" -< -< -mNode -< -< -" -) " ; } @@ -18347,6 +18381,14 @@ mRefPtr node ) ; +aTranslator +- +> +SetCurrentFilterNode +( +mRefPtr +) +; return true ; @@ -18489,7 +18531,6 @@ aTranslator > RemoveFilterNode ( -mRefPtr ) ; return @@ -18513,6 +18554,93 @@ aStream ) const { +} +template +< +class +S +> +RecordedFilterNodeDestruction +: +: +RecordedFilterNodeDestruction +( +S +& +aStream +) +: +RecordedEventDerived +( +FILTERNODEDESTRUCTION +) +{ +} +inline +void +RecordedFilterNodeDestruction +: +: +OutputSimpleEventInfo +( +std +: +: +stringstream +& +aStringStream +) +const +{ +aStringStream +< +< +" +FilterNode +Destroyed +" +; +} +inline +bool +RecordedSetCurrentFilterNode +: +: +PlayEvent +( +Translator +* +aTranslator +) +const +{ +return +aTranslator +- +> +SetCurrentFilterNode +( +mRefPtr +) +; +} +template +< +class +S +> +void +RecordedSetCurrentFilterNode +: +: +Record +( +S +& +aStream +) +const +{ WriteElement ( aStream @@ -18525,10 +18653,10 @@ template class S > -RecordedFilterNodeDestruction +RecordedSetCurrentFilterNode : : -RecordedFilterNodeDestruction +RecordedSetCurrentFilterNode ( S & @@ -18537,7 +18665,7 @@ aStream : RecordedEventDerived ( -FILTERNODEDESTRUCTION +SETCURRENTFILTERNODE ) { ReadElement @@ -18549,7 +18677,7 @@ mRefPtr } inline void -RecordedFilterNodeDestruction +RecordedSetCurrentFilterNode : : OutputSimpleEventInfo @@ -18576,8 +18704,7 @@ mRefPtr < " ] -FilterNode -Destroyed +SetCurrentFilterNode " ; } @@ -21696,9 +21823,8 @@ node aTranslator - > -LookupFilterNode +GetCurrentFilterNode ( -mNode ) ; if @@ -21890,12 +22016,6 @@ const WriteElement ( aStream -mNode -) -; -WriteElement -( -aStream mIndex ) ; @@ -21964,12 +22084,6 @@ FILTERNODESETATTRIBUTE ReadElement ( aStream -mNode -) -; -ReadElement -( -aStream mIndex ) ; @@ -22057,15 +22171,6 @@ aStringStream < < " -[ -" -< -< -mNode -< -< -" -] SetAttribute ( " @@ -22099,9 +22204,8 @@ node aTranslator - > -LookupFilterNode +GetCurrentFilterNode ( -mNode ) ; if @@ -22177,12 +22281,6 @@ const WriteElement ( aStream -mNode -) -; -WriteElement -( -aStream mIndex ) ; @@ -22222,12 +22320,6 @@ FILTERNODESETINPUT ReadElement ( aStream -mNode -) -; -ReadElement -( -aStream mIndex ) ; @@ -22264,15 +22356,6 @@ aStringStream < < " -[ -" -< -< -mNode -< -< -" -] SetAttribute ( " @@ -22989,6 +23072,13 @@ RecordedFilterNodeDestruction \ f ( +SETCURRENTFILTERNODE +RecordedSetCurrentFilterNode +) +; +\ +f +( GRADIENTSTOPSCREATION RecordedGradientStopsCreation ) diff --git a/gfx/layers/RecordedCanvasEventImpl.h b/gfx/layers/RecordedCanvasEventImpl.h index 8ab6676289bc5..9c18d8f5a9f33 100644 --- a/gfx/layers/RecordedCanvasEventImpl.h +++ b/gfx/layers/RecordedCanvasEventImpl.h @@ -2703,6 +2703,20 @@ mSize mFormat ) ; +if +( +newDT +) +{ +aTranslator +- +> +SetCurrentDrawTarget +( +mRefPtr +) +; +} / / If diff --git a/layout/printing/PrintTranslator.h b/layout/printing/PrintTranslator.h index 5d1988e2c1966..b6c553c938e70 100644 --- a/layout/printing/PrintTranslator.h +++ b/layout/printing/PrintTranslator.h @@ -675,36 +675,26 @@ aScaledFontResouce void RemoveDrawTarget ( -ReferencePtr -aRefPtr ) final { -ReferencePtr -currentDT -= -mCurrentDT -; if ( -currentDT -= -= -aRefPtr +mCurrentDT ) { -mCurrentDT -= -nullptr -; -} mDrawTargets . Remove ( -aRefPtr +mCurrentDT ) ; +mCurrentDT += +nullptr +; +} } bool SetCurrentDrawTarget @@ -764,18 +754,49 @@ aRefPtr void RemoveFilterNode ( +) +final +{ +if +( +mCurrentFilter +) +{ +mFilterNodes +. +Remove +( +mCurrentFilter +) +; +mCurrentFilter += +nullptr +; +} +} +bool +SetCurrentFilterNode +( ReferencePtr aRefPtr ) final { +mCurrentFilter += mFilterNodes . -Remove +GetWeak ( aRefPtr ) ; +return +! +! +mCurrentFilter +; } void RemoveGradientStops