mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1022821, part 2 - In gfx code, stop returning RefPtr and, where not an out-param, stop using RefPtr arguments. r=Cwiiis
This commit is contained in:
parent
0eebfebe6c
commit
49531a0e15
@ -98,7 +98,7 @@ gfxPattern::AddColorStop(gfxFloat offset, const gfxRGBA& c)
|
||||
}
|
||||
|
||||
void
|
||||
gfxPattern::SetColorStops(mozilla::RefPtr<GradientStops> aStops)
|
||||
gfxPattern::SetColorStops(GradientStops* aStops)
|
||||
{
|
||||
mStops = aStops;
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
|
||||
cairo_pattern_t *CairoPattern();
|
||||
void AddColorStop(gfxFloat offset, const gfxRGBA& c);
|
||||
void SetColorStops(mozilla::RefPtr<mozilla::gfx::GradientStops> aStops);
|
||||
void SetColorStops(mozilla::gfx::GradientStops* 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
|
||||
|
@ -534,19 +534,19 @@ gfxPlatform::~gfxPlatform()
|
||||
|
||||
cairo_user_data_key_t kDrawTarget;
|
||||
|
||||
RefPtr<DrawTarget>
|
||||
TemporaryRef<DrawTarget>
|
||||
gfxPlatform::CreateDrawTargetForSurface(gfxASurface *aSurface, const IntSize& aSize)
|
||||
{
|
||||
SurfaceFormat format = Optimal2DFormatForContent(aSurface->GetContentType());
|
||||
RefPtr<DrawTarget> drawTarget = Factory::CreateDrawTargetForCairoSurface(aSurface->CairoSurface(), aSize, &format);
|
||||
aSurface->SetData(&kDrawTarget, drawTarget, nullptr);
|
||||
return drawTarget;
|
||||
return drawTarget.forget();
|
||||
}
|
||||
|
||||
// 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
|
||||
RefPtr<DrawTarget>
|
||||
TemporaryRef<DrawTarget>
|
||||
gfxPlatform::CreateDrawTargetForUpdateSurface(gfxASurface *aSurface, const IntSize& aSize)
|
||||
{
|
||||
#ifdef XP_MACOSX
|
||||
@ -643,7 +643,7 @@ CopySurface(gfxASurface* aSurface)
|
||||
return data;
|
||||
}
|
||||
|
||||
/* static */ RefPtr<SourceSurface>
|
||||
/* static */ TemporaryRef<SourceSurface>
|
||||
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;
|
||||
return srcBuffer.forget();
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
return srcBuffer.forget();
|
||||
}
|
||||
}
|
||||
|
||||
@ -744,10 +744,10 @@ gfxPlatform::GetSourceSurfaceForSurface(DrawTarget *aTarget, gfxASurface *aSurfa
|
||||
srcSurfUD->mSrcSurface = srcBuffer;
|
||||
aSurface->SetData(&kSourceSurface, srcSurfUD, SourceBufferDestroy);
|
||||
|
||||
return srcBuffer;
|
||||
return srcBuffer.forget();
|
||||
}
|
||||
|
||||
RefPtr<DataSourceSurface>
|
||||
TemporaryRef<DataSourceSurface>
|
||||
gfxPlatform::GetWrappedDataSourceSurface(gfxASurface* aSurface)
|
||||
{
|
||||
nsRefPtr<gfxImageSurface> image = aSurface->GetAsImageSurface();
|
||||
@ -770,7 +770,7 @@ gfxPlatform::GetWrappedDataSourceSurface(gfxASurface* aSurface)
|
||||
srcSurfUD->mSurface = aSurface;
|
||||
result->AddUserData(&kThebesSurface, srcSurfUD, SourceSurfaceDestroyed);
|
||||
|
||||
return result;
|
||||
return result.forget();
|
||||
}
|
||||
|
||||
TemporaryRef<ScaledFont>
|
||||
@ -927,7 +927,7 @@ gfxPlatform::GetThebesSurfaceForDrawTarget(DrawTarget *aTarget)
|
||||
return surf.forget();
|
||||
}
|
||||
|
||||
RefPtr<DrawTarget>
|
||||
TemporaryRef<DrawTarget>
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
RefPtr<DrawTarget>
|
||||
TemporaryRef<DrawTarget>
|
||||
gfxPlatform::CreateOffscreenCanvasDrawTarget(const IntSize& aSize, SurfaceFormat aFormat)
|
||||
{
|
||||
NS_ASSERTION(mPreferredCanvasBackend != BackendType::NONE, "No backend.");
|
||||
RefPtr<DrawTarget> target = CreateDrawTargetForBackend(mPreferredCanvasBackend, aSize, aFormat);
|
||||
if (target ||
|
||||
mFallbackCanvasBackend == BackendType::NONE) {
|
||||
return target;
|
||||
return target.forget();
|
||||
}
|
||||
|
||||
return CreateDrawTargetForBackend(mFallbackCanvasBackend, aSize, aFormat);
|
||||
}
|
||||
|
||||
RefPtr<DrawTarget>
|
||||
TemporaryRef<DrawTarget>
|
||||
gfxPlatform::CreateOffscreenContentDrawTarget(const IntSize& aSize, SurfaceFormat aFormat)
|
||||
{
|
||||
NS_ASSERTION(mPreferredCanvasBackend != BackendType::NONE, "No backend.");
|
||||
return CreateDrawTargetForBackend(mContentBackend, aSize, aFormat);
|
||||
}
|
||||
|
||||
RefPtr<DrawTarget>
|
||||
TemporaryRef<DrawTarget>
|
||||
gfxPlatform::CreateDrawTargetForData(unsigned char* aData, const IntSize& aSize, int32_t aStride, SurfaceFormat aFormat)
|
||||
{
|
||||
NS_ASSERTION(mContentBackend != BackendType::NONE, "No backend.");
|
||||
|
@ -155,7 +155,10 @@ 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.
|
||||
@ -187,10 +190,10 @@ public:
|
||||
* support the DrawTarget we get back.
|
||||
* See SupportsAzureContentForDrawTarget.
|
||||
*/
|
||||
virtual mozilla::RefPtr<mozilla::gfx::DrawTarget>
|
||||
virtual mozilla::TemporaryRef<DrawTarget>
|
||||
CreateDrawTargetForSurface(gfxASurface *aSurface, const mozilla::gfx::IntSize& aSize);
|
||||
|
||||
virtual mozilla::RefPtr<mozilla::gfx::DrawTarget>
|
||||
virtual mozilla::TemporaryRef<DrawTarget>
|
||||
CreateDrawTargetForUpdateSurface(gfxASurface *aSurface, const mozilla::gfx::IntSize& aSize);
|
||||
|
||||
/*
|
||||
@ -205,12 +208,12 @@ public:
|
||||
* PluginInstanceChild (where we can't call gfxPlatform::GetPlatform()
|
||||
* because the prefs service can only be accessed from the main process).
|
||||
*/
|
||||
static mozilla::RefPtr<mozilla::gfx::SourceSurface>
|
||||
static mozilla::TemporaryRef<SourceSurface>
|
||||
GetSourceSurfaceForSurface(mozilla::gfx::DrawTarget *aTarget, gfxASurface *aSurface);
|
||||
|
||||
static void ClearSourceSurfaceForSurface(gfxASurface *aSurface);
|
||||
|
||||
static mozilla::RefPtr<mozilla::gfx::DataSourceSurface>
|
||||
static mozilla::TemporaryRef<DataSourceSurface>
|
||||
GetWrappedDataSourceSurface(gfxASurface *aSurface);
|
||||
|
||||
virtual mozilla::TemporaryRef<mozilla::gfx::ScaledFont>
|
||||
@ -219,13 +222,13 @@ public:
|
||||
virtual already_AddRefed<gfxASurface>
|
||||
GetThebesSurfaceForDrawTarget(mozilla::gfx::DrawTarget *aTarget);
|
||||
|
||||
mozilla::RefPtr<mozilla::gfx::DrawTarget>
|
||||
mozilla::TemporaryRef<DrawTarget>
|
||||
CreateOffscreenContentDrawTarget(const mozilla::gfx::IntSize& aSize, mozilla::gfx::SurfaceFormat aFormat);
|
||||
|
||||
mozilla::RefPtr<mozilla::gfx::DrawTarget>
|
||||
mozilla::TemporaryRef<DrawTarget>
|
||||
CreateOffscreenCanvasDrawTarget(const mozilla::gfx::IntSize& aSize, mozilla::gfx::SurfaceFormat aFormat);
|
||||
|
||||
virtual mozilla::RefPtr<mozilla::gfx::DrawTarget>
|
||||
virtual mozilla::TemporaryRef<DrawTarget>
|
||||
CreateDrawTargetForData(unsigned char* aData, const mozilla::gfx::IntSize& aSize,
|
||||
int32_t aStride, mozilla::gfx::SurfaceFormat aFormat);
|
||||
|
||||
@ -557,7 +560,7 @@ protected:
|
||||
* Helper method, creates a draw target for a specific Azure backend.
|
||||
* Used by CreateOffscreenDrawTarget.
|
||||
*/
|
||||
mozilla::RefPtr<mozilla::gfx::DrawTarget>
|
||||
mozilla::TemporaryRef<DrawTarget>
|
||||
CreateDrawTargetForBackend(mozilla::gfx::BackendType aBackend,
|
||||
const mozilla::gfx::IntSize& aSize,
|
||||
mozilla::gfx::SurfaceFormat aFormat);
|
||||
|
@ -965,7 +965,7 @@ gfxUtils::CopyAsDataURL(DrawTarget* aDT)
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
gfxUtils::WriteAsPNG(RefPtr<gfx::SourceSurface> aSourceSurface, const char* aFile)
|
||||
gfxUtils::WriteAsPNG(gfx::SourceSurface* aSourceSurface, const char* aFile)
|
||||
{
|
||||
RefPtr<gfx::DataSourceSurface> dataSurface = aSourceSurface->GetDataSurface();
|
||||
RefPtr<gfx::DrawTarget> dt
|
||||
@ -978,7 +978,7 @@ gfxUtils::WriteAsPNG(RefPtr<gfx::SourceSurface> aSourceSurface, const char* aFil
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
gfxUtils::DumpAsDataURL(RefPtr<gfx::SourceSurface> aSourceSurface)
|
||||
gfxUtils::DumpAsDataURL(gfx::SourceSurface* aSourceSurface)
|
||||
{
|
||||
RefPtr<gfx::DataSourceSurface> dataSurface = aSourceSurface->GetDataSurface();
|
||||
RefPtr<gfx::DrawTarget> dt
|
||||
@ -991,7 +991,7 @@ gfxUtils::DumpAsDataURL(RefPtr<gfx::SourceSurface> aSourceSurface)
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
gfxUtils::CopyAsDataURL(RefPtr<gfx::SourceSurface> aSourceSurface)
|
||||
gfxUtils::CopyAsDataURL(gfx::SourceSurface* aSourceSurface)
|
||||
{
|
||||
RefPtr<gfx::DataSourceSurface> dataSurface = aSourceSurface->GetDataSurface();
|
||||
RefPtr<gfx::DrawTarget> dt
|
||||
|
@ -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::RefPtr<mozilla::gfx::SourceSurface> aSourceSurface, const char* aFile);
|
||||
static void WriteAsPNG(mozilla::gfx::SourceSurface* 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::RefPtr<mozilla::gfx::SourceSurface> aSourceSurface);
|
||||
static void DumpAsDataURL(mozilla::gfx::SourceSurface* 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::RefPtr<mozilla::gfx::SourceSurface> aSourceSurface);
|
||||
static void CopyAsDataURL(mozilla::gfx::SourceSurface* aSourceSurface);
|
||||
#endif
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user