Bug 764752 - Choose optimal 2D format based on off-screen format. r=joe

--HG--
extra : rebase_source : 064638dfa5fa4324aa376f794ebf10bf4d6dd2c3
This commit is contained in:
Kan-Ru Chen 2012-06-20 12:03:24 +08:00
parent fc968e2de7
commit 35f20c776f
3 changed files with 11 additions and 14 deletions

View File

@ -56,17 +56,6 @@ gfxAndroidPlatform::CreateOffscreenSurface(const gfxIntSize& size,
return newSurface.forget();
}
mozilla::gfx::SurfaceFormat
gfxAndroidPlatform::Optimal2DFormatForContent(gfxASurface::gfxContentType aContent)
{
// On Android we always use RGB565 for now.
if (aContent == gfxASurface::CONTENT_COLOR) {
return mozilla::gfx::FORMAT_R5G6B5;
} else {
return gfxPlatform::Optimal2DFormatForContent(aContent);
}
}
nsresult
gfxAndroidPlatform::GetFontList(nsIAtom *aLangGroup,
const nsACString& aGenericFamily,

View File

@ -35,8 +35,6 @@ public:
virtual bool SupportsAzure(mozilla::gfx::BackendType& aBackend) { aBackend = mozilla::gfx::BACKEND_SKIA; return true; }
virtual mozilla::gfx::SurfaceFormat Optimal2DFormatForContent(gfxASurface::gfxContentType aContent);
virtual gfxImageFormat GetOffscreenFormat() { return mOffscreenFormat; }
mozilla::RefPtr<mozilla::gfx::ScaledFont>

View File

@ -1441,7 +1441,17 @@ gfxPlatform::Optimal2DFormatForContent(gfxASurface::gfxContentType aContent)
{
switch (aContent) {
case gfxASurface::CONTENT_COLOR:
return mozilla::gfx::FORMAT_B8G8R8X8;
switch (GetOffscreenFormat()) {
case gfxASurface::ImageFormatARGB32:
return mozilla::gfx::FORMAT_B8G8R8A8;
case gfxASurface::ImageFormatRGB24:
return mozilla::gfx::FORMAT_B8G8R8X8;
case gfxASurface::ImageFormatRGB16_565:
return mozilla::gfx::FORMAT_R5G6B5;
default:
NS_NOTREACHED("unknown gfxImageFormat for CONTENT_COLOR");
return mozilla::gfx::FORMAT_B8G8R8A8;
}
case gfxASurface::CONTENT_ALPHA:
return mozilla::gfx::FORMAT_A8;
case gfxASurface::CONTENT_COLOR_ALPHA: