change all patheffect methods to const, in preparation for marking its
subclasses as immutable/re-entrant safe. Review URL: https://codereview.appspot.com/6949071 git-svn-id: http://skia.googlecode.com/svn/trunk@6877 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
78c0c30987
commit
548a1f3210
@ -48,13 +48,14 @@ public:
|
|||||||
* If this method returns true, the caller will apply (as needed) the
|
* If this method returns true, the caller will apply (as needed) the
|
||||||
* resulting stroke-rec to dst and then draw.
|
* resulting stroke-rec to dst and then draw.
|
||||||
*/
|
*/
|
||||||
virtual bool filterPath(SkPath* dst, const SkPath& src, SkStrokeRec*) = 0;
|
virtual bool filterPath(SkPath* dst, const SkPath& src,
|
||||||
|
SkStrokeRec*) const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compute a conservative bounds for its effect, given the src bounds.
|
* Compute a conservative bounds for its effect, given the src bounds.
|
||||||
* The baseline implementation just assigns src to dst.
|
* The baseline implementation just assigns src to dst.
|
||||||
*/
|
*/
|
||||||
virtual void computeFastBounds(SkRect* dst, const SkRect& src);
|
virtual void computeFastBounds(SkRect* dst, const SkRect& src) const;
|
||||||
|
|
||||||
/** \class PointData
|
/** \class PointData
|
||||||
|
|
||||||
@ -152,7 +153,8 @@ public:
|
|||||||
SkComposePathEffect(SkPathEffect* outer, SkPathEffect* inner)
|
SkComposePathEffect(SkPathEffect* outer, SkPathEffect* inner)
|
||||||
: INHERITED(outer, inner) {}
|
: INHERITED(outer, inner) {}
|
||||||
|
|
||||||
virtual bool filterPath(SkPath* dst, const SkPath& src, SkStrokeRec*) SK_OVERRIDE;
|
virtual bool filterPath(SkPath* dst, const SkPath& src,
|
||||||
|
SkStrokeRec*) const SK_OVERRIDE;
|
||||||
|
|
||||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposePathEffect)
|
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposePathEffect)
|
||||||
|
|
||||||
@ -182,7 +184,8 @@ public:
|
|||||||
SkSumPathEffect(SkPathEffect* first, SkPathEffect* second)
|
SkSumPathEffect(SkPathEffect* first, SkPathEffect* second)
|
||||||
: INHERITED(first, second) {}
|
: INHERITED(first, second) {}
|
||||||
|
|
||||||
virtual bool filterPath(SkPath* dst, const SkPath& src, SkStrokeRec*) SK_OVERRIDE;
|
virtual bool filterPath(SkPath* dst, const SkPath& src,
|
||||||
|
SkStrokeRec*) const SK_OVERRIDE;
|
||||||
|
|
||||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkSumPathEffect)
|
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkSumPathEffect)
|
||||||
|
|
||||||
|
@ -16,19 +16,20 @@ class SkPathMeasure;
|
|||||||
// This class is not exported to java.
|
// This class is not exported to java.
|
||||||
class SK_API Sk1DPathEffect : public SkPathEffect {
|
class SK_API Sk1DPathEffect : public SkPathEffect {
|
||||||
public:
|
public:
|
||||||
virtual bool filterPath(SkPath* dst, const SkPath& src, SkStrokeRec*) SK_OVERRIDE;
|
virtual bool filterPath(SkPath* dst, const SkPath& src,
|
||||||
|
SkStrokeRec*) const SK_OVERRIDE;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** Called at the start of each contour, returns the initial offset
|
/** Called at the start of each contour, returns the initial offset
|
||||||
into that contour.
|
into that contour.
|
||||||
*/
|
*/
|
||||||
virtual SkScalar begin(SkScalar contourLength) = 0;
|
virtual SkScalar begin(SkScalar contourLength) const = 0;
|
||||||
/** Called with the current distance along the path, with the current matrix
|
/** Called with the current distance along the path, with the current matrix
|
||||||
for the point/tangent at the specified distance.
|
for the point/tangent at the specified distance.
|
||||||
Return the distance to travel for the next call. If return <= 0, then that
|
Return the distance to travel for the next call. If return <= 0, then that
|
||||||
contour is done.
|
contour is done.
|
||||||
*/
|
*/
|
||||||
virtual SkScalar next(SkPath* dst, SkScalar distance, SkPathMeasure&) = 0;
|
virtual SkScalar next(SkPath* dst, SkScalar dist, SkPathMeasure&) const = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef SkPathEffect INHERITED;
|
typedef SkPathEffect INHERITED;
|
||||||
@ -53,7 +54,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
SkPath1DPathEffect(const SkPath& path, SkScalar advance, SkScalar phase, Style);
|
SkPath1DPathEffect(const SkPath& path, SkScalar advance, SkScalar phase, Style);
|
||||||
|
|
||||||
virtual bool filterPath(SkPath*, const SkPath&, SkStrokeRec*) SK_OVERRIDE;
|
virtual bool filterPath(SkPath*, const SkPath&,
|
||||||
|
SkStrokeRec*) const SK_OVERRIDE;
|
||||||
|
|
||||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPath1DPathEffect)
|
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPath1DPathEffect)
|
||||||
|
|
||||||
@ -62,8 +64,8 @@ protected:
|
|||||||
virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE;
|
virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE;
|
||||||
|
|
||||||
// overrides from Sk1DPathEffect
|
// overrides from Sk1DPathEffect
|
||||||
virtual SkScalar begin(SkScalar contourLength) SK_OVERRIDE;
|
virtual SkScalar begin(SkScalar contourLength) const SK_OVERRIDE;
|
||||||
virtual SkScalar next(SkPath*, SkScalar distance, SkPathMeasure&) SK_OVERRIDE;
|
virtual SkScalar next(SkPath*, SkScalar, SkPathMeasure&) const SK_OVERRIDE;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SkPath fPath; // copied from constructor
|
SkPath fPath; // copied from constructor
|
||||||
|
@ -16,8 +16,8 @@ class SK_API Sk2DPathEffect : public SkPathEffect {
|
|||||||
public:
|
public:
|
||||||
Sk2DPathEffect(const SkMatrix& mat);
|
Sk2DPathEffect(const SkMatrix& mat);
|
||||||
|
|
||||||
// overrides
|
virtual bool filterPath(SkPath*, const SkPath&,
|
||||||
virtual bool filterPath(SkPath*, const SkPath&, SkStrokeRec*) SK_OVERRIDE;
|
SkStrokeRec*) const SK_OVERRIDE;
|
||||||
|
|
||||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Sk2DPathEffect)
|
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Sk2DPathEffect)
|
||||||
|
|
||||||
@ -28,15 +28,15 @@ protected:
|
|||||||
next() will receive u and v values within these bounds,
|
next() will receive u and v values within these bounds,
|
||||||
and then a call to end() will signal the end of processing.
|
and then a call to end() will signal the end of processing.
|
||||||
*/
|
*/
|
||||||
virtual void begin(const SkIRect& uvBounds, SkPath* dst);
|
virtual void begin(const SkIRect& uvBounds, SkPath* dst) const;
|
||||||
virtual void next(const SkPoint& loc, int u, int v, SkPath* dst);
|
virtual void next(const SkPoint& loc, int u, int v, SkPath* dst) const;
|
||||||
virtual void end(SkPath* dst);
|
virtual void end(SkPath* dst) const;
|
||||||
|
|
||||||
/** Low-level virtual called per span of locations in the u-direction.
|
/** Low-level virtual called per span of locations in the u-direction.
|
||||||
The default implementation calls next() repeatedly with each
|
The default implementation calls next() repeatedly with each
|
||||||
location.
|
location.
|
||||||
*/
|
*/
|
||||||
virtual void nextSpan(int u, int v, int ucount, SkPath* dst);
|
virtual void nextSpan(int u, int v, int ucount, SkPath* dst) const;
|
||||||
|
|
||||||
const SkMatrix& getMatrix() const { return fMatrix; }
|
const SkMatrix& getMatrix() const { return fMatrix; }
|
||||||
|
|
||||||
@ -61,12 +61,13 @@ public:
|
|||||||
SkLine2DPathEffect(SkScalar width, const SkMatrix& matrix)
|
SkLine2DPathEffect(SkScalar width, const SkMatrix& matrix)
|
||||||
: Sk2DPathEffect(matrix), fWidth(width) {}
|
: Sk2DPathEffect(matrix), fWidth(width) {}
|
||||||
|
|
||||||
virtual bool filterPath(SkPath* dst, const SkPath& src, SkStrokeRec* rec) SK_OVERRIDE;
|
virtual bool filterPath(SkPath* dst, const SkPath& src,
|
||||||
|
SkStrokeRec*) const SK_OVERRIDE;
|
||||||
|
|
||||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLine2DPathEffect)
|
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLine2DPathEffect)
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void nextSpan(int u, int v, int ucount, SkPath* dst) SK_OVERRIDE;
|
virtual void nextSpan(int u, int v, int ucount, SkPath*) const SK_OVERRIDE;
|
||||||
|
|
||||||
SkLine2DPathEffect(SkFlattenableReadBuffer&);
|
SkLine2DPathEffect(SkFlattenableReadBuffer&);
|
||||||
|
|
||||||
@ -92,7 +93,7 @@ protected:
|
|||||||
SkPath2DPathEffect(SkFlattenableReadBuffer& buffer);
|
SkPath2DPathEffect(SkFlattenableReadBuffer& buffer);
|
||||||
virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE;
|
virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE;
|
||||||
|
|
||||||
virtual void next(const SkPoint&, int u, int v, SkPath* dst) SK_OVERRIDE;
|
virtual void next(const SkPoint&, int u, int v, SkPath*) const SK_OVERRIDE;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SkPath fPath;
|
SkPath fPath;
|
||||||
|
@ -23,9 +23,8 @@ public:
|
|||||||
SkCornerPathEffect(SkScalar radius);
|
SkCornerPathEffect(SkScalar radius);
|
||||||
virtual ~SkCornerPathEffect();
|
virtual ~SkCornerPathEffect();
|
||||||
|
|
||||||
// overrides for SkPathEffect
|
virtual bool filterPath(SkPath* dst, const SkPath& src,
|
||||||
// This method is not exported to java.
|
SkStrokeRec*) const SK_OVERRIDE;
|
||||||
virtual bool filterPath(SkPath* dst, const SkPath& src, SkStrokeRec*) SK_OVERRIDE;
|
|
||||||
|
|
||||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkCornerPathEffect)
|
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkCornerPathEffect)
|
||||||
|
|
||||||
|
@ -36,17 +36,18 @@ public:
|
|||||||
|
|
||||||
Note: only affects stroked paths.
|
Note: only affects stroked paths.
|
||||||
*/
|
*/
|
||||||
SkDashPathEffect(const SkScalar intervals[], int count, SkScalar phase, bool scaleToFit = false);
|
SkDashPathEffect(const SkScalar intervals[], int count, SkScalar phase,
|
||||||
|
bool scaleToFit = false);
|
||||||
virtual ~SkDashPathEffect();
|
virtual ~SkDashPathEffect();
|
||||||
|
|
||||||
virtual bool filterPath(SkPath* dst, const SkPath& src, SkStrokeRec*) SK_OVERRIDE;
|
virtual bool filterPath(SkPath* dst, const SkPath& src,
|
||||||
|
SkStrokeRec*) const SK_OVERRIDE;
|
||||||
|
|
||||||
virtual bool asPoints(PointData* results, const SkPath& src,
|
virtual bool asPoints(PointData* results, const SkPath& src,
|
||||||
const SkStrokeRec&, const SkMatrix&) const SK_OVERRIDE;
|
const SkStrokeRec&, const SkMatrix&) const SK_OVERRIDE;
|
||||||
|
|
||||||
// overrides for SkFlattenable
|
virtual Factory getFactory() SK_OVERRIDE;
|
||||||
// This method is not exported to java.
|
|
||||||
virtual Factory getFactory();
|
|
||||||
static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
|
static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -22,7 +22,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
SkDiscretePathEffect(SkScalar segLength, SkScalar deviation);
|
SkDiscretePathEffect(SkScalar segLength, SkScalar deviation);
|
||||||
|
|
||||||
virtual bool filterPath(SkPath* dst, const SkPath& src, SkStrokeRec*) SK_OVERRIDE;
|
virtual bool filterPath(SkPath* dst, const SkPath& src,
|
||||||
|
SkStrokeRec*) const SK_OVERRIDE;
|
||||||
|
|
||||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDiscretePathEffect)
|
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDiscretePathEffect)
|
||||||
|
|
||||||
|
@ -74,26 +74,26 @@ public:
|
|||||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Dot2DPathEffect)
|
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Dot2DPathEffect)
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void begin(const SkIRect& uvBounds, SkPath* dst) {
|
virtual void begin(const SkIRect& uvBounds, SkPath* dst) const SK_OVERRIDE {
|
||||||
if (fPts) {
|
if (fPts) {
|
||||||
fPts->reset();
|
fPts->reset();
|
||||||
}
|
}
|
||||||
this->INHERITED::begin(uvBounds, dst);
|
this->INHERITED::begin(uvBounds, dst);
|
||||||
}
|
}
|
||||||
// virtual void end(SkPath* dst) {}
|
|
||||||
virtual void next(const SkPoint& loc, int u, int v, SkPath* dst)
|
virtual void next(const SkPoint& loc, int u, int v,
|
||||||
{
|
SkPath* dst) const SK_OVERRIDE {
|
||||||
if (fPts) {
|
if (fPts) {
|
||||||
*fPts->append() = loc;
|
*fPts->append() = loc;
|
||||||
}
|
}
|
||||||
dst->addCircle(loc.fX, loc.fY, fRadius);
|
dst->addCircle(loc.fX, loc.fY, fRadius);
|
||||||
}
|
}
|
||||||
|
|
||||||
Dot2DPathEffect(SkFlattenableReadBuffer& buffer) : INHERITED(buffer)
|
Dot2DPathEffect(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {
|
||||||
{
|
|
||||||
fRadius = buffer.readScalar();
|
fRadius = buffer.readScalar();
|
||||||
fPts = NULL;
|
fPts = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void flatten(SkFlattenableWriteBuffer& buffer) const SK_OVERRIDE {
|
virtual void flatten(SkFlattenableWriteBuffer& buffer) const SK_OVERRIDE {
|
||||||
this->INHERITED::flatten(buffer);
|
this->INHERITED::flatten(buffer);
|
||||||
buffer.writeScalar(fRadius);
|
buffer.writeScalar(fRadius);
|
||||||
@ -109,7 +109,8 @@ private:
|
|||||||
class InverseFillPE : public SkPathEffect {
|
class InverseFillPE : public SkPathEffect {
|
||||||
public:
|
public:
|
||||||
InverseFillPE() {}
|
InverseFillPE() {}
|
||||||
virtual bool filterPath(SkPath* dst, const SkPath& src, SkStrokeRec*) SK_OVERRIDE {
|
virtual bool filterPath(SkPath* dst, const SkPath& src,
|
||||||
|
SkStrokeRec*) const SK_OVERRIDE {
|
||||||
*dst = src;
|
*dst = src;
|
||||||
dst->setFillType(SkPath::kInverseWinding_FillType);
|
dst->setFillType(SkPath::kInverseWinding_FillType);
|
||||||
return true;
|
return true;
|
||||||
|
@ -94,8 +94,7 @@ public:
|
|||||||
SK_DECLARE_UNFLATTENABLE_OBJECT()
|
SK_DECLARE_UNFLATTENABLE_OBJECT()
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual SkScalar begin(SkScalar contourLength)
|
virtual SkScalar begin(SkScalar contourLength) const {
|
||||||
{
|
|
||||||
SkScriptValue value;
|
SkScriptValue value;
|
||||||
SkAnimatorScript engine(*fMaker, NULL, SkType_Float);
|
SkAnimatorScript engine(*fMaker, NULL, SkType_Float);
|
||||||
engine.propertyCallBack(GetContourLength, &contourLength);
|
engine.propertyCallBack(GetContourLength, &contourLength);
|
||||||
@ -104,8 +103,7 @@ protected:
|
|||||||
return value.fOperand.fScalar;
|
return value.fOperand.fScalar;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual SkScalar next(SkPath* dst, SkScalar distance, SkPathMeasure& )
|
virtual SkScalar next(SkPath* dst, SkScalar distance, SkPathMeasure&) const {
|
||||||
{
|
|
||||||
fMaker->setExtraPropertyCallBack(fDraw->fType, GetDistance, &distance);
|
fMaker->setExtraPropertyCallBack(fDraw->fType, GetDistance, &distance);
|
||||||
SkDrawPath* drawPath = NULL;
|
SkDrawPath* drawPath = NULL;
|
||||||
if (fDraw->addPath->isPath()) {
|
if (fDraw->addPath->isPath()) {
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
SK_DEFINE_INST_COUNT(SkPathEffect)
|
SK_DEFINE_INST_COUNT(SkPathEffect)
|
||||||
|
|
||||||
void SkPathEffect::computeFastBounds(SkRect* dst, const SkRect& src) {
|
void SkPathEffect::computeFastBounds(SkRect* dst, const SkRect& src) const {
|
||||||
*dst = src;
|
*dst = src;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ SkPairPathEffect::SkPairPathEffect(SkFlattenableReadBuffer& buffer) {
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
bool SkComposePathEffect::filterPath(SkPath* dst, const SkPath& src,
|
bool SkComposePathEffect::filterPath(SkPath* dst, const SkPath& src,
|
||||||
SkStrokeRec* rec) {
|
SkStrokeRec* rec) const {
|
||||||
// we may have failed to unflatten these, so we have to check
|
// we may have failed to unflatten these, so we have to check
|
||||||
if (!fPE0 || !fPE1) {
|
if (!fPE0 || !fPE1) {
|
||||||
return false;
|
return false;
|
||||||
@ -74,7 +74,7 @@ bool SkComposePathEffect::filterPath(SkPath* dst, const SkPath& src,
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
bool SkSumPathEffect::filterPath(SkPath* dst, const SkPath& src,
|
bool SkSumPathEffect::filterPath(SkPath* dst, const SkPath& src,
|
||||||
SkStrokeRec* rec) {
|
SkStrokeRec* rec) const {
|
||||||
// use bit-or so that we always call both, even if the first one succeeds
|
// use bit-or so that we always call both, even if the first one succeeds
|
||||||
return fPE0->filterPath(dst, src, rec) | fPE1->filterPath(dst, src, rec);
|
return fPE0->filterPath(dst, src, rec) | fPE1->filterPath(dst, src, rec);
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,8 @@
|
|||||||
#include "SkFlattenableBuffers.h"
|
#include "SkFlattenableBuffers.h"
|
||||||
#include "SkPathMeasure.h"
|
#include "SkPathMeasure.h"
|
||||||
|
|
||||||
bool Sk1DPathEffect::filterPath(SkPath* dst, const SkPath& src, SkStrokeRec*) {
|
bool Sk1DPathEffect::filterPath(SkPath* dst, const SkPath& src,
|
||||||
|
SkStrokeRec*) const {
|
||||||
SkPathMeasure meas(src, false);
|
SkPathMeasure meas(src, false);
|
||||||
do {
|
do {
|
||||||
SkScalar length = meas.getLength();
|
SkScalar length = meas.getLength();
|
||||||
@ -68,7 +69,7 @@ SkPath1DPathEffect::SkPath1DPathEffect(const SkPath& path, SkScalar advance,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool SkPath1DPathEffect::filterPath(SkPath* dst, const SkPath& src,
|
bool SkPath1DPathEffect::filterPath(SkPath* dst, const SkPath& src,
|
||||||
SkStrokeRec* rec) {
|
SkStrokeRec* rec) const {
|
||||||
if (fAdvance > 0) {
|
if (fAdvance > 0) {
|
||||||
rec->setFillStyle();
|
rec->setFillStyle();
|
||||||
return this->INHERITED::filterPath(dst, src, rec);
|
return this->INHERITED::filterPath(dst, src, rec);
|
||||||
@ -159,7 +160,7 @@ SkPath1DPathEffect::SkPath1DPathEffect(SkFlattenableReadBuffer& buffer) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SkScalar SkPath1DPathEffect::begin(SkScalar contourLength) {
|
SkScalar SkPath1DPathEffect::begin(SkScalar contourLength) const {
|
||||||
return fInitialOffset;
|
return fInitialOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,7 +175,7 @@ void SkPath1DPathEffect::flatten(SkFlattenableWriteBuffer& buffer) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SkScalar SkPath1DPathEffect::next(SkPath* dst, SkScalar distance,
|
SkScalar SkPath1DPathEffect::next(SkPath* dst, SkScalar distance,
|
||||||
SkPathMeasure& meas) {
|
SkPathMeasure& meas) const {
|
||||||
switch (fStyle) {
|
switch (fStyle) {
|
||||||
case kTranslate_Style: {
|
case kTranslate_Style: {
|
||||||
SkPoint pos;
|
SkPoint pos;
|
||||||
|
@ -16,7 +16,8 @@ Sk2DPathEffect::Sk2DPathEffect(const SkMatrix& mat) : fMatrix(mat) {
|
|||||||
fMatrixIsInvertible = mat.invert(&fInverse);
|
fMatrixIsInvertible = mat.invert(&fInverse);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Sk2DPathEffect::filterPath(SkPath* dst, const SkPath& src, SkStrokeRec*) {
|
bool Sk2DPathEffect::filterPath(SkPath* dst, const SkPath& src,
|
||||||
|
SkStrokeRec*) const {
|
||||||
if (!fMatrixIsInvertible) {
|
if (!fMatrixIsInvertible) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -44,7 +45,7 @@ bool Sk2DPathEffect::filterPath(SkPath* dst, const SkPath& src, SkStrokeRec*) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sk2DPathEffect::nextSpan(int x, int y, int count, SkPath* path) {
|
void Sk2DPathEffect::nextSpan(int x, int y, int count, SkPath* path) const {
|
||||||
if (!fMatrixIsInvertible) {
|
if (!fMatrixIsInvertible) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -60,9 +61,9 @@ void Sk2DPathEffect::nextSpan(int x, int y, int count, SkPath* path) {
|
|||||||
} while (--count > 0);
|
} while (--count > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sk2DPathEffect::begin(const SkIRect& uvBounds, SkPath* dst) {}
|
void Sk2DPathEffect::begin(const SkIRect& uvBounds, SkPath* dst) const {}
|
||||||
void Sk2DPathEffect::next(const SkPoint& loc, int u, int v, SkPath* dst) {}
|
void Sk2DPathEffect::next(const SkPoint& loc, int u, int v, SkPath* dst) const {}
|
||||||
void Sk2DPathEffect::end(SkPath* dst) {}
|
void Sk2DPathEffect::end(SkPath* dst) const {}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@ -78,7 +79,8 @@ Sk2DPathEffect::Sk2DPathEffect(SkFlattenableReadBuffer& buffer) {
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
bool SkLine2DPathEffect::filterPath(SkPath *dst, const SkPath &src, SkStrokeRec *rec) {
|
bool SkLine2DPathEffect::filterPath(SkPath* dst, const SkPath& src,
|
||||||
|
SkStrokeRec* rec) const {
|
||||||
if (this->INHERITED::filterPath(dst, src, rec)) {
|
if (this->INHERITED::filterPath(dst, src, rec)) {
|
||||||
rec->setStrokeStyle(fWidth);
|
rec->setStrokeStyle(fWidth);
|
||||||
return true;
|
return true;
|
||||||
@ -86,7 +88,7 @@ bool SkLine2DPathEffect::filterPath(SkPath *dst, const SkPath &src, SkStrokeRec
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkLine2DPathEffect::nextSpan(int u, int v, int ucount, SkPath *dst) {
|
void SkLine2DPathEffect::nextSpan(int u, int v, int ucount, SkPath* dst) const {
|
||||||
if (ucount > 1) {
|
if (ucount > 1) {
|
||||||
SkPoint src[2], dstP[2];
|
SkPoint src[2], dstP[2];
|
||||||
|
|
||||||
@ -124,6 +126,7 @@ void SkPath2DPathEffect::flatten(SkFlattenableWriteBuffer& buffer) const {
|
|||||||
buffer.writePath(fPath);
|
buffer.writePath(fPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkPath2DPathEffect::next(const SkPoint& loc, int u, int v, SkPath* dst) {
|
void SkPath2DPathEffect::next(const SkPoint& loc, int u, int v,
|
||||||
|
SkPath* dst) const {
|
||||||
dst->addPath(fPath, loc.fX, loc.fY);
|
dst->addPath(fPath, loc.fX, loc.fY);
|
||||||
}
|
}
|
||||||
|
@ -12,13 +12,8 @@
|
|||||||
#include "SkPoint.h"
|
#include "SkPoint.h"
|
||||||
#include "SkFlattenableBuffers.h"
|
#include "SkFlattenableBuffers.h"
|
||||||
|
|
||||||
SkCornerPathEffect::SkCornerPathEffect(SkScalar radius) : fRadius(radius)
|
SkCornerPathEffect::SkCornerPathEffect(SkScalar radius) : fRadius(radius) {}
|
||||||
{
|
SkCornerPathEffect::~SkCornerPathEffect() {}
|
||||||
}
|
|
||||||
|
|
||||||
SkCornerPathEffect::~SkCornerPathEffect()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool ComputeStep(const SkPoint& a, const SkPoint& b, SkScalar radius,
|
static bool ComputeStep(const SkPoint& a, const SkPoint& b, SkScalar radius,
|
||||||
SkPoint* step) {
|
SkPoint* step) {
|
||||||
@ -36,8 +31,8 @@ static bool ComputeStep(const SkPoint& a, const SkPoint& b, SkScalar radius,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool SkCornerPathEffect::filterPath(SkPath* dst, const SkPath& src,
|
bool SkCornerPathEffect::filterPath(SkPath* dst, const SkPath& src,
|
||||||
SkStrokeRec*) {
|
SkStrokeRec*) const {
|
||||||
if (fRadius == 0) {
|
if (0 == fRadius) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
bool SkDashPathEffect::filterPath(SkPath* dst, const SkPath& src,
|
bool SkDashPathEffect::filterPath(SkPath* dst, const SkPath& src,
|
||||||
SkStrokeRec* rec) {
|
SkStrokeRec* rec) const {
|
||||||
// we do nothing if the src wants to be filled, or if our dashlength is 0
|
// we do nothing if the src wants to be filled, or if our dashlength is 0
|
||||||
if (rec->isFillStyle() || fInitialDashLength < 0) {
|
if (rec->isFillStyle() || fInitialDashLength < 0) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -26,7 +26,7 @@ SkDiscretePathEffect::SkDiscretePathEffect(SkScalar segLength, SkScalar deviatio
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool SkDiscretePathEffect::filterPath(SkPath* dst, const SkPath& src,
|
bool SkDiscretePathEffect::filterPath(SkPath* dst, const SkPath& src,
|
||||||
SkStrokeRec* rec) {
|
SkStrokeRec* rec) const {
|
||||||
bool doFill = rec->isFillStyle();
|
bool doFill = rec->isFillStyle();
|
||||||
|
|
||||||
SkPathMeasure meas(src, doFill);
|
SkPathMeasure meas(src, doFill);
|
||||||
|
Loading…
Reference in New Issue
Block a user