Bug 764125; store a reference to the backing surface in DrawTargetCairo; r=Bas

This commit is contained in:
Nicholas Cameron 2012-07-24 22:18:38 +12:00
parent a49759020b
commit 07975bdcdb
3 changed files with 7 additions and 0 deletions

View File

@ -245,6 +245,9 @@ DrawTargetCairo::~DrawTargetCairo()
mPathObserver->ForgetDrawTarget();
}
cairo_destroy(mContext);
if (mSurface) {
cairo_surface_destroy(mSurface);
}
}
IntSize
@ -723,6 +726,8 @@ bool
DrawTargetCairo::Init(cairo_surface_t* aSurface, const IntSize& aSize)
{
mContext = cairo_create(aSurface);
mSurface = aSurface;
cairo_surface_reference(mSurface);
mSize = aSize;
return true;

View File

@ -157,6 +157,7 @@ private: // methods
private: // data
cairo_t* mContext;
cairo_surface_t* mSurface;
IntSize mSize;
std::vector<SourceSurfaceCairo*> mSnapshots;
mutable RefPtr<CairoPathContext> mPathObserver;

View File

@ -103,6 +103,7 @@ SourceSurfaceCairo::DrawTargetWillChange()
cairo_set_source(ctx, pat);
cairo_paint(ctx);
cairo_destroy(ctx);
cairo_pattern_destroy(pat);
// Swap in this new surface.
cairo_surface_destroy(mSurface);