Bug 689416 - Stop using intermediate layers to render 3d transforms. r=roc

This commit is contained in:
Matt Woodrow 2011-10-07 10:29:07 +13:00
Родитель 88852e4279
Коммит d281b3df0b
4 изменённых файлов: 21 добавлений и 9 удалений

Просмотреть файл

@ -444,6 +444,7 @@ ContainerLayer::DefaultComputeEffectiveTransforms(const gfx3DMatrix& aTransformT
{
gfxMatrix residual;
gfx3DMatrix idealTransform = GetLocalTransform()*aTransformToSurface;
idealTransform.ProjectTo2D();
mEffectiveTransform = SnapTransform(idealTransform, gfxRect(0, 0, 0, 0), &residual);
bool useIntermediateSurface;
@ -453,9 +454,7 @@ ContainerLayer::DefaultComputeEffectiveTransforms(const gfx3DMatrix& aTransformT
} else {
useIntermediateSurface = PR_FALSE;
gfxMatrix contTransform;
if (!mEffectiveTransform.Is2D(&contTransform)) {
useIntermediateSurface = PR_TRUE;
} else if (
if (!mEffectiveTransform.Is2D(&contTransform) ||
#ifdef MOZ_GFX_OPTIMIZE_MOBILE
!contTransform.PreservesAxisAlignedRectangles()) {
#else

Просмотреть файл

@ -175,7 +175,6 @@ ContainerRender(Container* aContainer,
float opacity = aContainer->GetEffectiveOpacity();
const gfx3DMatrix& transform = aContainer->GetEffectiveTransform();
bool needsFramebuffer = aContainer->UseIntermediateSurface();
gfxMatrix contTransform;
if (needsFramebuffer) {
LayerManagerOGL::InitMode mode = LayerManagerOGL::InitModeClear;
nsIntRect framebufferRect = visibleRect;
@ -213,11 +212,6 @@ ContainerRender(Container* aContainer,
frameBuffer = aPreviousFrameBuffer;
aContainer->mSupportsComponentAlphaChildren = (aContainer->GetContentFlags() & Layer::CONTENT_OPAQUE) ||
(aContainer->GetParent() && aContainer->GetParent()->SupportsComponentAlphaChildren());
#ifdef DEBUG
bool is2d =
#endif
transform.Is2D(&contTransform);
NS_ASSERTION(is2d, "Transform must be 2D");
}
nsAutoTArray<Layer*, 12> children;

Просмотреть файл

@ -730,6 +730,19 @@ gfx3DMatrix::CanDraw2D(gfxMatrix* aMatrix) const
return PR_TRUE;
}
gfx3DMatrix&
gfx3DMatrix::ProjectTo2D()
{
_31 = 0.0f;
_32 = 0.0f;
_13 = 0.0f;
_23 = 0.0f;
_33 = 1.0f;
_43 = 0.0f;
_34 = 0.0f;
return *this;
}
gfxPoint gfx3DMatrix::ProjectPoint(const gfxPoint& aPoint) const
{
// Define a ray of the form P + Ut where t is a real number

Просмотреть файл

@ -121,6 +121,12 @@ public:
*/
bool CanDraw2D(gfxMatrix* aMatrix = nsnull) const;
/**
* Converts the matrix to one that doesn't modify the z coordinate of points,
* but leaves the rest of the transformation unchanged.
*/
gfx3DMatrix& ProjectTo2D();
/**
* Returns true if the matrix is the identity matrix. The most important
* property we require is that gfx3DMatrix().IsIdentity() returns true.