b=782185 provide a gfxXlibSurface method to indicate when cairo's extend_pad will be slow r=joe

--HG--
extra : transplant_source : M%D2%05%3A%C1%18W%BD.%BA8%18%BD%F9%F9%AEu%EEX%CE
This commit is contained in:
Karl Tomlinson 2012-08-14 23:47:49 +12:00
parent 8cc9a19c34
commit afb8943655
2 changed files with 13 additions and 9 deletions

View File

@ -73,15 +73,7 @@ PreparePatternForUntiledDrawing(gfxPattern* aPattern,
// Cairo, and hence Gecko, can use RepeatPad on Xorg 1.7. We
// enable EXTEND_PAD provided that we're running on a recent
// enough X server.
gfxXlibSurface *xlibSurface =
static_cast<gfxXlibSurface *>(currentTarget);
Display *dpy = xlibSurface->XDisplay();
// This is the exact condition for cairo to avoid XRender for
// EXTEND_PAD
if (VendorRelease(dpy) >= 60700000 ||
VendorRelease(dpy) < 10699000) {
if (static_cast<gfxXlibSurface*>(currentTarget)->IsPadSlow()) {
bool isDownscale =
aDeviceToImage.xx >= 1.0 && aDeviceToImage.yy >= 1.0 &&
aDeviceToImage.xy == 0.0 && aDeviceToImage.yx == 0.0;

View File

@ -79,6 +79,18 @@ public:
GLXPixmap GetGLXPixmap();
#endif
// Return true if cairo will take its slow path when this surface is used
// in a pattern with EXTEND_PAD. As a workaround for XRender's RepeatPad
// not being implemented correctly on old X servers, cairo avoids XRender
// and instead reads back to perform EXTEND_PAD with pixman. Cairo does
// this for servers older than xorg-server 1.7.
bool IsPadSlow() {
// The test here matches that for buggy_pad_reflect in
// _cairo_xlib_device_create.
return VendorRelease(mDisplay) >= 60700000 ||
VendorRelease(mDisplay) < 10699000;
}
protected:
// if TakePixmap() has been called on this
bool mPixmapTaken;