Skip to content

Commit

Permalink
Bug 784573 - Fix problems converting cairo paths between user space a…
Browse files Browse the repository at this point in the history
…nd device space. r=joe
  • Loading branch information
Anthony Jones committed Sep 3, 2012
1 parent a362c2b commit 223dd80
Show file tree
Hide file tree
Showing 4 changed files with 121 additions and 184 deletions.
12 changes: 1 addition & 11 deletions gfx/2d/DrawTargetCairo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ NeedIntermediateSurface(const Pattern& aPattern, const DrawOptions& aOptions)

DrawTargetCairo::DrawTargetCairo()
: mContext(nullptr)
, mPathObserver(nullptr)
{
}

Expand Down Expand Up @@ -687,11 +688,6 @@ DrawTargetCairo::CreatePathBuilder(FillRule aFillRule /* = FILL_WINDING */) cons
const_cast<DrawTargetCairo*>(this),
aFillRule);

// Creating a PathBuilder implicitly resets our mPathObserver, as it calls
// SetPathObserver() on us. Since this guarantees our old path is saved off,
// it's safe to reset the path here.
cairo_new_path(mContext);

return builder;
}

Expand Down Expand Up @@ -921,12 +917,6 @@ DrawTargetCairo::SetPathObserver(CairoPathContext* aPathObserver)
void
DrawTargetCairo::SetTransform(const Matrix& aTransform)
{
// We're about to logically change our transformation. Our current path will
// need to change, because Cairo stores paths in device space.
if (mPathObserver) {
mPathObserver->MatrixWillChange(aTransform);
}

mTransform = aTransform;

cairo_matrix_t mat;
Expand Down
7 changes: 6 additions & 1 deletion gfx/2d/DrawTargetCairo.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,12 @@ class DrawTargetCairo : public DrawTarget
cairo_surface_t* mSurface;
IntSize mSize;
std::vector<SourceSurfaceCairo*> mSnapshots;
mutable RefPtr<CairoPathContext> mPathObserver;

// It is safe to use a regular pointer here because the CairoPathContext will
// deregister itself on destruction. Using a RefPtr would extend the life-
// span of the CairoPathContext. This causes a problem when
// PathBuilderCairo.Finish()
mutable CairoPathContext* mPathObserver;
};

}
Expand Down
Loading

0 comments on commit 223dd80

Please sign in to comment.