diff --git a/gfx/thebes/gfxPattern.cpp b/gfx/thebes/gfxPattern.cpp index 5074a783c1b6..c1b3be319e1d 100644 --- a/gfx/thebes/gfxPattern.cpp +++ b/gfx/thebes/gfxPattern.cpp @@ -98,7 +98,7 @@ gfxPattern::AddColorStop(gfxFloat offset, const gfxRGBA& c) } void -gfxPattern::SetColorStops(GradientStops* aStops) +gfxPattern::SetColorStops(mozilla::RefPtr aStops) { mStops = aStops; } diff --git a/gfx/thebes/gfxPattern.h b/gfx/thebes/gfxPattern.h index 1f69574695ee..23b2a803b225 100644 --- a/gfx/thebes/gfxPattern.h +++ b/gfx/thebes/gfxPattern.h @@ -38,7 +38,7 @@ public: cairo_pattern_t *CairoPattern(); void AddColorStop(gfxFloat offset, const gfxRGBA& c); - void SetColorStops(mozilla::gfx::GradientStops* aStops); + void SetColorStops(mozilla::RefPtr aStops); // This should only be called on a cairo pattern that we want to use with // Azure. We will read back the color stops from cairo and try to look diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp index 1da548538122..8f8f25944b51 100644 --- a/gfx/thebes/gfxPlatform.cpp +++ b/gfx/thebes/gfxPlatform.cpp @@ -534,19 +534,19 @@ gfxPlatform::~gfxPlatform() cairo_user_data_key_t kDrawTarget; -TemporaryRef +RefPtr gfxPlatform::CreateDrawTargetForSurface(gfxASurface *aSurface, const IntSize& aSize) { SurfaceFormat format = Optimal2DFormatForContent(aSurface->GetContentType()); RefPtr drawTarget = Factory::CreateDrawTargetForCairoSurface(aSurface->CairoSurface(), aSize, &format); aSurface->SetData(&kDrawTarget, drawTarget, nullptr); - return drawTarget.forget(); + return drawTarget; } // This is a temporary function used by ContentClient to build a DrawTarget // around the gfxASurface. This should eventually be replaced by plumbing // the DrawTarget through directly -TemporaryRef +RefPtr gfxPlatform::CreateDrawTargetForUpdateSurface(gfxASurface *aSurface, const IntSize& aSize) { #ifdef XP_MACOSX @@ -643,7 +643,7 @@ CopySurface(gfxASurface* aSurface) return data; } -/* static */ TemporaryRef +/* static */ RefPtr gfxPlatform::GetSourceSurfaceForSurface(DrawTarget *aTarget, gfxASurface *aSurface) { if (!aSurface->CairoSurface() || aSurface->CairoStatus()) { @@ -709,7 +709,7 @@ gfxPlatform::GetSourceSurfaceForSurface(DrawTarget *aTarget, gfxASurface *aSurfa if (srcBuffer) { // It's cheap enough to make a new one so we won't keep it around and // keeping it creates a cycle. - return srcBuffer.forget(); + return srcBuffer; } } @@ -734,7 +734,7 @@ gfxPlatform::GetSourceSurfaceForSurface(DrawTarget *aTarget, gfxASurface *aSurfa // Our wrapping surface will hold a reference to its image surface. We cause // a reference cycle if we add it to the cache. And caching it is pretty // pointless since we'll just wrap it again next use. - return srcBuffer.forget(); + return srcBuffer; } } @@ -744,10 +744,10 @@ gfxPlatform::GetSourceSurfaceForSurface(DrawTarget *aTarget, gfxASurface *aSurfa srcSurfUD->mSrcSurface = srcBuffer; aSurface->SetData(&kSourceSurface, srcSurfUD, SourceBufferDestroy); - return srcBuffer.forget(); + return srcBuffer; } -TemporaryRef +RefPtr gfxPlatform::GetWrappedDataSourceSurface(gfxASurface* aSurface) { nsRefPtr image = aSurface->GetAsImageSurface(); @@ -770,7 +770,7 @@ gfxPlatform::GetWrappedDataSourceSurface(gfxASurface* aSurface) srcSurfUD->mSurface = aSurface; result->AddUserData(&kThebesSurface, srcSurfUD, SourceSurfaceDestroyed); - return result.forget(); + return result; } TemporaryRef @@ -927,7 +927,7 @@ gfxPlatform::GetThebesSurfaceForDrawTarget(DrawTarget *aTarget) return surf.forget(); } -TemporaryRef +RefPtr gfxPlatform::CreateDrawTargetForBackend(BackendType aBackend, const IntSize& aSize, SurfaceFormat aFormat) { // There is a bunch of knowledge in the gfxPlatform heirarchy about how to @@ -951,27 +951,27 @@ gfxPlatform::CreateDrawTargetForBackend(BackendType aBackend, const IntSize& aSi } } -TemporaryRef +RefPtr gfxPlatform::CreateOffscreenCanvasDrawTarget(const IntSize& aSize, SurfaceFormat aFormat) { NS_ASSERTION(mPreferredCanvasBackend != BackendType::NONE, "No backend."); RefPtr target = CreateDrawTargetForBackend(mPreferredCanvasBackend, aSize, aFormat); if (target || mFallbackCanvasBackend == BackendType::NONE) { - return target.forget(); + return target; } return CreateDrawTargetForBackend(mFallbackCanvasBackend, aSize, aFormat); } -TemporaryRef +RefPtr gfxPlatform::CreateOffscreenContentDrawTarget(const IntSize& aSize, SurfaceFormat aFormat) { NS_ASSERTION(mPreferredCanvasBackend != BackendType::NONE, "No backend."); return CreateDrawTargetForBackend(mContentBackend, aSize, aFormat); } -TemporaryRef +RefPtr gfxPlatform::CreateDrawTargetForData(unsigned char* aData, const IntSize& aSize, int32_t aStride, SurfaceFormat aFormat) { NS_ASSERTION(mContentBackend != BackendType::NONE, "No backend."); diff --git a/gfx/thebes/gfxPlatform.h b/gfx/thebes/gfxPlatform.h index 62abdbcbbfef..24e38663fcf1 100644 --- a/gfx/thebes/gfxPlatform.h +++ b/gfx/thebes/gfxPlatform.h @@ -155,10 +155,7 @@ GetBackendName(mozilla::gfx::BackendType aBackend) class gfxPlatform { public: - typedef mozilla::gfx::DataSourceSurface DataSourceSurface; - typedef mozilla::gfx::DrawTarget DrawTarget; typedef mozilla::gfx::IntSize IntSize; - typedef mozilla::gfx::SourceSurface SourceSurface; /** * Return a pointer to the current active platform. @@ -190,10 +187,10 @@ public: * support the DrawTarget we get back. * See SupportsAzureContentForDrawTarget. */ - virtual mozilla::TemporaryRef + virtual mozilla::RefPtr CreateDrawTargetForSurface(gfxASurface *aSurface, const mozilla::gfx::IntSize& aSize); - virtual mozilla::TemporaryRef + virtual mozilla::RefPtr CreateDrawTargetForUpdateSurface(gfxASurface *aSurface, const mozilla::gfx::IntSize& aSize); /* @@ -208,12 +205,12 @@ public: * PluginInstanceChild (where we can't call gfxPlatform::GetPlatform() * because the prefs service can only be accessed from the main process). */ - static mozilla::TemporaryRef + static mozilla::RefPtr GetSourceSurfaceForSurface(mozilla::gfx::DrawTarget *aTarget, gfxASurface *aSurface); static void ClearSourceSurfaceForSurface(gfxASurface *aSurface); - static mozilla::TemporaryRef + static mozilla::RefPtr GetWrappedDataSourceSurface(gfxASurface *aSurface); virtual mozilla::TemporaryRef @@ -222,13 +219,13 @@ public: virtual already_AddRefed GetThebesSurfaceForDrawTarget(mozilla::gfx::DrawTarget *aTarget); - mozilla::TemporaryRef + mozilla::RefPtr CreateOffscreenContentDrawTarget(const mozilla::gfx::IntSize& aSize, mozilla::gfx::SurfaceFormat aFormat); - mozilla::TemporaryRef + mozilla::RefPtr CreateOffscreenCanvasDrawTarget(const mozilla::gfx::IntSize& aSize, mozilla::gfx::SurfaceFormat aFormat); - virtual mozilla::TemporaryRef + virtual mozilla::RefPtr CreateDrawTargetForData(unsigned char* aData, const mozilla::gfx::IntSize& aSize, int32_t aStride, mozilla::gfx::SurfaceFormat aFormat); @@ -560,7 +557,7 @@ protected: * Helper method, creates a draw target for a specific Azure backend. * Used by CreateOffscreenDrawTarget. */ - mozilla::TemporaryRef + mozilla::RefPtr CreateDrawTargetForBackend(mozilla::gfx::BackendType aBackend, const mozilla::gfx::IntSize& aSize, mozilla::gfx::SurfaceFormat aFormat); diff --git a/gfx/thebes/gfxUtils.cpp b/gfx/thebes/gfxUtils.cpp index 9f99493e9f56..fc781718fbec 100644 --- a/gfx/thebes/gfxUtils.cpp +++ b/gfx/thebes/gfxUtils.cpp @@ -965,7 +965,7 @@ gfxUtils::CopyAsDataURL(DrawTarget* aDT) } /* static */ void -gfxUtils::WriteAsPNG(gfx::SourceSurface* aSourceSurface, const char* aFile) +gfxUtils::WriteAsPNG(RefPtr aSourceSurface, const char* aFile) { RefPtr dataSurface = aSourceSurface->GetDataSurface(); RefPtr dt @@ -978,7 +978,7 @@ gfxUtils::WriteAsPNG(gfx::SourceSurface* aSourceSurface, const char* aFile) } /* static */ void -gfxUtils::DumpAsDataURL(gfx::SourceSurface* aSourceSurface) +gfxUtils::DumpAsDataURL(RefPtr aSourceSurface) { RefPtr dataSurface = aSourceSurface->GetDataSurface(); RefPtr dt @@ -991,7 +991,7 @@ gfxUtils::DumpAsDataURL(gfx::SourceSurface* aSourceSurface) } /* static */ void -gfxUtils::CopyAsDataURL(gfx::SourceSurface* aSourceSurface) +gfxUtils::CopyAsDataURL(RefPtr aSourceSurface) { RefPtr dataSurface = aSourceSurface->GetDataSurface(); RefPtr dt diff --git a/gfx/thebes/gfxUtils.h b/gfx/thebes/gfxUtils.h index bcbfb1cf8808..d807b05345cd 100644 --- a/gfx/thebes/gfxUtils.h +++ b/gfx/thebes/gfxUtils.h @@ -240,19 +240,19 @@ public: * Writes a binary PNG file. * Expensive. Creates a DataSourceSurface, then a DrawTarget, then passes to DrawTarget overloads */ - static void WriteAsPNG(mozilla::gfx::SourceSurface* aSourceSurface, const char* aFile); + static void WriteAsPNG(mozilla::RefPtr aSourceSurface, const char* aFile); /** * Write as a PNG encoded Data URL to stdout. * Expensive. Creates a DataSourceSurface, then a DrawTarget, then passes to DrawTarget overloads */ - static void DumpAsDataURL(mozilla::gfx::SourceSurface* aSourceSurface); + static void DumpAsDataURL(mozilla::RefPtr aSourceSurface); /** * Copy a PNG encoded Data URL to the clipboard. * Expensive. Creates a DataSourceSurface, then a DrawTarget, then passes to DrawTarget overloads */ - static void CopyAsDataURL(mozilla::gfx::SourceSurface* aSourceSurface); + static void CopyAsDataURL(mozilla::RefPtr aSourceSurface); #endif };