mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Bug 781380 - Fix cairo surface memory leak in DrawTargetCairo::CreateSimilarDrawTarget(). r=roc
This commit is contained in:
parent
5fd5fe5bbc
commit
f43050747b
@ -810,17 +810,23 @@ DrawTargetCairo::CreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFo
|
||||
}
|
||||
|
||||
bool
|
||||
DrawTargetCairo::Init(cairo_surface_t* aSurface, const IntSize& aSize)
|
||||
DrawTargetCairo::InitAlreadyReferenced(cairo_surface_t* aSurface, const IntSize& aSize)
|
||||
{
|
||||
mContext = cairo_create(aSurface);
|
||||
mSurface = aSurface;
|
||||
cairo_surface_reference(mSurface);
|
||||
mSize = aSize;
|
||||
mFormat = CairoContentToGfxFormat(cairo_surface_get_content(aSurface));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
DrawTargetCairo::Init(cairo_surface_t* aSurface, const IntSize& aSize)
|
||||
{
|
||||
cairo_surface_reference(aSurface);
|
||||
return InitAlreadyReferenced(aSurface, aSize);
|
||||
}
|
||||
|
||||
void *
|
||||
DrawTargetCairo::GetNativeSurface(NativeSurfaceType aType)
|
||||
{
|
||||
|
@ -135,6 +135,9 @@ public:
|
||||
void PrepareForDrawing(cairo_t* aContext, const Path* aPath = nullptr);
|
||||
|
||||
private: // methods
|
||||
// Init cairo surface without doing a cairo_surface_reference() call.
|
||||
bool InitAlreadyReferenced(cairo_surface_t* aSurface, const IntSize& aSize);
|
||||
|
||||
enum DrawPatternType { DRAW_FILL, DRAW_STROKE };
|
||||
void DrawPattern(const Pattern& aPattern,
|
||||
const StrokeOptions& aStrokeOptions,
|
||||
|
Loading…
Reference in New Issue
Block a user