mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-02 14:30:43 +00:00
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:
parent
f5c6fa41dd
commit
9d82b3bbe9
@ -640,6 +640,11 @@ void DrawTargetRecording::PopClip() {
|
||||
RecordEventSelfSkipFlushTransform(RecordedPopClip());
|
||||
}
|
||||
|
||||
bool DrawTargetRecording::RemoveAllClips() {
|
||||
RecordEventSelfSkipFlushTransform(RecordedRemoveAllClips());
|
||||
return true;
|
||||
}
|
||||
|
||||
void DrawTargetRecording::PushLayer(bool aOpaque, Float aOpacity,
|
||||
SourceSurface* aMask,
|
||||
const Matrix& aMaskTransform,
|
||||
|
@ -223,6 +223,9 @@ class DrawTargetRecording final : public DrawTarget {
|
||||
*/
|
||||
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
|
||||
* 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";
|
||||
case POPCLIP:
|
||||
return "PopClip";
|
||||
case REMOVEALLCLIPS:
|
||||
return "RemoveAllClips";
|
||||
case FILL:
|
||||
return "Fill";
|
||||
case FILLGLYPHS:
|
||||
|
@ -388,6 +388,7 @@ class RecordedEvent {
|
||||
PUSHCLIP,
|
||||
PUSHCLIPRECT,
|
||||
POPCLIP,
|
||||
REMOVEALLCLIPS,
|
||||
FILL,
|
||||
FILLCIRCLE,
|
||||
FILLGLYPHS,
|
||||
|
@ -681,6 +681,27 @@ class RecordedPopClip : public RecordedEventDerived<RecordedPopClip> {
|
||||
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> {
|
||||
public:
|
||||
RecordedPushLayer(bool aOpaque, Float aOpacity, SourceSurface* aMask,
|
||||
@ -2973,6 +2994,28 @@ inline void RecordedPopClip::OutputSimpleEventInfo(
|
||||
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 {
|
||||
DrawTarget* dt = aTranslator->GetCurrentDrawTarget();
|
||||
if (!dt) {
|
||||
@ -4474,6 +4517,7 @@ inline void RecordedDestination::OutputSimpleEventInfo(
|
||||
f(PUSHCLIPRECT, RecordedPushClipRect); \
|
||||
f(PUSHCLIP, RecordedPushClip); \
|
||||
f(POPCLIP, RecordedPopClip); \
|
||||
f(REMOVEALLCLIPS, RecordedRemoveAllClips); \
|
||||
f(FILL, RecordedFill); \
|
||||
f(FILLCIRCLE, RecordedFillCircle); \
|
||||
f(FILLGLYPHS, RecordedFillGlyphs); \
|
||||
|
Loading…
x
Reference in New Issue
Block a user