Comment 233 for bug 217908

Revision history for this message
In , Jmuizelaar (jmuizelaar) wrote :

(From update of attachment 388683)
>diff -r b91c9ee69e6e gfx/src/thebes/nsThebesImage.cpp
>--- a/gfx/src/thebes/nsThebesImage.cpp Wed Jul 15 01:39:35 2009 -0400
>+++ b/gfx/src/thebes/nsThebesImage.cpp Wed Jul 15 08:43:01 2009 -0400
>@@ -46,6 +46,9 @@
>
> #include "prenv.h"
>
>+#include "cairo.h"
>+#include "gfxXlibSurface.h"
>+
> static PRBool gDisableOptimize = PR_FALSE;
>
> #ifdef XP_WIN
>@@ -685,11 +688,34 @@
> // have adjusted the pattern's matrix ... but the adjustment
> // is only a translation so the scale factors in deviceToImage
> // are still valid.
>+ //
>+ // Update 6/24/09: The underlying X server/driver bugs are now
>+ // fixed, and cairo uses the fast XRender code-path as of 1.9.2
>+ // (commit a1d0a06b6275cac3974be84919993e187394fe43) --
>+ // but only if running on a 1.7 X server.
>+ // So we enable EXTEND_PAD provided that we're running a recent
>+ // enough cairo version (obviously, this is only relevant if
>+ // --enable-system-cairo is used) AND running on a recent
>+ // enough X server. This should finally bring linux up to par
>+ // with other systems.
> PRBool isDownscale =
> deviceToImage.xx >= 1.0 && deviceToImage.yy >= 1.0 &&
> deviceToImage.xy == 0.0 && deviceToImage.yx == 0.0;
> if (!isDownscale) {
>- pattern->SetFilter(0);
>+ PRBool fastExtendPad = false;
>+ if (currentTarget->GetType() == gfxASurface::SurfaceTypeXlib &&
>+ cairo_version() >= CAIRO_VERSION_ENCODE(1,9,2)) {
>+ gfxXlibSurface *xlibSurface = static_cast<gfxXlibSurface *>((gfxASurface *)currentTarget);

Using currentTarget.get() is better than (gfxASurface *)currentTarget.

>+ Display *dpy = xlibSurface->XDisplay();
>+ // This is the exact condition for cairo to use XRender for EXTEND_PAD
>+ if (VendorRelease (dpy) < 60700000 && VendorRelease (dpy) >= 10699000)

The whitespace for the comment "// This is .." uses tabs, the line below it does not.

>+ fastExtendPad = true;
>+ }
>+ if (fastExtendPad) {
>+ pattern->SetExtend(gfxPattern::EXTEND_PAD);
>+ } else {
>+ pattern->SetFilter(0);
>+ }
> }
> break;
> }