Bug 1917156 - Implement RemoveAllClips for DrawTargetRecording. r=aosmond
CanvasRenderingContext2D depends on RemoveAllClips for efficient resetting, but DrawTargetRecording did not implement this, causing fast resets to fail. Differential Revision: https://phabricator.services.mozilla.com/D221285
This commit is contained in:
@@ -640,6 +640,11 @@ void DrawTargetRecording::PopClip() {
|
|||||||
RecordEventSelfSkipFlushTransform(RecordedPopClip());
|
RecordEventSelfSkipFlushTransform(RecordedPopClip());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DrawTargetRecording::RemoveAllClips() {
|
||||||
|
RecordEventSelfSkipFlushTransform(RecordedRemoveAllClips());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void DrawTargetRecording::PushLayer(bool aOpaque, Float aOpacity,
|
void DrawTargetRecording::PushLayer(bool aOpaque, Float aOpacity,
|
||||||
SourceSurface* aMask,
|
SourceSurface* aMask,
|
||||||
const Matrix& aMaskTransform,
|
const Matrix& aMaskTransform,
|
||||||
|
|||||||
@@ -223,6 +223,9 @@ class DrawTargetRecording final : public DrawTarget {
|
|||||||
*/
|
*/
|
||||||
virtual void PopClip() override;
|
virtual void PopClip() override;
|
||||||
|
|
||||||
|
/* Remove all applied clips. */
|
||||||
|
virtual bool RemoveAllClips() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Push a 'layer' to the DrawTarget, a layer is a temporary surface that all
|
* Push a 'layer' to the DrawTarget, a layer is a temporary surface that all
|
||||||
* drawing will be redirected to, this is used for example to support group
|
* drawing will be redirected to, this is used for example to support group
|
||||||
|
|||||||
@@ -58,6 +58,8 @@ std::string RecordedEvent::GetEventName(EventType aType) {
|
|||||||
return "PushClipRect";
|
return "PushClipRect";
|
||||||
case POPCLIP:
|
case POPCLIP:
|
||||||
return "PopClip";
|
return "PopClip";
|
||||||
|
case REMOVEALLCLIPS:
|
||||||
|
return "RemoveAllClips";
|
||||||
case FILL:
|
case FILL:
|
||||||
return "Fill";
|
return "Fill";
|
||||||
case FILLGLYPHS:
|
case FILLGLYPHS:
|
||||||
|
|||||||
@@ -388,6 +388,7 @@ class RecordedEvent {
|
|||||||
PUSHCLIP,
|
PUSHCLIP,
|
||||||
PUSHCLIPRECT,
|
PUSHCLIPRECT,
|
||||||
POPCLIP,
|
POPCLIP,
|
||||||
|
REMOVEALLCLIPS,
|
||||||
FILL,
|
FILL,
|
||||||
FILLCIRCLE,
|
FILLCIRCLE,
|
||||||
FILLGLYPHS,
|
FILLGLYPHS,
|
||||||
|
|||||||
@@ -681,6 +681,27 @@ class RecordedPopClip : public RecordedEventDerived<RecordedPopClip> {
|
|||||||
MOZ_IMPLICIT RecordedPopClip(S& aStream);
|
MOZ_IMPLICIT RecordedPopClip(S& aStream);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class RecordedRemoveAllClips
|
||||||
|
: public RecordedEventDerived<RecordedRemoveAllClips> {
|
||||||
|
public:
|
||||||
|
MOZ_IMPLICIT RecordedRemoveAllClips()
|
||||||
|
: RecordedEventDerived(REMOVEALLCLIPS) {}
|
||||||
|
|
||||||
|
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 "RemoveAllClips"; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
friend class RecordedEvent;
|
||||||
|
|
||||||
|
template <class S>
|
||||||
|
MOZ_IMPLICIT RecordedRemoveAllClips(S& aStream);
|
||||||
|
};
|
||||||
|
|
||||||
class RecordedPushLayer : public RecordedEventDerived<RecordedPushLayer> {
|
class RecordedPushLayer : public RecordedEventDerived<RecordedPushLayer> {
|
||||||
public:
|
public:
|
||||||
RecordedPushLayer(bool aOpaque, Float aOpacity, SourceSurface* aMask,
|
RecordedPushLayer(bool aOpaque, Float aOpacity, SourceSurface* aMask,
|
||||||
@@ -2973,6 +2994,28 @@ inline void RecordedPopClip::OutputSimpleEventInfo(
|
|||||||
aStringStream << "PopClip";
|
aStringStream << "PopClip";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool RecordedRemoveAllClips::PlayEvent(Translator* aTranslator) const {
|
||||||
|
DrawTarget* dt = aTranslator->GetCurrentDrawTarget();
|
||||||
|
if (!dt) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
dt->RemoveAllClips();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class S>
|
||||||
|
void RecordedRemoveAllClips::Record(S& aStream) const {}
|
||||||
|
|
||||||
|
template <class S>
|
||||||
|
RecordedRemoveAllClips::RecordedRemoveAllClips(S& aStream)
|
||||||
|
: RecordedEventDerived(REMOVEALLCLIPS) {}
|
||||||
|
|
||||||
|
inline void RecordedRemoveAllClips::OutputSimpleEventInfo(
|
||||||
|
std::stringstream& aStringStream) const {
|
||||||
|
aStringStream << "RemoveAllClips";
|
||||||
|
}
|
||||||
|
|
||||||
inline bool RecordedPushLayer::PlayEvent(Translator* aTranslator) const {
|
inline bool RecordedPushLayer::PlayEvent(Translator* aTranslator) const {
|
||||||
DrawTarget* dt = aTranslator->GetCurrentDrawTarget();
|
DrawTarget* dt = aTranslator->GetCurrentDrawTarget();
|
||||||
if (!dt) {
|
if (!dt) {
|
||||||
@@ -4474,6 +4517,7 @@ inline void RecordedDestination::OutputSimpleEventInfo(
|
|||||||
f(PUSHCLIPRECT, RecordedPushClipRect); \
|
f(PUSHCLIPRECT, RecordedPushClipRect); \
|
||||||
f(PUSHCLIP, RecordedPushClip); \
|
f(PUSHCLIP, RecordedPushClip); \
|
||||||
f(POPCLIP, RecordedPopClip); \
|
f(POPCLIP, RecordedPopClip); \
|
||||||
|
f(REMOVEALLCLIPS, RecordedRemoveAllClips); \
|
||||||
f(FILL, RecordedFill); \
|
f(FILL, RecordedFill); \
|
||||||
f(FILLCIRCLE, RecordedFillCircle); \
|
f(FILLCIRCLE, RecordedFillCircle); \
|
||||||
f(FILLGLYPHS, RecordedFillGlyphs); \
|
f(FILLGLYPHS, RecordedFillGlyphs); \
|
||||||
|
|||||||
Reference in New Issue
Block a user