Bug 1251984 - allow gfx.xrender.enabled pref to work for compositing even if content backend is not Cairo. r=jrmuizel

This commit is contained in:
Lee Salzman 2016-03-01 14:33:53 -05:00
parent edb03ea5c0
commit 4ee1769ed1
5 changed files with 8 additions and 24 deletions

View File

@ -350,13 +350,8 @@ gfxPlatformGtk::GetDPIScale()
bool
gfxPlatformGtk::UseImageOffscreenSurfaces()
{
// We want to turn on image offscreen surfaces ONLY for GTK3 builds since
// GTK2 theme rendering still requires xlib surfaces.
#if (MOZ_WIDGET_GTK == 3)
return gfxPrefs::UseImageOffscreenSurfaces();
#else
return false;
#endif
return GetDefaultContentBackend() != mozilla::gfx::BackendType::CAIRO ||
gfxPrefs::UseImageOffscreenSurfaces();
}
gfxImageFormat

View File

@ -100,10 +100,6 @@ public:
bool UseXRender() {
#if defined(MOZ_X11)
if (GetDefaultContentBackend() != mozilla::gfx::BackendType::NONE &&
GetDefaultContentBackend() != mozilla::gfx::BackendType::CAIRO)
return false;
return sUseXRender;
#else
return false;

View File

@ -537,11 +537,7 @@ gfxXlibNativeRenderer::Draw(gfxContext* ctx, IntSize size,
gfxPoint deviceTranslation = gfxPoint(dtTransform._31, dtTransform._32);
cairo_t* cairo = static_cast<cairo_t*>
(drawTarget->GetNativeSurface(NativeSurfaceType::CAIRO_CONTEXT));
if (!cairo) {
return;
}
cairo_surface_t* cairoTarget = cairo_get_group_target(cairo);
cairo_surface_t* cairoTarget = cairo ? cairo_get_group_target(cairo) : nullptr;
cairo_surface_t* tempXlibSurface =
CreateTempXlibSurface(cairoTarget, drawTarget, size,
canDrawOverBackground, flags, screen, visual,

View File

@ -6496,6 +6496,9 @@ nsWindow::GetDrawTarget(const LayoutDeviceIntRegion& aRegion, BufferMode* aBuffe
#ifdef MOZ_X11
# ifdef MOZ_HAVE_SHMIMAGE
# ifdef MOZ_WIDGET_GTK
if (!gfxPlatformGtk::GetPlatform()->UseXRender())
# endif
if (nsShmImage::UseShm()) {
mBackShmImage.swap(mFrontShmImage);
if (!mBackShmImage) {

View File

@ -5,13 +5,11 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsShmImage.h"
#ifdef MOZ_WIDGET_GTK
#include "gfxPlatformGtk.h"
#endif
#ifdef MOZ_HAVE_SHMIMAGE
#include "mozilla/X11Util.h"
#include "mozilla/ipc/SharedMemory.h"
#include "gfxPlatform.h"
#include "nsPrintfCString.h"
#include "nsTArray.h"
@ -51,11 +49,7 @@ nsShmImage::~nsShmImage()
static bool gShmAvailable = true;
bool nsShmImage::UseShm()
{
#ifdef MOZ_WIDGET_GTK
return (gShmAvailable && !gfxPlatformGtk::GetPlatform()->UseXRender());
#else
return gShmAvailable;
#endif
}
static int gShmError = 0;
@ -154,7 +148,7 @@ nsShmImage::InitExtension()
}
if (pixmaps && XShmPixmapFormat(mDisplay) == ZPixmap) {
gShmPixmapAtom = XInternAtom(mDisplay, "_MOZ_SHM_PIXMAP", 0);
gShmPixmapAtom = XInternAtom(mDisplay, "_MOZ_SHM_PIXMAP", False);
}
return true;