diff --git a/content/svg/content/src/Makefile.in b/content/svg/content/src/Makefile.in index ef1e3fdaab21..873c5b125403 100644 --- a/content/svg/content/src/Makefile.in +++ b/content/svg/content/src/Makefile.in @@ -168,9 +168,6 @@ EXPORTS = \ include $(topsrcdir)/config/rules.mk -CFLAGS += $(MOZ_CAIRO_CFLAGS) -CXXFLAGS += $(MOZ_CAIRO_CFLAGS) - INCLUDES += \ -I$(srcdir)/../../../shared/public \ -I$(srcdir)/../../../html/base/src \ diff --git a/layout/svg/base/src/Makefile.in b/layout/svg/base/src/Makefile.in index 405116bee70a..f85e592fffbe 100644 --- a/layout/svg/base/src/Makefile.in +++ b/layout/svg/base/src/Makefile.in @@ -112,9 +112,6 @@ EXPORTS = \ include $(topsrcdir)/config/rules.mk -CFLAGS += $(MOZ_CAIRO_CFLAGS) -CXXFLAGS += $(MOZ_CAIRO_CFLAGS) - LOCAL_INCLUDES = \ -I$(srcdir)/../../../base \ -I$(srcdir)/../../../generic \ diff --git a/layout/svg/base/src/nsSVGImageFrame.cpp b/layout/svg/base/src/nsSVGImageFrame.cpp index c678a687b59c..8ed57b4b0a12 100644 --- a/layout/svg/base/src/nsSVGImageFrame.cpp +++ b/layout/svg/base/src/nsSVGImageFrame.cpp @@ -46,7 +46,6 @@ #include "nsSVGElement.h" #include "nsSVGUtils.h" #include "nsSVGMatrix.h" -#include "cairo.h" #include "gfxContext.h" #include "nsIInterfaceRequestorUtils.h" #include "nsThebesImage.h" diff --git a/layout/svg/base/src/nsSVGUtils.cpp b/layout/svg/base/src/nsSVGUtils.cpp index 2239b8e72eba..30f4871c9dfc 100644 --- a/layout/svg/base/src/nsSVGUtils.cpp +++ b/layout/svg/base/src/nsSVGUtils.cpp @@ -73,7 +73,6 @@ #include "nsAttrValue.h" #include "nsSVGGeometryFrame.h" #include "nsIScriptError.h" -#include "cairo.h" #include "gfxContext.h" #include "gfxMatrix.h" #include "gfxRect.h" @@ -352,7 +351,6 @@ nsSVGMaskProperty::ParentChainChanged(nsIContent *aContent) mFrame->DeleteProperty(nsGkAtoms::mask); } -cairo_surface_t *nsSVGUtils::mCairoComputationalSurface = nsnull; gfxASurface *nsSVGUtils::mThebesComputationalSurface = nsnull; // c = n / 255 @@ -1257,16 +1255,6 @@ nsSVGUtils::ToBoundingPixelRect(const gfxRect& rect) nscoord(ceil(rect.YMost()) - floor(rect.Y()))); } -cairo_surface_t * -nsSVGUtils::GetCairoComputationalSurface() -{ - if (!mCairoComputationalSurface) - mCairoComputationalSurface = - cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 1, 1); - - return mCairoComputationalSurface; -} - gfxASurface * nsSVGUtils::GetThebesComputationalSurface() { @@ -1282,20 +1270,6 @@ nsSVGUtils::GetThebesComputationalSurface() return mThebesComputationalSurface; } -cairo_matrix_t -nsSVGUtils::ConvertSVGMatrixToCairo(nsIDOMSVGMatrix *aMatrix) -{ - float A, B, C, D, E, F; - aMatrix->GetA(&A); - aMatrix->GetB(&B); - aMatrix->GetC(&C); - aMatrix->GetD(&D); - aMatrix->GetE(&E); - aMatrix->GetF(&F); - cairo_matrix_t m = { A, B, C, D, E, F }; - return m; -} - gfxMatrix nsSVGUtils::ConvertSVGMatrixToThebes(nsIDOMSVGMatrix *aMatrix) { @@ -1317,50 +1291,20 @@ nsSVGUtils::HitTestRect(nsIDOMSVGMatrix *aMatrix, PRBool result = PR_TRUE; if (aMatrix) { - cairo_matrix_t matrix = ConvertSVGMatrixToCairo(aMatrix); - cairo_t *ctx = cairo_create(GetCairoComputationalSurface()); - if (cairo_status(ctx) != CAIRO_STATUS_SUCCESS) { - cairo_destroy(ctx); - return PR_FALSE; - } - cairo_set_tolerance(ctx, 1.0); + gfxContext ctx(GetThebesComputationalSurface()); + ctx.SetMatrix(ConvertSVGMatrixToThebes(aMatrix)); - cairo_set_matrix(ctx, &matrix); - cairo_new_path(ctx); - cairo_rectangle(ctx, aRX, aRY, aRWidth, aRHeight); - cairo_identity_matrix(ctx); + ctx.NewPath(); + ctx.Rectangle(gfxRect(aRX, aRY, aRWidth, aRHeight)); + ctx.IdentityMatrix(); - if (!cairo_in_fill(ctx, aX, aY)) + if (!ctx.PointInFill(gfxPoint(aX, aY))) result = PR_FALSE; - - cairo_destroy(ctx); } return result; } -void -nsSVGUtils::UserToDeviceBBox(cairo_t *ctx, - double *xmin, double *ymin, - double *xmax, double *ymax) -{ - double x[3], y[3]; - x[0] = *xmin; y[0] = *ymax; - x[1] = *xmax; y[1] = *ymax; - x[2] = *xmax; y[2] = *ymin; - - cairo_user_to_device(ctx, xmin, ymin); - *xmax = *xmin; - *ymax = *ymin; - for (int i = 0; i < 3; i++) { - cairo_user_to_device(ctx, &x[i], &y[i]); - *xmin = PR_MIN(*xmin, x[i]); - *xmax = PR_MAX(*xmax, x[i]); - *ymin = PR_MIN(*ymin, y[i]); - *ymax = PR_MAX(*ymax, y[i]); - } -} - void nsSVGUtils::CompositeSurfaceMatrix(gfxContext *aContext, gfxASurface *aSurface, diff --git a/layout/svg/base/src/nsSVGUtils.h b/layout/svg/base/src/nsSVGUtils.h index a2cd44e65b99..6f10dfc33189 100644 --- a/layout/svg/base/src/nsSVGUtils.h +++ b/layout/svg/base/src/nsSVGUtils.h @@ -45,7 +45,6 @@ #include "nsCOMPtr.h" #include "nsISVGValue.h" #include "nsRect.h" -#include "cairo.h" class nsIDocument; class nsPresContext; @@ -305,20 +304,12 @@ class nsSVGUtils ToBoundingPixelRect(const gfxRect& rect); /* - * Get a pointer to a surface that can be used to create cairo + * Get a pointer to a surface that can be used to create thebes * contexts for various measurement purposes. */ - static cairo_surface_t * - GetCairoComputationalSurface(); static gfxASurface * GetThebesComputationalSurface(); - /* - * Convert a nsIDOMSVGMatrix to a cairo_matrix_t. - */ - static cairo_matrix_t - ConvertSVGMatrixToCairo(nsIDOMSVGMatrix *aMatrix); - /* * Convert a nsIDOMSVGMatrix to a gfxMatrix. */ @@ -333,13 +324,6 @@ class nsSVGUtils float aRX, float aRY, float aRWidth, float aRHeight, float aX, float aY); - /* - * Convert a rectangle from cairo user space to device space. - */ - static void - UserToDeviceBBox(cairo_t *ctx, - double *xmin, double *ymin, - double *xmax, double *ymax); static void CompositeSurfaceMatrix(gfxContext *aContext, gfxASurface *aSurface, @@ -359,7 +343,6 @@ class nsSVGUtils private: /* Computational (nil) surfaces */ - static cairo_surface_t *mCairoComputationalSurface; static gfxASurface *mThebesComputationalSurface; };