Bug 381622 - complete cairo removal from svg. r+sr=roc

git-svn-id: svn://10.0.0.236/trunk@226878 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
tor%cs.brown.edu 2007-05-23 15:42:13 +00:00
parent e37d58ce03
commit 6d3abf00ac
5 changed files with 7 additions and 87 deletions

View File

@ -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 \

View File

@ -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 \

View File

@ -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"

View File

@ -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,

View File

@ -45,7 +45,6 @@
#include "nsCOMPtr.h"
#include "nsISVGValue.h"
#include "nsRect.h"
#include "cairo.h"
class nsIDocument;
class nsPresContext;
@ -305,20 +304,12 @@ public:
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 @@ public:
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 @@ public:
private:
/* Computational (nil) surfaces */
static cairo_surface_t *mCairoComputationalSurface;
static gfxASurface *mThebesComputationalSurface;
};