Bug 764125; sort out preferred and fallback Azure backends for all platforms (canvas and prefs). r=Bas

This commit is contained in:
Nicholas Cameron 2012-07-24 22:18:40 +12:00
parent eebed30e10
commit fb720292a3
2 changed files with 13 additions and 23 deletions

View File

@ -549,27 +549,6 @@ PRUint8 (*nsCanvasRenderingContext2DAzure::sPremultiplyTable)[256] = nsnull;
namespace mozilla {
namespace dom {
static bool
AzureCanvasEnabledOnPlatform()
{
#ifdef XP_WIN
if (gfxWindowsPlatform::GetPlatform()->GetRenderMode() !=
gfxWindowsPlatform::RENDER_DIRECT2D ||
!gfxWindowsPlatform::GetPlatform()->DWriteEnabled()) {
static bool checkedPref = false;
static bool preferSkia;
if (!checkedPref) {
preferSkia = Preferences::GetBool("gfx.canvas.azure.prefer-skia", false);
checkedPref = true;
}
return preferSkia;
}
#elif !defined(XP_MACOSX) && !defined(ANDROID) && !defined(LINUX)
return false;
#endif
return true;
}
bool
AzureCanvasEnabled()
{
@ -579,7 +558,9 @@ AzureCanvasEnabled()
azureEnabled = Preferences::GetBool("gfx.canvas.azure.enabled", false);
checkedPref = true;
}
return azureEnabled && AzureCanvasEnabledOnPlatform();
BackendType dontCare;
return azureEnabled && gfxPlatform::GetPlatform()->SupportsAzure(dontCare);
}
}
@ -588,7 +569,9 @@ AzureCanvasEnabled()
nsresult
NS_NewCanvasRenderingContext2DAzure(nsIDOMCanvasRenderingContext2D** aResult)
{
if (!AzureCanvasEnabledOnPlatform()) {
// XXX[nrc] remove this check when Thebes canvas is removed
// (because we will always support Azure)
if (!AzureCanvasEnabled()) {
return NS_ERROR_NOT_AVAILABLE;
}

View File

@ -225,10 +225,17 @@ pref("gfx.font_rendering.directwrite.use_gdi_table_loading", true);
#ifdef XP_WIN
pref("gfx.canvas.azure.enabled", true);
// comma separated list of backends to use in order of preference
// e.g., pref("gfx.canvas.azure.backends", "direct2d,skia,cairo");
pref("gfx.canvas.azure.backends", "direct2d");
pref("gfx.content.azure.enabled", true);
#else
#ifdef XP_MACOSX
pref("gfx.canvas.azure.enabled", true);
pref("gfx.canvas.azure.backends", "cg");
#else
pref("gfx.canvas.azure.enabled", false);
pref("gfx.canvas.azure.backends", "cairo,skia");
#endif
#endif