зеркало из https://github.com/mozilla/gecko-dev.git
Merge backout
This commit is contained in:
Коммит
03736343c4
|
@ -47,7 +47,6 @@
|
|||
#include "nsDebug.h"
|
||||
#include "gfxContext.h"
|
||||
#include "nsSVGUtils.h"
|
||||
#include "gfxPlatform.h"
|
||||
|
||||
class nsSVGElement;
|
||||
class nsIContent;
|
||||
|
@ -64,7 +63,7 @@ public:
|
|||
public:
|
||||
PathGenerator(nsSVGElement* aSVGElement)
|
||||
: mSVGElement(aSVGElement),
|
||||
mGfxContext(gfxPlatform::GetPlatform()->ScreenReferenceSurface()),
|
||||
mGfxContext(nsSVGUtils::GetThebesComputationalSurface()),
|
||||
mHaveReceivedCommands(PR_FALSE)
|
||||
{}
|
||||
|
||||
|
|
|
@ -48,7 +48,6 @@
|
|||
#include "nsSVGUtils.h"
|
||||
#include "nsSVGPoint.h"
|
||||
#include "gfxContext.h"
|
||||
#include "gfxPlatform.h"
|
||||
|
||||
nsSVGElement::NumberInfo nsSVGPathElement::sNumberInfo =
|
||||
{ &nsGkAtoms::pathLength, 0 };
|
||||
|
@ -1042,7 +1041,7 @@ nsSVGPathList::Playback(gfxContext *aCtx)
|
|||
already_AddRefed<gfxFlattenedPath>
|
||||
nsSVGPathList::GetFlattenedPath(const gfxMatrix& aMatrix)
|
||||
{
|
||||
gfxContext ctx(gfxPlatform::GetPlatform()->ScreenReferenceSurface());
|
||||
gfxContext ctx(nsSVGUtils::GetThebesComputationalSurface());
|
||||
|
||||
ctx.SetMatrix(aMatrix);
|
||||
Playback(&ctx);
|
||||
|
|
|
@ -316,6 +316,10 @@ nsLayoutStatics::Shutdown()
|
|||
nsCellMap::Shutdown();
|
||||
nsFrame::ShutdownLayerActivityTimer();
|
||||
|
||||
#ifdef MOZ_SVG
|
||||
nsSVGUtils::Shutdown();
|
||||
#endif
|
||||
|
||||
// Release all of our atoms
|
||||
nsColorNames::ReleaseTable();
|
||||
nsCSSProps::ReleaseTable();
|
||||
|
|
|
@ -439,7 +439,7 @@ nsSVGGlyphFrame::GetCoveredRegion()
|
|||
|
||||
static gfxContext *
|
||||
MakeTmpCtx() {
|
||||
return new gfxContext(gfxPlatform::GetPlatform()->ScreenReferenceSurface());
|
||||
return new gfxContext(nsSVGUtils::GetThebesComputationalSurface());
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
#include "gfxContext.h"
|
||||
#include "gfxMatrix.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "gfxPlatform.h"
|
||||
|
||||
class nsSVGImageFrame;
|
||||
|
||||
|
@ -328,7 +327,7 @@ nsSVGImageFrame::UpdateCoveredRegion()
|
|||
{
|
||||
mRect.Empty();
|
||||
|
||||
gfxContext context(gfxPlatform::GetPlatform()->ScreenReferenceSurface());
|
||||
gfxContext context(nsSVGUtils::GetThebesComputationalSurface());
|
||||
|
||||
GeneratePath(&context);
|
||||
context.IdentityMatrix();
|
||||
|
|
|
@ -46,7 +46,6 @@
|
|||
#include "nsSVGRect.h"
|
||||
#include "nsSVGPathGeometryElement.h"
|
||||
#include "gfxContext.h"
|
||||
#include "gfxPlatform.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Implementation
|
||||
|
@ -170,7 +169,7 @@ nsSVGPathGeometryFrame::GetFrameForPoint(const nsPoint &aPoint)
|
|||
|
||||
PRBool isHit = PR_FALSE;
|
||||
|
||||
gfxContext context(gfxPlatform::GetPlatform()->ScreenReferenceSurface());
|
||||
gfxContext context(nsSVGUtils::GetThebesComputationalSurface());
|
||||
|
||||
GeneratePath(&context);
|
||||
gfxPoint userSpacePoint =
|
||||
|
@ -250,7 +249,7 @@ nsSVGPathGeometryFrame::UpdateCoveredRegion()
|
|||
{
|
||||
mRect.Empty();
|
||||
|
||||
gfxContext context(gfxPlatform::GetPlatform()->ScreenReferenceSurface());
|
||||
gfxContext context(nsSVGUtils::GetThebesComputationalSurface());
|
||||
|
||||
GeneratePath(&context);
|
||||
context.IdentityMatrix();
|
||||
|
@ -362,7 +361,7 @@ nsSVGPathGeometryFrame::GetBBoxContribution(const gfxMatrix &aToBBoxUserspace)
|
|||
// XXX ReportToConsole
|
||||
return gfxRect(0.0, 0.0, 0.0, 0.0);
|
||||
}
|
||||
gfxContext context(gfxPlatform::GetPlatform()->ScreenReferenceSurface());
|
||||
gfxContext context(nsSVGUtils::GetThebesComputationalSurface());
|
||||
GeneratePath(&context, &aToBBoxUserspace);
|
||||
context.IdentityMatrix();
|
||||
return context.GetUserPathExtent();
|
||||
|
|
|
@ -1204,6 +1204,28 @@ nsSVGUtils::ConvertToSurfaceSize(const gfxSize& aSize, PRBool *aResultOverflows)
|
|||
return surfaceSize;
|
||||
}
|
||||
|
||||
gfxASurface *
|
||||
nsSVGUtils::GetThebesComputationalSurface()
|
||||
{
|
||||
if (!gThebesComputationalSurface) {
|
||||
nsRefPtr<gfxImageSurface> surface =
|
||||
new gfxImageSurface(gfxIntSize(1, 1), gfxASurface::ImageFormatARGB32);
|
||||
NS_ASSERTION(surface && !surface->CairoStatus(),
|
||||
"Could not create offscreen surface");
|
||||
gThebesComputationalSurface = surface;
|
||||
// we want to keep this surface around
|
||||
NS_IF_ADDREF(gThebesComputationalSurface);
|
||||
}
|
||||
|
||||
return gThebesComputationalSurface;
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGUtils::Shutdown()
|
||||
{
|
||||
NS_IF_RELEASE(gThebesComputationalSurface);
|
||||
}
|
||||
|
||||
gfxMatrix
|
||||
nsSVGUtils::ConvertSVGMatrixToThebes(nsIDOMSVGMatrix *aMatrix)
|
||||
{
|
||||
|
@ -1228,7 +1250,7 @@ nsSVGUtils::HitTestRect(const gfxMatrix &aMatrix,
|
|||
if (aMatrix.IsSingular()) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
gfxContext ctx(gfxPlatform::GetPlatform()->ScreenReferenceSurface());
|
||||
gfxContext ctx(GetThebesComputationalSurface());
|
||||
ctx.SetMatrix(aMatrix);
|
||||
ctx.NewPath();
|
||||
ctx.Rectangle(gfxRect(aRX, aRY, aRWidth, aRHeight));
|
||||
|
|
|
@ -433,6 +433,13 @@ public:
|
|||
static gfxIntSize
|
||||
ConvertToSurfaceSize(const gfxSize& aSize, PRBool *aResultOverflows);
|
||||
|
||||
/*
|
||||
* Get a pointer to a surface that can be used to create thebes
|
||||
* contexts for various measurement purposes.
|
||||
*/
|
||||
static gfxASurface *
|
||||
GetThebesComputationalSurface();
|
||||
|
||||
/*
|
||||
* Convert a nsIDOMSVGMatrix to a gfxMatrix.
|
||||
*/
|
||||
|
@ -563,6 +570,8 @@ public:
|
|||
static PRBool NumberFromString(const nsAString& aString, float* aValue,
|
||||
PRBool aAllowPercentages = PR_FALSE);
|
||||
|
||||
static void Shutdown();
|
||||
|
||||
private:
|
||||
/* Computational (nil) surfaces */
|
||||
static gfxASurface *gThebesComputationalSurface;
|
||||
|
|
Загрузка…
Ссылка в новой задаче