Bug 934183, part 2 - Remove lots of old Thebes code paths from the SVG code (GeneratePath and all the nsSVGPathGeometryElement::ConstructPath implementations). r=longsonr

This commit is contained in:
Jonathan Watt 2014-10-03 09:50:44 +01:00
Родитель 20581c3d1f
Коммит 5e385ae807
23 изменённых файлов: 2 добавлений и 450 удалений

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

@ -6,7 +6,6 @@
#include "mozilla/dom/SVGCircleElement.h"
#include "mozilla/gfx/2D.h"
#include "nsGkAtoms.h"
#include "gfxContext.h"
#include "mozilla/dom/SVGCircleElementBinding.h"
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Circle)
@ -82,17 +81,6 @@ SVGCircleElement::GetLengthInfo()
//----------------------------------------------------------------------
// nsSVGPathGeometryElement methods
void
SVGCircleElement::ConstructPath(gfxContext *aCtx)
{
float x, y, r;
GetAnimatedLengthValues(&x, &y, &r, nullptr);
if (r > 0.0f)
aCtx->Arc(gfxPoint(x, y), r, 0, 2*M_PI);
}
TemporaryRef<Path>
SVGCircleElement::BuildPath(PathBuilder* aBuilder)
{

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

@ -30,7 +30,6 @@ public:
virtual bool HasValidDimensions() const MOZ_OVERRIDE;
// nsSVGPathGeometryElement methods:
virtual void ConstructPath(gfxContext *aCtx) MOZ_OVERRIDE;
virtual TemporaryRef<Path> BuildPath(PathBuilder* aBuilder = nullptr) MOZ_OVERRIDE;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;

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

@ -8,7 +8,6 @@
#include "mozilla/gfx/2D.h"
#include "mozilla/gfx/PathHelpers.h"
#include "mozilla/RefPtr.h"
#include "gfxContext.h"
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Ellipse)
@ -93,17 +92,6 @@ SVGEllipseElement::GetLengthInfo()
//----------------------------------------------------------------------
// nsSVGPathGeometryElement methods
void
SVGEllipseElement::ConstructPath(gfxContext *aCtx)
{
RefPtr<DrawTarget> dt = aCtx->GetDrawTarget();
RefPtr<PathBuilder> builder = dt->CreatePathBuilder(aCtx->CurrentFillRule());
RefPtr<Path> path = BuildPath(builder);
if (path) {
aCtx->SetPath(path);
}
}
TemporaryRef<Path>
SVGEllipseElement::BuildPath(PathBuilder* aBuilder)
{

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

@ -30,7 +30,6 @@ public:
virtual bool HasValidDimensions() const MOZ_OVERRIDE;
// nsSVGPathGeometryElement methods:
virtual void ConstructPath(gfxContext *aCtx) MOZ_OVERRIDE;
virtual TemporaryRef<Path> BuildPath(PathBuilder* aBuilder = nullptr) MOZ_OVERRIDE;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;

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

@ -12,7 +12,6 @@
#include "nsIURI.h"
#include "nsNetUtil.h"
#include "imgINotificationObserver.h"
#include "gfxContext.h"
#include "mozilla/dom/SVGImageElementBinding.h"
#include "nsContentUtils.h"
@ -227,19 +226,6 @@ SVGImageElement::IsAttributeMapped(const nsIAtom* name) const
/* For the purposes of the update/invalidation logic pretend to
be a rectangle. */
void
SVGImageElement::ConstructPath(gfxContext *aCtx)
{
float x, y, width, height;
GetAnimatedLengthValues(&x, &y, &width, &height, nullptr);
if (width <= 0 || height <= 0)
return;
aCtx->Rectangle(gfxRect(x, y, width, height));
}
TemporaryRef<Path>
SVGImageElement::BuildPath(PathBuilder* aBuilder)
{

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

@ -53,7 +53,6 @@ public:
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* name) const MOZ_OVERRIDE;
// nsSVGPathGeometryElement methods:
virtual void ConstructPath(gfxContext *aCtx) MOZ_OVERRIDE;
virtual TemporaryRef<Path> BuildPath(PathBuilder* aBuilder = nullptr) MOZ_OVERRIDE;
// nsSVGSVGElement methods:

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

@ -6,7 +6,6 @@
#include "mozilla/dom/SVGLineElement.h"
#include "mozilla/dom/SVGLineElementBinding.h"
#include "mozilla/gfx/2D.h"
#include "gfxContext.h"
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Line)
@ -107,17 +106,6 @@ SVGLineElement::GetMarkPoints(nsTArray<nsSVGMark> *aMarks) {
aMarks->AppendElement(nsSVGMark(x2, y2, angle, nsSVGMark::eEnd));
}
void
SVGLineElement::ConstructPath(gfxContext *aCtx)
{
float x1, y1, x2, y2;
GetAnimatedLengthValues(&x1, &y1, &x2, &y2, nullptr);
aCtx->MoveTo(gfxPoint(x1, y1));
aCtx->LineTo(gfxPoint(x2, y2));
}
TemporaryRef<Path>
SVGLineElement::BuildPath(PathBuilder* aBuilder)
{

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

@ -32,7 +32,6 @@ public:
// nsSVGPathGeometryElement methods:
virtual bool IsMarkable() MOZ_OVERRIDE { return true; }
virtual void GetMarkPoints(nsTArray<nsSVGMark> *aMarks) MOZ_OVERRIDE;
virtual void ConstructPath(gfxContext *aCtx) MOZ_OVERRIDE;
virtual TemporaryRef<Path> BuildPath(PathBuilder* aBuilder = nullptr) MOZ_OVERRIDE;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const;

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

@ -19,7 +19,6 @@
#include "nsStyleConsts.h"
#include "SVGContentUtils.h"
#include "SVGPathSegUtils.h"
#include "gfxContext.h"
#include <algorithm>
using namespace mozilla;
@ -266,21 +265,6 @@ ApproximateZeroLengthSubpathSquareCaps(PathBuilder* aPB,
aPB->MoveTo(aPoint);
}
static void
ApproximateZeroLengthSubpathSquareCaps(const gfxPoint &aPoint, gfxContext *aCtx)
{
// Cairo's fixed point fractional part is 8 bits wide, so its device space
// coordinate granularity is 1/256 pixels. However, to prevent user space
// |aPoint| and |aPoint + tinyAdvance| being rounded to the same device
// coordinates, we double this for |tinyAdvance|:
const gfxSize tinyAdvance = aCtx->DeviceToUser(gfxSize(2.0/256.0, 0.0));
aCtx->MoveTo(aPoint);
aCtx->LineTo(aPoint + gfxPoint(tinyAdvance.width, tinyAdvance.height));
aCtx->MoveTo(aPoint);
}
#define MAYBE_APPROXIMATE_ZERO_LENGTH_SUBPATH_SQUARE_CAPS_TO_DT \
do { \
if (!subpathHasLength && hasLineCaps && aStrokeWidth > 0 && \
@ -291,16 +275,6 @@ ApproximateZeroLengthSubpathSquareCaps(const gfxPoint &aPoint, gfxContext *aCtx)
} \
} while(0)
#define MAYBE_APPROXIMATE_ZERO_LENGTH_SUBPATH_SQUARE_CAPS \
do { \
if (capsAreSquare && !subpathHasLength && subpathContainsNonArc && \
SVGPathSegUtils::IsValidType(prevSegType) && \
(!IsMoveto(prevSegType) || \
segType == PATHSEG_CLOSEPATH)) { \
ApproximateZeroLengthSubpathSquareCaps(segStart, aCtx); \
} \
} while(0)
TemporaryRef<Path>
SVGPathData::BuildPath(PathBuilder* builder,
uint8_t aStrokeLineCap,
@ -535,258 +509,6 @@ SVGPathData::BuildPath(PathBuilder* builder,
return builder->Finish();
}
void
SVGPathData::ConstructPath(gfxContext *aCtx) const
{
if (mData.IsEmpty() || !IsMoveto(SVGPathSegUtils::DecodeType(mData[0]))) {
return; // paths without an initial moveto are invalid
}
bool capsAreSquare = aCtx->CurrentLineCap() == gfxContext::LINE_CAP_SQUARE;
bool subpathHasLength = false; // visual length
bool subpathContainsNonArc = false;
uint32_t segType = PATHSEG_UNKNOWN;
uint32_t prevSegType = PATHSEG_UNKNOWN;
gfxPoint pathStart(0.0, 0.0); // start point of [sub]path
gfxPoint segStart(0.0, 0.0);
gfxPoint segEnd;
gfxPoint cp1, cp2; // previous bezier's control points
gfxPoint tcp1, tcp2; // temporaries
// Regarding cp1 and cp2: If the previous segment was a cubic bezier curve,
// then cp2 is its second control point. If the previous segment was a
// quadratic curve, then cp1 is its (only) control point.
uint32_t i = 0;
while (i < mData.Length()) {
segType = SVGPathSegUtils::DecodeType(mData[i++]);
uint32_t argCount = SVGPathSegUtils::ArgCountForType(segType);
switch (segType)
{
case PATHSEG_CLOSEPATH:
// set this early to allow drawing of square caps for "M{x},{y} Z":
subpathContainsNonArc = true;
MAYBE_APPROXIMATE_ZERO_LENGTH_SUBPATH_SQUARE_CAPS;
segEnd = pathStart;
aCtx->ClosePath();
break;
case PATHSEG_MOVETO_ABS:
MAYBE_APPROXIMATE_ZERO_LENGTH_SUBPATH_SQUARE_CAPS;
pathStart = segEnd = gfxPoint(mData[i], mData[i+1]);
aCtx->MoveTo(segEnd);
subpathHasLength = false;
subpathContainsNonArc = false;
break;
case PATHSEG_MOVETO_REL:
MAYBE_APPROXIMATE_ZERO_LENGTH_SUBPATH_SQUARE_CAPS;
pathStart = segEnd = segStart + gfxPoint(mData[i], mData[i+1]);
aCtx->MoveTo(segEnd);
subpathHasLength = false;
subpathContainsNonArc = false;
break;
case PATHSEG_LINETO_ABS:
segEnd = gfxPoint(mData[i], mData[i+1]);
aCtx->LineTo(segEnd);
if (!subpathHasLength) {
subpathHasLength = (segEnd != segStart);
}
subpathContainsNonArc = true;
break;
case PATHSEG_LINETO_REL:
segEnd = segStart + gfxPoint(mData[i], mData[i+1]);
aCtx->LineTo(segEnd);
if (!subpathHasLength) {
subpathHasLength = (segEnd != segStart);
}
subpathContainsNonArc = true;
break;
case PATHSEG_CURVETO_CUBIC_ABS:
cp1 = gfxPoint(mData[i], mData[i+1]);
cp2 = gfxPoint(mData[i+2], mData[i+3]);
segEnd = gfxPoint(mData[i+4], mData[i+5]);
aCtx->CurveTo(cp1, cp2, segEnd);
if (!subpathHasLength) {
subpathHasLength = (segEnd != segStart || segEnd != cp1 || segEnd != cp2);
}
subpathContainsNonArc = true;
break;
case PATHSEG_CURVETO_CUBIC_REL:
cp1 = segStart + gfxPoint(mData[i], mData[i+1]);
cp2 = segStart + gfxPoint(mData[i+2], mData[i+3]);
segEnd = segStart + gfxPoint(mData[i+4], mData[i+5]);
aCtx->CurveTo(cp1, cp2, segEnd);
if (!subpathHasLength) {
subpathHasLength = (segEnd != segStart || segEnd != cp1 || segEnd != cp2);
}
subpathContainsNonArc = true;
break;
case PATHSEG_CURVETO_QUADRATIC_ABS:
cp1 = gfxPoint(mData[i], mData[i+1]);
// Convert quadratic curve to cubic curve:
tcp1 = segStart + (cp1 - segStart) * 2 / 3;
segEnd = gfxPoint(mData[i+2], mData[i+3]); // set before setting tcp2!
tcp2 = cp1 + (segEnd - cp1) / 3;
aCtx->CurveTo(tcp1, tcp2, segEnd);
if (!subpathHasLength) {
subpathHasLength = (segEnd != segStart || segEnd != cp1);
}
subpathContainsNonArc = true;
break;
case PATHSEG_CURVETO_QUADRATIC_REL:
cp1 = segStart + gfxPoint(mData[i], mData[i+1]);
// Convert quadratic curve to cubic curve:
tcp1 = segStart + (cp1 - segStart) * 2 / 3;
segEnd = segStart + gfxPoint(mData[i+2], mData[i+3]); // set before setting tcp2!
tcp2 = cp1 + (segEnd - cp1) / 3;
aCtx->CurveTo(tcp1, tcp2, segEnd);
if (!subpathHasLength) {
subpathHasLength = (segEnd != segStart || segEnd != cp1);
}
subpathContainsNonArc = true;
break;
case PATHSEG_ARC_ABS:
case PATHSEG_ARC_REL:
{
gfxPoint radii(mData[i], mData[i+1]);
segEnd = gfxPoint(mData[i+5], mData[i+6]);
if (segType == PATHSEG_ARC_REL) {
segEnd += segStart;
}
if (segEnd != segStart) {
if (radii.x == 0.0f || radii.y == 0.0f) {
aCtx->LineTo(segEnd);
} else {
nsSVGArcConverter converter(ToPoint(segStart), ToPoint(segEnd),
ToPoint(radii), mData[i+2],
mData[i+3] != 0, mData[i+4] != 0);
Point cp1, cp2, segEnd_;
while (converter.GetNextSegment(&cp1, &cp2, &segEnd_)) {
aCtx->CurveTo(ThebesPoint(cp1), ThebesPoint(cp2), ThebesPoint(segEnd_));
}
segEnd = ThebesPoint(segEnd_);
}
}
if (!subpathHasLength) {
// Round to make sure the current comparison doesn't fail due to
// precision issues:
// XXX kill after all code is converted to float precision
segStart = ThebesPoint(ToPoint(segStart));
subpathHasLength = (segEnd != segStart);
}
break;
}
case PATHSEG_LINETO_HORIZONTAL_ABS:
segEnd = gfxPoint(mData[i], segStart.y);
aCtx->LineTo(segEnd);
if (!subpathHasLength) {
subpathHasLength = (segEnd != segStart);
}
subpathContainsNonArc = true;
break;
case PATHSEG_LINETO_HORIZONTAL_REL:
segEnd = segStart + gfxPoint(mData[i], 0.0f);
aCtx->LineTo(segEnd);
if (!subpathHasLength) {
subpathHasLength = (segEnd != segStart);
}
subpathContainsNonArc = true;
break;
case PATHSEG_LINETO_VERTICAL_ABS:
segEnd = gfxPoint(segStart.x, mData[i]);
aCtx->LineTo(segEnd);
if (!subpathHasLength) {
subpathHasLength = (segEnd != segStart);
}
subpathContainsNonArc = true;
break;
case PATHSEG_LINETO_VERTICAL_REL:
segEnd = segStart + gfxPoint(0.0f, mData[i]);
aCtx->LineTo(segEnd);
if (!subpathHasLength) {
subpathHasLength = (segEnd != segStart);
}
subpathContainsNonArc = true;
break;
case PATHSEG_CURVETO_CUBIC_SMOOTH_ABS:
cp1 = SVGPathSegUtils::IsCubicType(prevSegType) ? segStart * 2 - cp2 : segStart;
cp2 = gfxPoint(mData[i], mData[i+1]);
segEnd = gfxPoint(mData[i+2], mData[i+3]);
aCtx->CurveTo(cp1, cp2, segEnd);
if (!subpathHasLength) {
subpathHasLength = (segEnd != segStart || segEnd != cp1 || segEnd != cp2);
}
subpathContainsNonArc = true;
break;
case PATHSEG_CURVETO_CUBIC_SMOOTH_REL:
cp1 = SVGPathSegUtils::IsCubicType(prevSegType) ? segStart * 2 - cp2 : segStart;
cp2 = segStart + gfxPoint(mData[i], mData[i+1]);
segEnd = segStart + gfxPoint(mData[i+2], mData[i+3]);
aCtx->CurveTo(cp1, cp2, segEnd);
if (!subpathHasLength) {
subpathHasLength = (segEnd != segStart || segEnd != cp1 || segEnd != cp2);
}
subpathContainsNonArc = true;
break;
case PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS:
cp1 = SVGPathSegUtils::IsQuadraticType(prevSegType) ? segStart * 2 - cp1 : segStart;
// Convert quadratic curve to cubic curve:
tcp1 = segStart + (cp1 - segStart) * 2 / 3;
segEnd = gfxPoint(mData[i], mData[i+1]); // set before setting tcp2!
tcp2 = cp1 + (segEnd - cp1) / 3;
aCtx->CurveTo(tcp1, tcp2, segEnd);
if (!subpathHasLength) {
subpathHasLength = (segEnd != segStart || segEnd != cp1);
}
subpathContainsNonArc = true;
break;
case PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL:
cp1 = SVGPathSegUtils::IsQuadraticType(prevSegType) ? segStart * 2 - cp1 : segStart;
// Convert quadratic curve to cubic curve:
tcp1 = segStart + (cp1 - segStart) * 2 / 3;
segEnd = segStart + gfxPoint(mData[i], mData[i+1]); // changed before setting tcp2!
tcp2 = cp1 + (segEnd - cp1) / 3;
aCtx->CurveTo(tcp1, tcp2, segEnd);
if (!subpathHasLength) {
subpathHasLength = (segEnd != segStart || segEnd != cp1);
}
subpathContainsNonArc = true;
break;
default:
NS_NOTREACHED("Bad path segment type");
return; // according to spec we'd use everything up to the bad seg anyway
}
i += argCount;
prevSegType = segType;
segStart = segEnd;
}
NS_ABORT_IF_FALSE(i == mData.Length(), "Very, very bad - mData corrupt");
NS_ABORT_IF_FALSE(prevSegType == segType,
"prevSegType should be left at the final segType");
MAYBE_APPROXIMATE_ZERO_LENGTH_SUBPATH_SQUARE_CAPS;
}
TemporaryRef<Path>
SVGPathData::ToPathForLengthOrPositionMeasuring() const
{

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

@ -20,7 +20,6 @@
#include <string.h>
class gfxContext;
class nsSVGPathDataParser; // IWYU pragma: keep
struct nsSVGMark;
@ -166,7 +165,6 @@ public:
*/
TemporaryRef<Path> ToPathForLengthOrPositionMeasuring() const;
void ConstructPath(gfxContext *aCtx) const;
TemporaryRef<Path> BuildPath(PathBuilder* aBuilder,
uint8_t aCapStyle,
Float aStrokeWidth) const;

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

@ -22,8 +22,6 @@
#include "nsStyleStruct.h"
#include "SVGContentUtils.h"
class gfxContext;
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Path)
using namespace mozilla::gfx;
@ -334,12 +332,6 @@ SVGPathElement::GetMarkPoints(nsTArray<nsSVGMark> *aMarks)
mD.GetAnimValue().GetMarkerPositioningData(aMarks);
}
void
SVGPathElement::ConstructPath(gfxContext *aCtx)
{
mD.GetAnimValue().ConstructPath(aCtx);
}
float
SVGPathElement::GetPathLengthScale(PathLengthScaleForType aFor)
{

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

@ -16,8 +16,6 @@
nsresult NS_NewSVGPathElement(nsIContent **aResult,
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
class gfxContext;
typedef nsSVGPathGeometryElement SVGPathElementBase;
namespace mozilla {
@ -52,7 +50,6 @@ public:
virtual bool AttributeDefinesGeometry(const nsIAtom *aName) MOZ_OVERRIDE;
virtual bool IsMarkable() MOZ_OVERRIDE;
virtual void GetMarkPoints(nsTArray<nsSVGMark> *aMarks) MOZ_OVERRIDE;
virtual void ConstructPath(gfxContext *aCtx) MOZ_OVERRIDE;
virtual TemporaryRef<Path> BuildPath(PathBuilder* aBuilder = nullptr) MOZ_OVERRIDE;
/**

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

@ -8,7 +8,6 @@
#include "SVGPathSegUtils.h"
#include "gfx2DGlue.h"
#include "gfxPoint.h"
#include "nsSVGPathDataParser.h"
#include "nsTextFormatter.h"

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

@ -5,7 +5,6 @@
#include "mozilla/dom/SVGPolygonElement.h"
#include "mozilla/dom/SVGPolygonElementBinding.h"
#include "gfxContext.h"
#include "SVGContentUtils.h"
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Polygon)
@ -58,14 +57,5 @@ SVGPolygonElement::GetMarkPoints(nsTArray<nsSVGMark> *aMarks)
nsSVGMark::eEnd));
}
void
SVGPolygonElement::ConstructPath(gfxContext *aCtx)
{
SVGPolygonElementBase::ConstructPath(aCtx);
// the difference between a polyline and a polygon is that the
// polygon is closed:
aCtx->ClosePath();
}
} // namespace dom
} // namespace mozilla

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

@ -28,7 +28,6 @@ protected:
public:
// nsSVGPathGeometryElement methods:
virtual void GetMarkPoints(nsTArray<nsSVGMark> *aMarks) MOZ_OVERRIDE;
virtual void ConstructPath(gfxContext *aCtx) MOZ_OVERRIDE;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const;
};

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

@ -5,7 +5,6 @@
#include "mozilla/dom/SVGRectElement.h"
#include "nsGkAtoms.h"
#include "gfxContext.h"
#include "mozilla/dom/SVGRectElementBinding.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/gfx/PathHelpers.h"
@ -109,49 +108,6 @@ SVGRectElement::GetLengthInfo()
//----------------------------------------------------------------------
// nsSVGPathGeometryElement methods
void
SVGRectElement::ConstructPath(gfxContext *aCtx)
{
float x, y, width, height, rx, ry;
GetAnimatedLengthValues(&x, &y, &width, &height, &rx, &ry, nullptr);
/* In a perfect world, this would be handled by the DOM, and
return a DOM exception. */
if (width <= 0 || height <= 0)
return;
rx = std::max(rx, 0.0f);
ry = std::max(ry, 0.0f);
/* optimize the no rounded corners case */
if (rx == 0 && ry == 0) {
aCtx->Rectangle(gfxRect(x, y, width, height));
return;
}
/* If either the 'rx' or the 'ry' attribute isn't set, then we
have to set it to the value of the other. */
bool hasRx = mLengthAttributes[ATTR_RX].IsExplicitlySet();
bool hasRy = mLengthAttributes[ATTR_RY].IsExplicitlySet();
if (hasRx && !hasRy)
ry = rx;
else if (hasRy && !hasRx)
rx = ry;
/* Clamp rx and ry to half the rect's width and height respectively. */
float halfWidth = width/2;
float halfHeight = height/2;
if (rx > halfWidth)
rx = halfWidth;
if (ry > halfHeight)
ry = halfHeight;
gfxSize corner(rx, ry);
aCtx->RoundedRectangle(gfxRect(x, y, width, height),
gfxCornerSizes(corner, corner, corner, corner));
}
TemporaryRef<Path>
SVGRectElement::BuildPath(PathBuilder* aBuilder)
{

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

@ -30,7 +30,6 @@ public:
virtual bool HasValidDimensions() const MOZ_OVERRIDE;
// nsSVGPathGeometryElement methods:
virtual void ConstructPath(gfxContext *aCtx) MOZ_OVERRIDE;
virtual TemporaryRef<Path> BuildPath(PathBuilder* aBuilder = nullptr) MOZ_OVERRIDE;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;

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

@ -26,8 +26,6 @@ struct nsSVGMark {
x(aX), y(aY), angle(aAngle), type(aType) {}
};
class gfxContext;
typedef mozilla::dom::SVGGraphicsElement nsSVGPathGeometryElementBase;
class nsSVGPathGeometryElement : public nsSVGPathGeometryElementBase
@ -56,7 +54,6 @@ public:
virtual bool IsMarkable();
virtual void GetMarkPoints(nsTArray<nsSVGMark> *aMarks);
virtual void ConstructPath(gfxContext *aCtx) = 0;
/**
* Returns a Path that can be used to paint, hit-test or calculate bounds for

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

@ -5,7 +5,6 @@
#include "nsSVGPolyElement.h"
#include "DOMSVGPointList.h"
#include "gfxContext.h"
#include "mozilla/gfx/2D.h"
#include "SVGContentUtils.h"
@ -121,20 +120,6 @@ nsSVGPolyElement::GetMarkPoints(nsTArray<nsSVGMark> *aMarks)
aMarks->LastElement().type = nsSVGMark::eEnd;
}
void
nsSVGPolyElement::ConstructPath(gfxContext *aCtx)
{
const SVGPointList &points = mPoints.GetAnimValue();
if (!points.Length())
return;
aCtx->MoveTo(points[0]);
for (uint32_t i = 1; i < points.Length(); ++i) {
aCtx->LineTo(points[i]);
}
}
TemporaryRef<Path>
nsSVGPolyElement::BuildPath(PathBuilder* aBuilder)
{

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

@ -12,8 +12,6 @@
typedef nsSVGPathGeometryElement nsSVGPolyElementBase;
class gfxContext;
namespace mozilla {
class DOMSVGPointList;
}
@ -47,7 +45,6 @@ public:
virtual bool AttributeDefinesGeometry(const nsIAtom *aName) MOZ_OVERRIDE;
virtual bool IsMarkable() MOZ_OVERRIDE { return true; }
virtual void GetMarkPoints(nsTArray<nsSVGMark> *aMarks) MOZ_OVERRIDE;
virtual void ConstructPath(gfxContext *aCtx) MOZ_OVERRIDE;
virtual mozilla::TemporaryRef<Path> BuildPath(PathBuilder* aBuilder = nullptr) MOZ_OVERRIDE;
// WebIDL

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

@ -114,9 +114,9 @@ nsSVGTransform::SetRotate(float aAngle, float aCx, float aCy)
{
mType = SVG_TRANSFORM_ROTATE;
mMatrix.Reset();
mMatrix.Translate(gfxPoint(aCx, aCy));
mMatrix.Translate(aCx, aCy);
mMatrix.Rotate(aAngle*kRadPerDegree);
mMatrix.Translate(gfxPoint(-aCx, -aCy));
mMatrix.Translate(-aCx, -aCy);
mAngle = aAngle;
mOriginX = aCx;
mOriginY = aCy;

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

@ -755,30 +755,6 @@ nsSVGPathGeometryFrame::Render(gfxContext* aContext,
}
}
void
nsSVGPathGeometryFrame::GeneratePath(gfxContext* aContext,
const Matrix &aTransform)
{
if (aTransform.IsSingular()) {
aContext->SetMatrix(gfxMatrix());
aContext->NewPath();
return;
}
aContext->SetMatrix(
aContext->CurrentMatrix().PreMultiply(ThebesMatrix(aTransform)).
NudgeToIntegers());
// Hack to let SVGPathData::ConstructPath know if we have square caps:
const nsStyleSVG* style = StyleSVG();
if (style->mStrokeLinecap == NS_STYLE_STROKE_LINECAP_SQUARE) {
aContext->SetLineCap(gfxContext::LINE_CAP_SQUARE);
}
aContext->NewPath();
static_cast<nsSVGPathGeometryElement*>(mContent)->ConstructPath(aContext);
}
void
nsSVGPathGeometryFrame::PaintMarkers(nsRenderingContext* aContext,
const gfxMatrix& aTransform)

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

@ -111,7 +111,6 @@ protected:
uint32_t aFlags) MOZ_OVERRIDE;
virtual bool IsDisplayContainer() MOZ_OVERRIDE { return false; }
void GeneratePath(gfxContext *aContext, const Matrix &aTransform);
/**
* This function returns a set of bit flags indicating which parts of the
* element (fill, stroke, bounds) should intercept pointer events. It takes