зеркало из https://github.com/mozilla/pjs.git
Bug 702517 - Add SupportsAzure function to decide which backend to use. r=jrmuizel
This commit is contained in:
Родитель
d5906ea43c
Коммит
3e35553ef4
|
@ -79,12 +79,6 @@ gfxAndroidPlatform::CreateOffscreenSurface(const gfxIntSize& size,
|
|||
return newSurface.forget();
|
||||
}
|
||||
|
||||
RefPtr<DrawTarget>
|
||||
gfxAndroidPlatform::CreateOffscreenDrawTarget(const IntSize& aSize, SurfaceFormat aFormat)
|
||||
{
|
||||
return Factory::CreateDrawTarget(BACKEND_SKIA, aSize, aFormat);
|
||||
}
|
||||
|
||||
nsresult
|
||||
gfxAndroidPlatform::GetFontList(nsIAtom *aLangGroup,
|
||||
const nsACString& aGenericFamily,
|
||||
|
|
|
@ -66,8 +66,7 @@ public:
|
|||
CreateOffscreenSurface(const gfxIntSize& size,
|
||||
gfxASurface::gfxContentType contentType);
|
||||
|
||||
virtual mozilla::RefPtr<mozilla::gfx::DrawTarget>
|
||||
CreateOffscreenDrawTarget(const mozilla::gfx::IntSize& aSize, mozilla::gfx::SurfaceFormat aFormat);
|
||||
virtual bool SupportsAzure(mozilla::gfx::BackendType& aBackend) { aBackend = mozilla::gfx::BACKEND_SKIA; return true; }
|
||||
|
||||
virtual gfxImageFormat GetOffscreenFormat() { return gfxASurface::ImageFormatRGB16_565; }
|
||||
|
||||
|
|
|
@ -546,7 +546,11 @@ gfxPlatform::GetThebesSurfaceForDrawTarget(DrawTarget *aTarget)
|
|||
RefPtr<DrawTarget>
|
||||
gfxPlatform::CreateOffscreenDrawTarget(const IntSize& aSize, SurfaceFormat aFormat)
|
||||
{
|
||||
return NULL;
|
||||
BackendType backend;
|
||||
if (!SupportsAzure(backend)) {
|
||||
return NULL;
|
||||
}
|
||||
return Factory::CreateDrawTarget(backend, aSize, aFormat);
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -188,6 +188,8 @@ public:
|
|||
virtual mozilla::RefPtr<mozilla::gfx::DrawTarget>
|
||||
CreateOffscreenDrawTarget(const mozilla::gfx::IntSize& aSize, mozilla::gfx::SurfaceFormat aFormat);
|
||||
|
||||
virtual bool SupportsAzure(mozilla::gfx::BackendType& aBackend) { return false; }
|
||||
|
||||
/*
|
||||
* Font bits
|
||||
*/
|
||||
|
|
|
@ -139,12 +139,6 @@ gfxPlatformMac::CreateOffscreenSurface(const gfxIntSize& size,
|
|||
return newSurface;
|
||||
}
|
||||
|
||||
RefPtr<DrawTarget>
|
||||
gfxPlatformMac::CreateOffscreenDrawTarget(const IntSize& aSize, SurfaceFormat aFormat)
|
||||
{
|
||||
return Factory::CreateDrawTarget(BACKEND_SKIA, aSize, aFormat);
|
||||
}
|
||||
|
||||
already_AddRefed<gfxASurface>
|
||||
gfxPlatformMac::OptimizeImage(gfxImageSurface *aSurface,
|
||||
gfxASurface::gfxImageFormat format)
|
||||
|
@ -179,6 +173,13 @@ gfxPlatformMac::GetScaledFontForFont(gfxFont *aFont)
|
|||
return scaledFont;
|
||||
}
|
||||
|
||||
bool
|
||||
gfxPlatformMac::SupportsAzure(BackendType& aBackend)
|
||||
{
|
||||
aBackend = BACKEND_SKIA;
|
||||
return true;
|
||||
}
|
||||
|
||||
nsresult
|
||||
gfxPlatformMac::ResolveFontName(const nsAString& aFontName,
|
||||
FontResolverCallback aCallback,
|
||||
|
|
|
@ -63,15 +63,14 @@ public:
|
|||
already_AddRefed<gfxASurface> CreateOffscreenSurface(const gfxIntSize& size,
|
||||
gfxASurface::gfxContentType contentType);
|
||||
|
||||
virtual mozilla::RefPtr<mozilla::gfx::DrawTarget>
|
||||
CreateOffscreenDrawTarget(const mozilla::gfx::IntSize& aSize, mozilla::gfx::SurfaceFormat aFormat);
|
||||
|
||||
already_AddRefed<gfxASurface> OptimizeImage(gfxImageSurface *aSurface,
|
||||
gfxASurface::gfxImageFormat format);
|
||||
|
||||
mozilla::RefPtr<mozilla::gfx::ScaledFont>
|
||||
GetScaledFontForFont(gfxFont *aFont);
|
||||
|
||||
virtual bool SupportsAzure(mozilla::gfx::BackendType& aBackend);
|
||||
|
||||
nsresult ResolveFontName(const nsAString& aFontName,
|
||||
FontResolverCallback aCallback,
|
||||
void *aClosure, bool& aAborted);
|
||||
|
|
|
@ -474,22 +474,6 @@ gfxWindowsPlatform::CreateOffscreenSurface(const gfxIntSize& size,
|
|||
return surf;
|
||||
}
|
||||
|
||||
RefPtr<DrawTarget>
|
||||
gfxWindowsPlatform::CreateOffscreenDrawTarget(const IntSize& aSize, SurfaceFormat aFormat)
|
||||
{
|
||||
#ifdef CAIRO_HAS_D2D_SURFACE
|
||||
if (mRenderMode == RENDER_DIRECT2D) {
|
||||
return Factory::CreateDrawTarget(BACKEND_DIRECT2D, aSize, aFormat);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (Preferences::GetBool("gfx.canvas.azure.prefer-skia", false)) {
|
||||
return Factory::CreateDrawTarget(BACKEND_SKIA, aSize, aFormat);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
RefPtr<ScaledFont>
|
||||
gfxWindowsPlatform::GetScaledFontForFont(gfxFont *aFont)
|
||||
{
|
||||
|
@ -540,6 +524,23 @@ gfxWindowsPlatform::GetThebesSurfaceForDrawTarget(DrawTarget *aTarget)
|
|||
return gfxPlatform::GetThebesSurfaceForDrawTarget(aTarget);
|
||||
}
|
||||
|
||||
bool
|
||||
gfxWindowsPlatform::SupportsAzure(BackendType& aBackend)
|
||||
{
|
||||
#ifdef CAIRO_HAS_D2D_SURFACE
|
||||
if (mRenderMode == RENDER_DIRECT2D) {
|
||||
aBackend = BACKEND_DIRECT2D;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (Preferences::GetBool("gfx.canvas.azure.prefer-skia", false)) {
|
||||
aBackend = BACKEND_SKIA;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
nsresult
|
||||
gfxWindowsPlatform::GetFontList(nsIAtom *aLangGroup,
|
||||
const nsACString& aGenericFamily,
|
||||
|
|
|
@ -131,8 +131,8 @@ public:
|
|||
GetScaledFontForFont(gfxFont *aFont);
|
||||
virtual already_AddRefed<gfxASurface>
|
||||
GetThebesSurfaceForDrawTarget(mozilla::gfx::DrawTarget *aTarget);
|
||||
virtual mozilla::RefPtr<mozilla::gfx::DrawTarget>
|
||||
CreateOffscreenDrawTarget(const mozilla::gfx::IntSize& aSize, mozilla::gfx::SurfaceFormat aFormat);
|
||||
|
||||
virtual bool SupportsAzure(mozilla::gfx::BackendType& aBackend);
|
||||
|
||||
enum RenderMode {
|
||||
/* Use GDI and windows surfaces */
|
||||
|
|
Загрузка…
Ссылка в новой задаче