mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 984280 - Convert DOMSVGPoint from Thebes to Moz2d. r=heycam
This commit is contained in:
parent
831522a3e6
commit
c47047aab1
@ -6,6 +6,7 @@
|
|||||||
#include "DOMSVGPoint.h"
|
#include "DOMSVGPoint.h"
|
||||||
#include "DOMSVGPointList.h"
|
#include "DOMSVGPointList.h"
|
||||||
#include "SVGPoint.h"
|
#include "SVGPoint.h"
|
||||||
|
#include "gfx2DGlue.h"
|
||||||
#include "nsSVGElement.h"
|
#include "nsSVGElement.h"
|
||||||
#include "nsError.h"
|
#include "nsError.h"
|
||||||
#include "mozilla/dom/SVGMatrix.h"
|
#include "mozilla/dom/SVGMatrix.h"
|
||||||
@ -13,6 +14,7 @@
|
|||||||
// See the architecture comment in DOMSVGPointList.h.
|
// See the architecture comment in DOMSVGPointList.h.
|
||||||
|
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
|
using namespace mozilla::gfx;
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
@ -112,7 +114,7 @@ DOMSVGPoint::MatrixTransform(dom::SVGMatrix& matrix)
|
|||||||
float x = HasOwner() ? InternalItem().mX : mPt.mX;
|
float x = HasOwner() ? InternalItem().mX : mPt.mX;
|
||||||
float y = HasOwner() ? InternalItem().mY : mPt.mY;
|
float y = HasOwner() ? InternalItem().mY : mPt.mY;
|
||||||
|
|
||||||
gfxPoint pt = matrix.GetMatrix().Transform(gfxPoint(x, y));
|
Point pt = ToMatrix(matrix.GetMatrix()) * Point(x, y);
|
||||||
nsCOMPtr<nsISVGPoint> newPoint = new DOMSVGPoint(pt);
|
nsCOMPtr<nsISVGPoint> newPoint = new DOMSVGPoint(pt);
|
||||||
return newPoint.forget();
|
return newPoint.forget();
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
#define MOZILLA_DOMSVGPOINT_H__
|
#define MOZILLA_DOMSVGPOINT_H__
|
||||||
|
|
||||||
#include "DOMSVGPointList.h"
|
#include "DOMSVGPointList.h"
|
||||||
#include "gfxPoint.h"
|
|
||||||
#include "mozilla/gfx/2D.h"
|
#include "mozilla/gfx/2D.h"
|
||||||
#include "nsAutoPtr.h"
|
#include "nsAutoPtr.h"
|
||||||
#include "nsDebug.h"
|
#include "nsDebug.h"
|
||||||
@ -87,15 +86,6 @@ public:
|
|||||||
"DOMSVGPoint coords are not finite");
|
"DOMSVGPoint coords are not finite");
|
||||||
}
|
}
|
||||||
|
|
||||||
explicit DOMSVGPoint(const gfxPoint &aPt)
|
|
||||||
: nsISVGPoint()
|
|
||||||
{
|
|
||||||
mPt.mX = float(aPt.x);
|
|
||||||
mPt.mY = float(aPt.y);
|
|
||||||
NS_ASSERTION(NS_finite(mPt.mX) && NS_finite(mPt.mX),
|
|
||||||
"DOMSVGPoint coords are not finite");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// WebIDL
|
// WebIDL
|
||||||
virtual float X();
|
virtual float X();
|
||||||
|
@ -4152,7 +4152,8 @@ SVGTextFrame::GetStartPositionOfChar(nsIContent* aContent,
|
|||||||
// We need to return the start position of the whole glyph.
|
// We need to return the start position of the whole glyph.
|
||||||
uint32_t startIndex = it.GlyphStartTextElementCharIndex();
|
uint32_t startIndex = it.GlyphStartTextElementCharIndex();
|
||||||
|
|
||||||
NS_ADDREF(*aResult = new DOMSVGPoint(mPositions[startIndex].mPosition));
|
NS_ADDREF(*aResult =
|
||||||
|
new DOMSVGPoint(ToPoint(mPositions[startIndex].mPosition)));
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4184,10 +4185,10 @@ SVGTextFrame::GetEndPositionOfChar(nsIContent* aContent,
|
|||||||
|
|
||||||
// The end position is the start position plus the advance in the direction
|
// The end position is the start position plus the advance in the direction
|
||||||
// of the glyph's rotation.
|
// of the glyph's rotation.
|
||||||
gfxMatrix m;
|
Matrix m =
|
||||||
m.Translate(mPositions[startIndex].mPosition);
|
Matrix::Rotation(mPositions[startIndex].mAngle) *
|
||||||
m.Rotate(mPositions[startIndex].mAngle);
|
Matrix::Translation(ToPoint(mPositions[startIndex].mPosition));
|
||||||
gfxPoint p = m.Transform(gfxPoint(advance / mFontSizeScaleFactor, 0));
|
Point p = m * Point(advance / mFontSizeScaleFactor, 0);
|
||||||
|
|
||||||
NS_ADDREF(*aResult = new DOMSVGPoint(p));
|
NS_ADDREF(*aResult = new DOMSVGPoint(p));
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
Loading…
Reference in New Issue
Block a user