Bug 952977: Switch SetAnimateMotionTransform to gfx::Matrix r=nical

This commit is contained in:
David Zbarsky 2013-12-28 16:37:40 -05:00
parent bc3a02bf90
commit d57142d56d
4 changed files with 17 additions and 10 deletions

View File

@ -11,6 +11,7 @@
#include "nsSMILValue.h"
#include "nsDebug.h"
#include "nsSVGElement.h"
#include "gfx2DGlue.h"
namespace mozilla {
@ -40,7 +41,7 @@ SVGMotionSMILAttr::ClearAnimValue()
nsresult
SVGMotionSMILAttr::SetAnimValue(const nsSMILValue& aValue)
{
gfxMatrix matrix = SVGMotionSMILType::CreateMatrix(aValue);
gfx::Matrix matrix = gfx::ToMatrix(SVGMotionSMILType::CreateMatrix(aValue));
mSVGElement->SetAnimateMotionTransform(&matrix);
return NS_OK;
}

View File

@ -109,7 +109,7 @@ SVGTransformableElement::PrependLocalTransformsTo(const gfxMatrix &aMatrix,
// any transformations from the |transform| attribute. So since we're
// PRE-multiplying, we need to apply the animateMotion transform *first*.
if (mAnimateMotionTransform) {
result.PreMultiply(*mAnimateMotionTransform);
result.PreMultiply(ThebesMatrix(*mAnimateMotionTransform));
}
if (mTransforms) {
@ -119,20 +119,20 @@ SVGTransformableElement::PrependLocalTransformsTo(const gfxMatrix &aMatrix,
return result;
}
const gfxMatrix*
const gfx::Matrix*
SVGTransformableElement::GetAnimateMotionTransform() const
{
return mAnimateMotionTransform.get();
}
void
SVGTransformableElement::SetAnimateMotionTransform(const gfxMatrix* aMatrix)
SVGTransformableElement::SetAnimateMotionTransform(const gfx::Matrix* aMatrix)
{
if ((!aMatrix && !mAnimateMotionTransform) ||
(aMatrix && mAnimateMotionTransform && *aMatrix == *mAnimateMotionTransform)) {
return;
}
mAnimateMotionTransform = aMatrix ? new gfxMatrix(*aMatrix) : nullptr;
mAnimateMotionTransform = aMatrix ? new gfx::Matrix(*aMatrix) : nullptr;
DidAnimateTransformList();
nsIFrame* frame = GetPrimaryFrame();
if (frame) {

View File

@ -10,6 +10,7 @@
#include "nsSVGAnimatedTransformList.h"
#include "nsSVGElement.h"
#include "gfxMatrix.h"
#include "mozilla/gfx/Matrix.h"
namespace mozilla {
namespace dom {
@ -50,8 +51,8 @@ public:
virtual gfxMatrix PrependLocalTransformsTo(const gfxMatrix &aMatrix,
TransformTypes aWhich = eAllTransforms) const MOZ_OVERRIDE;
virtual const gfxMatrix* GetAnimateMotionTransform() const MOZ_OVERRIDE;
virtual void SetAnimateMotionTransform(const gfxMatrix* aMatrix) MOZ_OVERRIDE;
virtual const gfx::Matrix* GetAnimateMotionTransform() const MOZ_OVERRIDE;
virtual void SetAnimateMotionTransform(const gfx::Matrix* aMatrix) MOZ_OVERRIDE;
virtual nsSVGAnimatedTransformList*
GetAnimatedTransformList(uint32_t aFlags = 0) MOZ_OVERRIDE;
@ -67,7 +68,7 @@ protected:
nsAutoPtr<nsSVGAnimatedTransformList> mTransforms;
// XXX maybe move this to property table, to save space on un-animated elems?
nsAutoPtr<gfxMatrix> mAnimateMotionTransform;
nsAutoPtr<gfx::Matrix> mAnimateMotionTransform;
};
} // namespace dom

View File

@ -57,6 +57,11 @@ class SVGAnimatedPreserveAspectRatio;
class nsSVGAnimatedTransformList;
class SVGStringList;
class DOMSVGStringList;
namespace gfx {
class Matrix;
}
}
struct gfxMatrix;
@ -168,8 +173,8 @@ public:
// Setter for to set the current <animateMotion> transformation
// Only visible for nsSVGGraphicElement, so it's a no-op here, and that
// subclass has the useful implementation.
virtual void SetAnimateMotionTransform(const gfxMatrix* aMatrix) {/*no-op*/}
virtual const gfxMatrix* GetAnimateMotionTransform() const { return nullptr; }
virtual void SetAnimateMotionTransform(const mozilla::gfx::Matrix* aMatrix) {/*no-op*/}
virtual const mozilla::gfx::Matrix* GetAnimateMotionTransform() const { return nullptr; }
bool IsStringAnimatable(uint8_t aAttrEnum) {
return GetStringInfo().mStringInfo[aAttrEnum].mIsAnimatable;