mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 276431 Patch 5: Move two nsSVGUtils methods to header file so they can be inlined in non-gklayout code. r=roc a=blocking
This commit is contained in:
parent
0c7ead0f64
commit
b24a5d67c8
@ -1181,29 +1181,6 @@ nsSVGUtils::ToAppPixelRect(nsPresContext *aPresContext, const gfxRect& rect)
|
||||
aPresContext->DevPixelsToAppUnits(NSToIntCeil(rect.YMost()) - NSToIntFloor(rect.Y())));
|
||||
}
|
||||
|
||||
static PRInt32
|
||||
ClampToInt(double aVal)
|
||||
{
|
||||
return NS_lround(NS_MAX(double(PR_INT32_MIN), NS_MIN(double(PR_INT32_MAX), aVal)));
|
||||
}
|
||||
|
||||
gfxIntSize
|
||||
nsSVGUtils::ConvertToSurfaceSize(const gfxSize& aSize, PRBool *aResultOverflows)
|
||||
{
|
||||
gfxIntSize surfaceSize(ClampToInt(aSize.width), ClampToInt(aSize.height));
|
||||
|
||||
*aResultOverflows = surfaceSize.width != NS_round(aSize.width) ||
|
||||
surfaceSize.height != NS_round(aSize.height);
|
||||
|
||||
if (!gfxASurface::CheckSurfaceSize(surfaceSize)) {
|
||||
surfaceSize.width = NS_MIN(NS_SVG_OFFSCREEN_MAX_DIMENSION, surfaceSize.width);
|
||||
surfaceSize.height = NS_MIN(NS_SVG_OFFSCREEN_MAX_DIMENSION, surfaceSize.height);
|
||||
*aResultOverflows = PR_TRUE;
|
||||
}
|
||||
|
||||
return surfaceSize;
|
||||
}
|
||||
|
||||
gfxMatrix
|
||||
nsSVGUtils::ConvertSVGMatrixToThebes(nsIDOMSVGMatrix *aMatrix)
|
||||
{
|
||||
|
@ -426,12 +426,33 @@ public:
|
||||
* Convert a surface size to an integer for use by thebes
|
||||
* possibly making it smaller in the process so the surface does not
|
||||
* use excessive memory.
|
||||
*
|
||||
* XXXdholbert Putting impl in header file so that imagelib can call this
|
||||
* method. Once we switch to a libxul-only world, this can go back into
|
||||
* the .cpp file.
|
||||
*
|
||||
* @param aSize the desired surface size
|
||||
* @param aResultOverflows true if the desired surface size is too big
|
||||
* @return the surface size to use
|
||||
*/
|
||||
static gfxIntSize
|
||||
ConvertToSurfaceSize(const gfxSize& aSize, PRBool *aResultOverflows);
|
||||
static gfxIntSize ConvertToSurfaceSize(const gfxSize& aSize,
|
||||
PRBool *aResultOverflows)
|
||||
{
|
||||
gfxIntSize surfaceSize(ClampToInt(aSize.width), ClampToInt(aSize.height));
|
||||
|
||||
*aResultOverflows = surfaceSize.width != NS_round(aSize.width) ||
|
||||
surfaceSize.height != NS_round(aSize.height);
|
||||
|
||||
if (!gfxASurface::CheckSurfaceSize(surfaceSize)) {
|
||||
surfaceSize.width = NS_MIN(NS_SVG_OFFSCREEN_MAX_DIMENSION,
|
||||
surfaceSize.width);
|
||||
surfaceSize.height = NS_MIN(NS_SVG_OFFSCREEN_MAX_DIMENSION,
|
||||
surfaceSize.height);
|
||||
*aResultOverflows = PR_TRUE;
|
||||
}
|
||||
|
||||
return surfaceSize;
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert a nsIDOMSVGMatrix to a gfxMatrix.
|
||||
@ -563,6 +584,16 @@ public:
|
||||
static PRBool NumberFromString(const nsAString& aString, float* aValue,
|
||||
PRBool aAllowPercentages = PR_FALSE);
|
||||
|
||||
/**
|
||||
* Convert a floating-point value to a 32-bit integer value, clamping to
|
||||
* the range of valid integers.
|
||||
*/
|
||||
static PRInt32 ClampToInt(double aVal)
|
||||
{
|
||||
return NS_lround(NS_MAX(double(PR_INT32_MIN),
|
||||
NS_MIN(double(PR_INT32_MAX), aVal)));
|
||||
}
|
||||
|
||||
private:
|
||||
/* Computational (nil) surfaces */
|
||||
static gfxASurface *gThebesComputationalSurface;
|
||||
|
Loading…
Reference in New Issue
Block a user