mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 764125; Fix a bug where a path with a transform is re-used. r=Bas
This commit is contained in:
parent
d157fedf81
commit
5aadfa70b7
@ -44,6 +44,28 @@ CairoPathContext::~CairoPathContext()
|
||||
cairo_destroy(mContext);
|
||||
}
|
||||
|
||||
void
|
||||
CairoPathContext::ObserveTarget(DrawTargetCairo* aDrawTarget)
|
||||
{
|
||||
if (!aDrawTarget) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mDrawTarget) {
|
||||
mDrawTarget->SetPathObserver(NULL);
|
||||
}
|
||||
mDrawTarget = aDrawTarget;
|
||||
|
||||
// If there is a transform on the path, then we must have a separate context
|
||||
// from the draw target, so we cannot be its observer
|
||||
if (!mTransform.IsIdentity()) {
|
||||
ForgetDrawTarget();
|
||||
return;
|
||||
}
|
||||
|
||||
mDrawTarget->SetPathObserver(this);
|
||||
}
|
||||
|
||||
void
|
||||
CairoPathContext::DuplicateContextAndPath(const Matrix& aMatrix /* = Matrix() */)
|
||||
{
|
||||
@ -320,11 +342,7 @@ PathCairo::CopyPathTo(cairo_t* aContext, DrawTargetCairo* aDrawTarget)
|
||||
|
||||
// Since aDrawTarget wants us to be the current path on its context, we
|
||||
// should also listen to it for updates to that path (as an optimization).
|
||||
// The easiest way to do this is to just recreate mPathContext, since it
|
||||
// registers with aDrawTarget for updates.
|
||||
mPathContext = new CairoPathContext(aContext, aDrawTarget,
|
||||
mPathContext->GetFillRule(),
|
||||
mPathContext->GetTransform());
|
||||
mPathContext->ObserveTarget(aDrawTarget);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -68,6 +68,10 @@ public:
|
||||
// Returns true if this CairoPathContext represents path.
|
||||
bool ContainsPath(const Path* path);
|
||||
|
||||
// add ourselves as an observer of aDrawTarget, if possible
|
||||
// if we succeed, then mDrawTarget is set to aDrawTarget
|
||||
void ObserveTarget(DrawTargetCairo* aDrawTarget);
|
||||
|
||||
cairo_t* GetContext() const { return mContext; }
|
||||
DrawTargetCairo* GetDrawTarget() const { return mDrawTarget; }
|
||||
Matrix GetTransform() const { return mTransform; }
|
||||
|
Loading…
Reference in New Issue
Block a user