Bug 1082553 - Remove gfxContext::OriginalSurface. r=Bas
--- a/gfx/thebes/gfxContext.cpp
+++ b/gfx/thebes/gfxContext.cpp
@@ -83,17 +83,16 @@ private:
gfxContext *mContext;
Pattern *mPattern;
};
gfxContext::gfxContext(DrawTarget *aTarget, const Point& aDeviceOffset)
: mPathIsRect(false)
, mTransformChanged(false)
, mRefCairo(nullptr)
- , mSurface(nullptr)
, mFlags(0)
, mDT(aTarget)
, mOriginalDT(aTarget)
{
MOZ_ASSERT(aTarget, "Don't create a gfxContext without a DrawTarget");
MOZ_COUNT_CTOR(gfxContext);
@@ -125,34 +124,16 @@ gfxContext::~gfxContext()
if (mStateStack[i].clipWasReset) {
break;
}
}
mDT->Flush();
MOZ_COUNT_DTOR(gfxContext);
}
-gfxASurface *
-gfxContext::OriginalSurface()
-{
- if (mSurface) {
- return mSurface;
- }
-
- if (mOriginalDT && mOriginalDT->GetBackendType() == BackendType::CAIRO) {
- cairo_surface_t *s =
- (cairo_surface_t*)mOriginalDT->GetNativeSurface(NativeSurfaceType::CAIRO_SURFACE);
- if (s) {
- mSurface = gfxASurface::Wrap(s);
- return mSurface;
- }
- }
- return nullptr;
-}
-
already_AddRefed<gfxASurface>
gfxContext::CurrentSurface(gfxFloat *dx, gfxFloat *dy)
{
if (mDT->GetBackendType() == BackendType::CAIRO) {
cairo_surface_t *s =
(cairo_surface_t*)mDT->GetNativeSurface(NativeSurfaceType::CAIRO_SURFACE);
if (s) {
if (dx && dy) {
--- a/gfx/thebes/gfxContext.h
+++ b/gfx/thebes/gfxContext.h
@@ -56,21 +56,16 @@ public:
/**
* Create a new gfxContext wrapping aTarget and preserving aTarget's
* transform. Note that the transform is moved from aTarget to the resulting
* gfxContext, aTarget will no longer have its transform.
*/
static already_AddRefed<gfxContext> ContextForDrawTarget(mozilla::gfx::DrawTarget* aTarget);
/**
- * Return the surface that this gfxContext was created with
- */
- gfxASurface *OriginalSurface();
-
- /**
* Return the current transparency group target, if any, along
* with its device offsets from the top. If no group is
* active, returns the surface the gfxContext was created with,
* and 0,0 in dx,dy.
*/
already_AddRefed<gfxASurface> CurrentSurface(gfxFloat *dx, gfxFloat *dy);
already_AddRefed<gfxASurface> CurrentSurface() {
return CurrentSurface(nullptr, nullptr);
@@ -703,17 +698,16 @@ private:
mozilla::RefPtr<Path> mPath;
Matrix mTransform;
nsTArray<AzureState> mStateStack;
AzureState &CurrentState() { return mStateStack[mStateStack.Length() - 1]; }
const AzureState &CurrentState() const { return mStateStack[mStateStack.Length() - 1]; }
cairo_t *mRefCairo;
- nsRefPtr<gfxASurface> mSurface;
int32_t mFlags;
mozilla::RefPtr<DrawTarget> mDT;
mozilla::RefPtr<DrawTarget> mOriginalDT;
};
/**
* Sentry helper class for functions with multiple return points that need to
@@ -877,22 +871,19 @@ public:
if (aDisable) {
mDT = aContext->GetDrawTarget();
mSubpixelAntialiasingEnabled = mDT->GetPermitSubpixelAA();
mDT->SetPermitSubpixelAA(false);
}
}
~gfxContextAutoDisableSubpixelAntialiasing()
{
- if (mSurface) {
- mSurface->SetSubpixelAntialiasingEnabled(mSubpixelAntialiasingEnabled);
- } else if (mDT) {
+ if (mDT) {
mDT->SetPermitSubpixelAA(mSubpixelAntialiasingEnabled);
}
}
private:
- nsRefPtr<gfxASurface> mSurface;
mozilla::RefPtr<mozilla::gfx::DrawTarget> mDT;
bool mSubpixelAntialiasingEnabled;
};
#endif /* GFX_CONTEXT_H */