Bug 607653 - avoid temporary fbos/textures on transformed layers, when possible. r=roc a=approval2.0

This commit is contained in:
Oleg Romashin 2010-11-24 11:35:21 +02:00
parent 5cbe4f70b1
commit 233ef8a80c
19 changed files with 179 additions and 164 deletions

View File

@ -67,6 +67,7 @@
#include "nsSVGFilterElement.h"
#include "nsSVGString.h"
#include "nsSVGEffects.h"
#include "gfxUtils.h"
#if defined(XP_WIN)
// Prevent Windows redefining LoadImage
@ -174,7 +175,7 @@ nsSVGFE::SetupScalingFilter(nsSVGFilterInstance *aInstance,
r.Scale(gfxFloat(scaledSize.width)/aTarget->mImage->Width(),
gfxFloat(scaledSize.height)/aTarget->mImage->Height());
r.RoundOut();
if (NS_FAILED(nsLayoutUtils::GfxRectToIntRect(r, &result.mDataRect)))
if (!gfxUtils::GfxRectToIntRect(r, &result.mDataRect))
return result;
#ifdef DEBUG_tor
@ -2963,9 +2964,9 @@ nsSVGFETileElement::Filter(nsSVGFilterInstance *instance,
// but nothing clips mFilterPrimitiveSubregion so this should be changed.
nsIntRect tile;
nsresult res = nsLayoutUtils::GfxRectToIntRect(aSources[0]->mFilterPrimitiveSubregion, &tile);
PRBool res = gfxUtils::GfxRectToIntRect(aSources[0]->mFilterPrimitiveSubregion, &tile);
NS_ENSURE_SUCCESS(res, res); // asserts on failure (not
NS_ENSURE_TRUE(res, NS_ERROR_FAILURE); // asserts on failure (not
if (tile.IsEmpty())
return NS_OK;

View File

@ -333,7 +333,9 @@ ContainerLayer::DefaultComputeEffectiveTransforms(const gfx3DMatrix& aTransformT
useIntermediateSurface = PR_TRUE;
} else {
useIntermediateSurface = PR_FALSE;
if (!mEffectiveTransform.IsIdentity()) {
gfxMatrix contTransform;
if (!mEffectiveTransform.Is2D(&contTransform) ||
!contTransform.PreservesAxisAlignedRectangles()) {
for (Layer* child = GetFirstChild(); child; child = child->GetNextSibling()) {
const nsIntRect *clipRect = child->GetEffectiveClipRect();
/* We can't (easily) forward our transform to children with a non-empty clip

View File

@ -37,6 +37,8 @@
#include "ContainerLayerD3D10.h"
#include "nsAlgorithm.h"
#include "gfxUtils.h"
#include "nsRect.h"
namespace mozilla {
namespace layers {
@ -143,6 +145,15 @@ ContainerLayerD3D10::GetFirstChildD3D10()
return static_cast<LayerD3D10*>(mFirstChild->ImplData());
}
static inline LayerD3D10*
GetNextSiblingD3D10(LayerD3D10* aLayer)
{
Layer* layer = aLayer->GetLayer()->GetNextSibling();
return layer ? static_cast<LayerD3D10*>(layer->
ImplData())
: nsnull;
}
void
ContainerLayerD3D10::RenderLayer()
{
@ -160,6 +171,7 @@ ContainerLayerD3D10::RenderLayer()
gfx3DMatrix oldViewMatrix;
gfxMatrix contTransform;
if (useIntermediate) {
device()->OMGetRenderTargets(1, getter_AddRefs(previousRTView), NULL);
@ -192,14 +204,26 @@ ContainerLayerD3D10::RenderLayer()
previousViewportSize = mD3DManager->GetViewport();
mD3DManager->SetViewport(nsIntSize(visibleRect.Size()));
} else {
#ifdef DEBUG
PRBool is2d =
#endif
GetEffectiveTransform().Is2D(&contTransform);
NS_ASSERTION(is2d, "Transform must be 2D");
}
/*
* Render this container's contents.
*/
LayerD3D10 *layerToRender = GetFirstChildD3D10();
while (layerToRender) {
const nsIntRect *clipRect = layerToRender->GetLayer()->GetClipRect();
for (LayerD3D10* layerToRender = GetFirstChildD3D10();
layerToRender != nsnull;
layerToRender = GetNextSiblingD3D10(layerToRender)) {
const nsIntRect* clipRect = layerToRender->GetLayer()->GetClipRect();
if ((clipRect && clipRect->IsEmpty()) ||
layerToRender->GetLayer()->GetEffectiveVisibleRegion().IsEmpty()) {
continue;
}
D3D10_RECT oldScissor;
if (clipRect || useIntermediate) {
@ -222,6 +246,24 @@ ContainerLayerD3D10::RenderLayer()
D3D10_RECT d3drect;
if (!useIntermediate) {
if (clipRect) {
gfxRect cliprect(r.left, r.top, r.left + r.right, r.top + r.bottom);
gfxRect trScissor = contTransform.TransformBounds(cliprect);
trScissor.Round();
nsIntRect trIntScissor;
if (gfxUtils::GfxRectToIntRect(trScissor, &trIntScissor)) {
r.left = trIntScissor.x;
r.top = trIntScissor.y;
r.right = trIntScissor.XMost();
r.bottom = trIntScissor.YMost();
} else {
r.left = 0;
r.top = 0;
r.right = visibleRect.width;
r.bottom = visibleRect.height;
clipRect = nsnull;
}
}
// Scissor rect should be an intersection of the old and current scissor.
r.left = NS_MAX<PRInt32>(oldScissor.left, r.left);
r.right = NS_MIN<PRInt32>(oldScissor.right, r.right);
@ -231,10 +273,6 @@ ContainerLayerD3D10::RenderLayer()
if (r.left >= r.right || r.top >= r.bottom) {
// Entire layer's clipped out, don't bother drawing.
Layer *nextSibling = layerToRender->GetLayer()->GetNextSibling();
layerToRender = nextSibling ? static_cast<LayerD3D10*>(nextSibling->
ImplData())
: nsnull;
continue;
}
@ -252,11 +290,6 @@ ContainerLayerD3D10::RenderLayer()
if (clipRect || useIntermediate) {
device()->RSSetScissorRects(1, &oldScissor);
}
Layer *nextSibling = layerToRender->GetLayer()->GetNextSibling();
layerToRender = nextSibling ? static_cast<LayerD3D10*>(nextSibling->
ImplData())
: nsnull;
}
if (useIntermediate) {

View File

@ -36,6 +36,8 @@
* ***** END LICENSE BLOCK ***** */
#include "ContainerLayerD3D9.h"
#include "gfxUtils.h"
#include "nsRect.h"
namespace mozilla {
namespace layers {
@ -142,6 +144,15 @@ ContainerLayerD3D9::GetFirstChildD3D9()
return static_cast<LayerD3D9*>(mFirstChild->ImplData());
}
static inline LayerD3D9*
GetNextSiblingD3D9(LayerD3D9* aLayer)
{
Layer* layer = aLayer->GetLayer()->GetNextSibling();
return layer ? static_cast<LayerD3D9*>(layer->
ImplData())
: nsnull;
}
void
ContainerLayerD3D9::RenderLayer()
{
@ -155,6 +166,7 @@ ContainerLayerD3D9::RenderLayer()
nsIntRect visibleRect = mVisibleRegion.GetBounds();
PRBool useIntermediate = UseIntermediateSurface();
gfxMatrix contTransform;
if (useIntermediate) {
device()->GetRenderTarget(0, getter_AddRefs(previousRenderTarget));
device()->CreateTexture(visibleRect.width, visibleRect.height, 1,
@ -182,14 +194,27 @@ ContainerLayerD3D9::RenderLayer()
device()->GetVertexShaderConstantF(CBmProjection, &oldViewMatrix[0][0], 4);
device()->SetVertexShaderConstantF(CBmProjection, &viewMatrix._11, 4);
} else {
#ifdef DEBUG
PRBool is2d =
#endif
GetEffectiveTransform().Is2D(&contTransform);
NS_ASSERTION(is2d, "Transform must be 2D");
}
/*
* Render this container's contents.
*/
LayerD3D9 *layerToRender = GetFirstChildD3D9();
while (layerToRender) {
const nsIntRect *clipRect = layerToRender->GetLayer()->GetClipRect();
for (LayerD3D9* layerToRender = GetFirstChildD3D9();
layerToRender != nsnull;
layerToRender = GetNextSiblingD3D9(layerToRender)) {
const nsIntRect* clipRect = layerToRender->GetLayer()->GetClipRect();
if ((clipRect && clipRect->IsEmpty()) ||
layerToRender->GetLayer()->GetEffectiveVisibleRegion().IsEmpty()) {
continue;
}
if (clipRect || useIntermediate) {
RECT r;
device()->GetScissorRect(&oldClipRect);
@ -212,6 +237,25 @@ ContainerLayerD3D9::RenderLayer()
renderSurface->GetDesc(&desc);
if (!useIntermediate) {
// Transform clip rect
if (clipRect) {
gfxRect cliprect(r.left, r.top, r.left + r.right, r.top + r.bottom);
gfxRect trScissor = contTransform.TransformBounds(cliprect);
trScissor.Round();
nsIntRect trIntScissor;
if (gfxUtils::GfxRectToIntRect(trScissor, &trIntScissor)) {
r.left = trIntScissor.x;
r.top = trIntScissor.y;
r.right = trIntScissor.XMost();
r.bottom = trIntScissor.YMost();
} else {
r.left = 0;
r.top = 0;
r.right = visibleRect.width;
r.bottom = visibleRect.height;
clipRect = nsnull;
}
}
// Intersect with current clip rect.
r.left = NS_MAX<PRInt32>(oldClipRect.left, r.left);
r.right = NS_MIN<PRInt32>(oldClipRect.right, r.right);
@ -234,10 +278,7 @@ ContainerLayerD3D9::RenderLayer()
device()->SetScissorRect(&oldClipRect);
}
Layer *nextSibling = layerToRender->GetLayer()->GetNextSibling();
layerToRender = nextSibling ? static_cast<LayerD3D9*>(nextSibling->
ImplData())
: nsnull;
continue;
}
if (useIntermediate) {

View File

@ -36,6 +36,7 @@
* ***** END LICENSE BLOCK ***** */
#include "ContainerLayerOGL.h"
#include "gfxUtils.h"
namespace mozilla {
namespace layers {
@ -128,6 +129,15 @@ ContainerDestroy(Container* aContainer)
}
}
static inline LayerOGL*
GetNextSibling(LayerOGL* aLayer)
{
Layer* layer = aLayer->GetLayer()->GetNextSibling();
return layer ? static_cast<LayerOGL*>(layer->
ImplData())
: nsnull;
}
template<class Container>
static void
ContainerRender(Container* aContainer,
@ -150,6 +160,7 @@ ContainerRender(Container* aContainer,
float opacity = aContainer->GetEffectiveOpacity();
const gfx3DMatrix& transform = aContainer->GetEffectiveTransform();
bool needsFramebuffer = aContainer->UseIntermediateSurface();
gfxMatrix contTransform;
if (needsFramebuffer) {
aManager->CreateFBOWithTexture(visibleRect.width,
visibleRect.height,
@ -166,18 +177,40 @@ ContainerRender(Container* aContainer,
aContainer->gl()->fClear(LOCAL_GL_COLOR_BUFFER_BIT);
} else {
frameBuffer = aPreviousFrameBuffer;
#ifdef DEBUG
PRBool is2d =
#endif
transform.Is2D(&contTransform);
NS_ASSERTION(is2d, "Transform must be 2D");
}
/**
* Render this container's contents.
*/
LayerOGL *layerToRender = aContainer->GetFirstChildOGL();
while (layerToRender) {
for (LayerOGL* layerToRender = aContainer->GetFirstChildOGL();
layerToRender != nsnull;
layerToRender = GetNextSibling(layerToRender)) {
if (layerToRender->GetLayer()->GetEffectiveVisibleRegion().IsEmpty()) {
continue;
}
nsIntRect scissorRect(visibleRect);
const nsIntRect *clipRect = layerToRender->GetLayer()->GetEffectiveClipRect();
if (clipRect) {
if (clipRect->IsEmpty()) {
continue;
}
scissorRect = *clipRect;
if (!needsFramebuffer) {
gfxRect r(scissorRect.x, scissorRect.y, scissorRect.width, scissorRect.height);
gfxRect trScissor = contTransform.TransformBounds(r);
trScissor.Round();
if (!gfxUtils::GfxRectToIntRect(trScissor, &scissorRect)) {
scissorRect = visibleRect;
}
}
}
if (needsFramebuffer) {
@ -215,11 +248,6 @@ ContainerRender(Container* aContainer,
}
layerToRender->RenderLayer(frameBuffer, childOffset);
Layer *nextSibling = layerToRender->GetLayer()->GetNextSibling();
layerToRender = nextSibling ? static_cast<LayerOGL*>(nextSibling->
ImplData())
: nsnull;
}
aContainer->gl()->PopScissorRect();

View File

@ -35,7 +35,6 @@ EXPORTS = \
gfxTypes.h \
gfxTextRunCache.h \
gfxTextRunWordCache.h \
gfxThebesUtils.h \
gfxUtils.h \
gfxUserFontSet.h \
GLDefs.h \
@ -184,7 +183,6 @@ CPPSRCS = \
gfxSkipChars.cpp \
gfxTextRunCache.cpp \
gfxTextRunWordCache.cpp \
gfxThebesUtils.cpp \
gfxUserFontSet.cpp \
gfxUtils.cpp \
gfxUnicodeProperties.cpp \

View File

@ -88,8 +88,9 @@ gfxAlphaBoxBlur::Init(const gfxRect& aRect,
gfxRect skipRect = *aSkipRect;
skipRect.RoundIn();
skipRect.Inset(aBlurRadius + aSpreadRadius);
mSkipRect = gfxThebesUtils::GfxRectToIntRect(skipRect);
nsIntRect shadowIntRect = gfxThebesUtils::GfxRectToIntRect(rect);
gfxUtils::GfxRectToIntRect(skipRect, &mSkipRect);
nsIntRect shadowIntRect;
gfxUtils::GfxRectToIntRect(rect, &shadowIntRect);
mSkipRect.IntersectRect(mSkipRect, shadowIntRect);
if (mSkipRect == shadowIntRect)
return nsnull;

View File

@ -41,7 +41,8 @@
#include "gfxContext.h"
#include "gfxImageSurface.h"
#include "gfxTypes.h"
#include "gfxThebesUtils.h"
#include "gfxUtils.h"
#include "nsRect.h"
/**
* Implementation of a triple box blur approximation of a Gaussian blur.

View File

@ -265,6 +265,15 @@ public:
*/
void NudgeToIntegers(void);
/**
* Returns true if matrix is multiple of 90 degrees rotation with flipping,
* scaling and translation.
*/
PRBool PreservesAxisAlignedRectangles() const {
return ((FuzzyEqual(xx, 0.0) && FuzzyEqual(yy, 0.0))
|| (FuzzyEqual(xy, 0.0) && FuzzyEqual(yx, 0.0)));
}
private:
static PRBool FuzzyEqual(gfxFloat aV1, gfxFloat aV2) {
return fabs(aV2 - aV1) < 1e-6;

View File

@ -1,49 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is gfx thebes code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Michael Ventnor <m.ventnor@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "gfxThebesUtils.h"
// Converts a gfxRect to an nsIntRect for speed
nsIntRect
gfxThebesUtils::GfxRectToIntRect(const gfxRect& aIn)
{
nsIntRect result(PRInt32(aIn.X()), PRInt32(aIn.Y()),
PRInt32(aIn.Width()), PRInt32(aIn.Height()));
NS_ASSERTION(gfxRect(result.x, result.y, result.width, result.height) == aIn,
"The given gfxRect isn't rounded properly!");
return result;
}

View File

@ -1,53 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is gfx thebes code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Michael Ventnor <m.ventnor@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "gfxRect.h"
#include "nsRect.h"
#ifndef GFX_THEBES_UTILS_H
#define GFX_THEBES_UTILS_H
class THEBES_API gfxThebesUtils
{
public:
/**
* Converts a gfxRect into nsIntRect for speed reasons.
*/
static nsIntRect GfxRectToIntRect(const gfxRect& aIn);
};
#endif /* GFX_THEBES_UTILS_H */

View File

@ -458,3 +458,12 @@ gfxUtils::ClipToRegionSnapped(gfxContext* aContext, const nsIntRegion& aRegion)
{
ClipToRegionInternal(aContext, aRegion, PR_TRUE);
}
PRBool
gfxUtils::GfxRectToIntRect(const gfxRect& aIn, nsIntRect* aOut)
{
*aOut = nsIntRect(PRInt32(aIn.X()), PRInt32(aIn.Y()),
PRInt32(aIn.Width()), PRInt32(aIn.Height()));
return gfxRect(aOut->x, aOut->y, aOut->width, aOut->height) == aIn;
}

View File

@ -44,6 +44,7 @@
class gfxDrawable;
class nsIntRegion;
class nsIntRect;
class THEBES_API gfxUtils {
public:
@ -99,6 +100,13 @@ public:
* Convert image format to depth value
*/
static int ImageFormatToDepth(gfxASurface::gfxImageFormat aFormat);
/**
* If aIn can be represented exactly using an nsIntRect (i.e.
* integer-aligned edges and coordinates in the PRInt32 range) then we
* set aOut to that rectangle, otherwise return failure.
*/
static PRBool GfxRectToIntRect(const gfxRect& aIn, nsIntRect* aOut);
};
#endif

View File

@ -45,6 +45,7 @@
#include "nsSubDocumentFrame.h"
#include "nsCSSRendering.h"
#include "nsCSSFrameConstructor.h"
#include "gfxUtils.h"
#ifdef DEBUG
#include <stdio.h>
@ -747,7 +748,7 @@ SetVisibleRectForLayer(Layer* aLayer, const nsIntRect& aRect)
gfxRect(aRect.x, aRect.y, aRect.width, aRect.height));
layerVisible.RoundOut();
nsIntRect visibleRect;
if (NS_FAILED(nsLayoutUtils::GfxRectToIntRect(layerVisible, &visibleRect))) {
if (!gfxUtils::GfxRectToIntRect(layerVisible, &visibleRect)) {
visibleRect = nsIntRect(0, 0, 0, 0);
NS_WARNING("Visible rect transformed out of bounds");
}

View File

@ -985,15 +985,6 @@ nsLayoutUtils::InvertTransformsToRoot(nsIFrame *aFrame,
return MatrixTransformPoint(aPoint, ctm.Invert(), aFrame->PresContext()->AppUnitsPerDevPixel());
}
nsresult
nsLayoutUtils::GfxRectToIntRect(const gfxRect& aIn, nsIntRect* aOut)
{
*aOut = nsIntRect(PRInt32(aIn.X()), PRInt32(aIn.Y()),
PRInt32(aIn.Width()), PRInt32(aIn.Height()));
return gfxRect(aOut->x, aOut->y, aOut->width, aOut->height) == aIn
? NS_OK : NS_ERROR_FAILURE;
}
static nsIntPoint GetWidgetOffset(nsIWidget* aWidget, nsIWidget*& aRootWidget) {
nsIntPoint offset(0, 0);
nsIWidget* parent = aWidget->GetParent();

View File

@ -512,13 +512,6 @@ public:
*/
static nsRect RoundGfxRectToAppRect(const gfxRect &aRect, float aFactor);
/**
* If aIn can be represented exactly using an nsIntRect (i.e.
* integer-aligned edges and coordinates in the PRInt32 range) then we
* set aOut to that rectangle, otherwise return failure.
*/
static nsresult GfxRectToIntRect(const gfxRect& aIn, nsIntRect* aOut);
enum {
PAINT_IN_TRANSFORM = 0x01,
PAINT_SYNC_DECODE_IMAGES = 0x02,

View File

@ -47,6 +47,7 @@
#include "nsSVGFilterPaintCallback.h"
#include "nsSVGRect.h"
#include "nsSVGFilterInstance.h"
#include "gfxUtils.h"
nsIFrame*
NS_NewSVGFilterFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
@ -67,7 +68,7 @@ MapDeviceRectToFilterSpace(const gfxMatrix& aMatrix,
aDeviceRect->width, aDeviceRect->height));
r.RoundOut();
nsIntRect intRect;
if (NS_SUCCEEDED(nsLayoutUtils::GfxRectToIntRect(r, &intRect))) {
if (gfxUtils::GfxRectToIntRect(r, &intRect)) {
rect = intRect;
}
}
@ -236,9 +237,8 @@ TransformFilterSpaceToDeviceSpace(nsSVGFilterInstance *aInstance, nsIntRect *aRe
r = m.TransformBounds(r);
r.RoundOut();
nsIntRect deviceRect;
nsresult rv = nsLayoutUtils::GfxRectToIntRect(r, &deviceRect);
if (NS_FAILED(rv))
return rv;
if (!gfxUtils::GfxRectToIntRect(r, &deviceRect))
return NS_ERROR_FAILURE;
*aRect = deviceRect;
return NS_OK;
}

View File

@ -41,6 +41,7 @@
#include "nsSVGFilterPaintCallback.h"
#include "nsSVGFilterElement.h"
#include "nsLayoutUtils.h"
#include "gfxUtils.h"
static double Square(double aX)
{
@ -165,7 +166,7 @@ nsSVGFilterInstance::BuildSources()
gfxRect sourceBounds = UserSpaceToFilterSpace(mTargetBBox);
sourceBounds.RoundOut();
// Detect possible float->int overflow
if (NS_FAILED(nsLayoutUtils::GfxRectToIntRect(sourceBounds, &sourceBoundsInt)))
if (!gfxUtils::GfxRectToIntRect(sourceBounds, &sourceBoundsInt))
return NS_ERROR_FAILURE;
mSourceColorAlpha.mResultBoundingBox = sourceBoundsInt;
@ -356,9 +357,8 @@ nsSVGFilterInstance::BuildSourceImages()
r = m.TransformBounds(r);
r.RoundOut();
nsIntRect dirty;
nsresult rv = nsLayoutUtils::GfxRectToIntRect(r, &dirty);
if (NS_FAILED(rv))
return rv;
if (!gfxUtils::GfxRectToIntRect(r, &dirty))
return NS_ERROR_FAILURE;
// SVG graphics paint to device space, so we need to set an initial device
// space to filter space transform on the gfxContext that SourceGraphic

View File

@ -92,6 +92,7 @@
#include "prdtoa.h"
#include "mozilla/dom/Element.h"
#include "nsIDOMSVGNumberList.h"
#include "gfxUtils.h"
using namespace mozilla::dom;
@ -637,7 +638,7 @@ nsSVGUtils::FindFilterInvalidation(nsIFrame *aFrame, const nsRect& aRect)
TransformBounds(gfxRect(x, y, width, height));
bounds.RoundOut();
nsIntRect r;
if (NS_SUCCEEDED(nsLayoutUtils::GfxRectToIntRect(bounds, &r))) {
if (gfxUtils::GfxRectToIntRect(bounds, &r)) {
rect = r;
} else {
NS_NOTREACHED("Not going to invalidate the correct area");
@ -956,7 +957,7 @@ public:
gfxRect dirtyBounds = userToDeviceSpace.TransformBounds(
gfxRect(aDirtyRect->x, aDirtyRect->y, aDirtyRect->width, aDirtyRect->height));
dirtyBounds.RoundOut();
if (NS_SUCCEEDED(nsLayoutUtils::GfxRectToIntRect(dirtyBounds, &tmpDirtyRect))) {
if (gfxUtils::GfxRectToIntRect(dirtyBounds, &tmpDirtyRect)) {
dirtyRect = &tmpDirtyRect;
}
}