mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 929350 - Allow the context for gfxContextMatrixAutoSaveRestore to be set lazily. r=mattwoodrow
This commit is contained in:
parent
7f64f7b53b
commit
e744bbf378
@ -900,6 +900,11 @@ private:
|
||||
class gfxContextMatrixAutoSaveRestore
|
||||
{
|
||||
public:
|
||||
gfxContextMatrixAutoSaveRestore() :
|
||||
mContext(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
gfxContextMatrixAutoSaveRestore(gfxContext *aContext) :
|
||||
mContext(aContext), mMatrix(aContext->CurrentMatrix())
|
||||
{
|
||||
@ -907,11 +912,28 @@ public:
|
||||
|
||||
~gfxContextMatrixAutoSaveRestore()
|
||||
{
|
||||
mContext->SetMatrix(mMatrix);
|
||||
if (mContext) {
|
||||
mContext->SetMatrix(mMatrix);
|
||||
}
|
||||
}
|
||||
|
||||
void SetContext(gfxContext *aContext)
|
||||
{
|
||||
NS_ASSERTION(!mContext, "Not going to restore the matrix on some context!");
|
||||
mContext = aContext;
|
||||
mMatrix = aContext->CurrentMatrix();
|
||||
}
|
||||
|
||||
void Restore()
|
||||
{
|
||||
if (mContext) {
|
||||
mContext->SetMatrix(mMatrix);
|
||||
}
|
||||
}
|
||||
|
||||
const gfxMatrix& Matrix()
|
||||
{
|
||||
MOZ_ASSERT(mContext, "mMatrix doesn't contain a useful matrix");
|
||||
return mMatrix;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user