Back out 9805ecdb8f66 (bug 789367) on suspicion of breaking the build

This commit is contained in:
Phil Ringnalda 2012-09-16 17:59:25 -07:00
parent e030a5d9cd
commit 07143175e9
8 changed files with 42 additions and 70 deletions

View File

@ -228,9 +228,8 @@ gfxPlatform::gfxPlatform()
#endif
mBidiNumeralOption = UNINITIALIZED_VALUE;
uint32_t canvasMask = (1 << BACKEND_CAIRO) | (1 << BACKEND_SKIA);
uint32_t contentMask = 0;
InitCanvasBackend(canvasMask, contentMask);
uint32_t backendMask = (1 << BACKEND_CAIRO) | (1 << BACKEND_SKIA);
InitCanvasBackend(backendMask);
}
gfxPlatform*
@ -1185,30 +1184,25 @@ gfxPlatform::AppendPrefLang(eFontPrefLang aPrefLangs[], uint32_t& aLen, eFontPre
}
void
gfxPlatform::InitBackendPrefs(uint32_t aCanvasBitmask, uint32_t aContentBitmask)
gfxPlatform::InitCanvasBackend(uint32_t aBackendBitmask)
{
mPreferredCanvasBackend = GetCanvasBackendPref(aCanvasBitmask);
mFallbackCanvasBackend = GetCanvasBackendPref(aCanvasBitmask & ~(1 << mPreferredCanvasBackend));
mContentBackend = GetBackendPref("gfx.content.azure.enabled", "gfx.content.azure.backend", aContentBitmask);
if (!Preferences::GetBool("gfx.canvas.azure.enabled", false)) {
mPreferredCanvasBackend = BACKEND_NONE;
mFallbackCanvasBackend = BACKEND_NONE;
return;
}
mPreferredCanvasBackend = GetCanvasBackendPref(aBackendBitmask);
mFallbackCanvasBackend = GetCanvasBackendPref(aBackendBitmask & ~(1 << mPreferredCanvasBackend));
}
/* static */ BackendType
gfxPlatform::GetCanvasBackendPref(uint32_t aBackendBitmask)
{
return GetBackendPref("gfx.canvas.azure.enabled", "gfx.canvas.azure.backends", aBackendBitmask);
}
/* static */ BackendType
gfxPlatform::GetBackendPref(const char* aEnabledPrefName, const char* aBackendPrefName, uint32_t aBackendBitmask)
{
if (!Preferences::GetBool(aEnabledPref, false)) {
return BACKEND_NONE;
}
if (!gBackendList) {
gBackendList = new nsTArray<nsCString>();
nsCString prefString;
if (NS_SUCCEEDED(Preferences::GetCString(aBackendPref, &prefString))) {
if (NS_SUCCEEDED(Preferences::GetCString("gfx.canvas.azure.backends", &prefString))) {
ParseString(prefString, ',', *gBackendList);
}
}

View File

@ -202,7 +202,7 @@ public:
void GetAzureBackendInfo(mozilla::widget::InfoObject &aObj) {
aObj.DefineProperty("AzureCanvasBackend", GetBackendName(mPreferredCanvasBackend));
aObj.DefineProperty("AzureFallbackCanvasBackend", GetBackendName(mFallbackCanvasBackend));
aObj.DefineProperty("AzureContentBackend", GetBackendName(mContentBackend));
aObj.DefineProperty("AzureContentBackend", GetBackendName(GetContentBackend()));
}
mozilla::gfx::BackendType GetPreferredCanvasBackend() {
@ -478,35 +478,17 @@ protected:
* The backend used is determined by aBackendBitmask and the order specified
* by the gfx.canvas.azure.backends pref.
*/
void InitBackendPrefs(uint32_t aCanvasBitmask, uint32_t aContentBitmask);
void InitCanvasBackend(uint32_t aBackendBitmask);
/**
* returns the first backend named in the pref gfx.canvas.azure.backends
* which is a component of aBackendBitmask, a bitmask of backend types
*/
static mozilla::gfx::BackendType GetCanvasBackendPref(uint32_t aBackendBitmask);
/**
* returns the first backend named in the pref gfx.content.azure.backend
* which is a component of aBackendBitmask, a bitmask of backend types
*/
static mozilla::gfx::BackendType GetContentBackendPref(uint32_t aBackendBitmask);
/**
* Checks the aEnabledPrefName pref and returns BACKEND_NONE if the pref is
* not enabled. Otherwise it will return the first backend named in
* aBackendPrefName allowed by aBackendBitmask, a bitmask of backend types.
*/
static mozilla::gfx::BackendType GetBackendPref(const char* aEnabledPrefName,
const char* aBackendPrefName,
uint32_t aBackendBitmask);
/**
* Decode the backend enumberation from a string.
*/
static mozilla::gfx::BackendType BackendTypeForName(const nsCString& aName);
mozilla::gfx::BackendType GetContentBackend() {
return mContentBackend;
virtual mozilla::gfx::BackendType GetContentBackend()
{
return mozilla::gfx::BACKEND_NONE;
}
int8_t mAllowDownloadableFonts;
@ -541,8 +523,6 @@ private:
mozilla::gfx::BackendType mPreferredCanvasBackend;
// The fallback draw target backend to use for canvas, if the preferred backend fails
mozilla::gfx::BackendType mFallbackCanvasBackend;
// The backend to use for content
mozilla::gfx::BackendType mContentBackend;
mozilla::widget::GfxInfoCollector<gfxPlatform> mAzureCanvasBackendCollector;
bool mWorkAroundDriverBugs;

View File

@ -93,9 +93,6 @@ gfxPlatformGtk::gfxPlatformGtk()
gCodepointsWithNoFonts = new gfxSparseBitSet();
UpdateFontList();
#endif
uint32_t canvasMask = (1 << BACKEND_CAIRO) | (1 << BACKEND_SKIA);
uint32_t contentMask = (1 << BACKEND_CAIRO);
InitCanvasBackend(canvasMask, contentMask);
}
gfxPlatformGtk::~gfxPlatformGtk()
@ -148,7 +145,14 @@ gfxPlatformGtk::CreateOffscreenSurface(const gfxIntSize& size,
// we should try to match
GdkScreen *gdkScreen = gdk_screen_get_default();
if (gdkScreen) {
if (UseXRender()) {
if (!UseXRender()) {
// We're not going to use XRender, so we don't need to
// search for a render format
newSurface = new gfxImageSurface(size, imageFormat);
// The gfxImageSurface ctor zeroes this for us, no need to
// waste time clearing again
needsClear = false;
} else {
Screen *screen = gdk_x11_screen_get_xscreen(gdkScreen);
XRenderPictFormat* xrenderFormat =
gfxXlibSurface::FindRenderFormat(DisplayOfScreen(screen),
@ -157,13 +161,6 @@ gfxPlatformGtk::CreateOffscreenSurface(const gfxIntSize& size,
if (xrenderFormat) {
newSurface = gfxXlibSurface::Create(screen, xrenderFormat, size);
}
} else {
// We're not going to use XRender, so we don't need to
// search for a render format
newSurface = new gfxImageSurface(size, imageFormat);
// The gfxImageSurface ctor zeroes this for us, no need to
// waste time clearing again
needsClear = false;
}
}
#endif

View File

@ -111,10 +111,6 @@ public:
// this, we'll only disable this for maemo.
return true;
#elif defined(MOZ_X11)
if (GetContentBackend() != BACKEND_NONE &&
GetContentBackend() != BACKEND_CAIRO)
return false;
return sUseXRender;
#else
return false;

View File

@ -70,9 +70,8 @@ gfxPlatformMac::gfxPlatformMac()
}
mFontAntiAliasingThreshold = ReadAntiAliasingThreshold();
uint32_t canvasMask = (1 << BACKEND_CAIRO) | (1 << BACKEND_SKIA) | (1 << BACKEND_COREGRAPHICS);
uint32_t contentMask = 0;
InitBackendPrefs(canvasMask, contentMask);
uint32_t backendMask = (1 << BACKEND_CAIRO) | (1 << BACKEND_SKIA) | (1 << BACKEND_COREGRAPHICS);
InitCanvasBackend(backendMask);
}
gfxPlatformMac::~gfxPlatformMac()

View File

@ -516,16 +516,13 @@ gfxWindowsPlatform::UpdateRenderMode()
}
#endif
uint32_t canvasMask = 1 << BACKEND_CAIRO;
uint32_t contentMask;
uint32_t backendMask = 1 << BACKEND_CAIRO;
if (mRenderMode == RENDER_DIRECT2D) {
canvasMask |= 1 << BACKEND_DIRECT2D;
contentMask = BACKEND_DIRECT2D;
backendMask |= 1 << BACKEND_DIRECT2D;
} else {
canvasMask |= 1 << BACKEND_SKIA;
contentMask = 0;
backendMask |= 1 << BACKEND_SKIA;
}
InitBackendPrefs(canvasMask, contentMask);
InitCanvasBackend(backendMask);
}
void

View File

@ -243,6 +243,13 @@ public:
static bool IsRunningInWindows8Metro();
protected:
virtual mozilla::gfx::BackendType GetContentBackend()
{
return UseAzureContentDrawing() && mRenderMode == RENDER_DIRECT2D ?
mozilla::gfx::BACKEND_DIRECT2D :
mozilla::gfx::BACKEND_NONE;
}
RenderMode mRenderMode;
int8_t mUseClearTypeForDownloadableFonts;

View File

@ -241,14 +241,16 @@ 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,cairo");
pref("gfx.content.azure.backend", "direct2d");
pref("gfx.content.azure.enabled", true);
#else
#ifdef XP_MACOSX
pref("gfx.canvas.azure.backends", "cg");
#else
#ifdef ANDROID
pref("gfx.canvas.azure.backends", "cairo");
pref("gfx.content.azure.backend", "cairo");
#else
pref("gfx.canvas.azure.backends", "cairo");
#endif
#endif
#endif