* If this method returns true, the caller will apply (as needed) the
* 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.
* 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
SkComposePathEffect(SkPathEffect* outer, SkPathEffect* 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)
SkSumPathEffect(SkPathEffect* first, SkPathEffect* 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)
// This class is not exported to java.
class SK_API Sk1DPathEffect : public SkPathEffect {
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:
/** Called at the start of each contour, returns the initial offset
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
for the point/tangent at the specified distance.
Return the distance to travel for the next call. If return <= 0, then that
contour is done.
*/
- virtual SkScalar next(SkPath* dst, SkScalar distance, SkPathMeasure&) = 0;
+ virtual SkScalar next(SkPath* dst, SkScalar dist, SkPathMeasure&) const = 0;
private:
typedef SkPathEffect INHERITED;
*/
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)
virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE;
// overrides from Sk1DPathEffect
- virtual SkScalar begin(SkScalar contourLength) SK_OVERRIDE;
- virtual SkScalar next(SkPath*, SkScalar distance, SkPathMeasure&) SK_OVERRIDE;
+ virtual SkScalar begin(SkScalar contourLength) const SK_OVERRIDE;
+ virtual SkScalar next(SkPath*, SkScalar, SkPathMeasure&) const SK_OVERRIDE;
private:
SkPath fPath; // copied from constructor
public:
Sk2DPathEffect(const SkMatrix& mat);
- // overrides
- 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(Sk2DPathEffect)
next() will receive u and v values within these bounds,
and then a call to end() will signal the end of processing.
*/
- virtual void begin(const SkIRect& uvBounds, SkPath* dst);
- virtual void next(const SkPoint& loc, int u, int v, SkPath* dst);
- virtual void end(SkPath* dst);
+ virtual void begin(const SkIRect& uvBounds, SkPath* dst) const;
+ virtual void next(const SkPoint& loc, int u, int v, SkPath* dst) const;
+ virtual void end(SkPath* dst) const;
/** Low-level virtual called per span of locations in the u-direction.
The default implementation calls next() repeatedly with each
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; }
SkLine2DPathEffect(SkScalar width, const SkMatrix& matrix)
: 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)
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&);
SkPath2DPathEffect(SkFlattenableReadBuffer& buffer);
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:
SkPath fPath;
SkCornerPathEffect(SkScalar radius);
virtual ~SkCornerPathEffect();
- // overrides for SkPathEffect
- // This method is not exported to java.
- 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(SkCornerPathEffect)
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 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,
const SkStrokeRec&, const SkMatrix&) const SK_OVERRIDE;
- // overrides for SkFlattenable
- // This method is not exported to java.
- virtual Factory getFactory();
+ virtual Factory getFactory() SK_OVERRIDE;
+
static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
protected:
*/
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(Dot2DPathEffect)
protected:
- virtual void begin(const SkIRect& uvBounds, SkPath* dst) {
+ virtual void begin(const SkIRect& uvBounds, SkPath* dst) const SK_OVERRIDE {
if (fPts) {
fPts->reset();
}
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) {
*fPts->append() = loc;
}
dst->addCircle(loc.fX, loc.fY, fRadius);
}
- Dot2DPathEffect(SkFlattenableReadBuffer& buffer) : INHERITED(buffer)
- {
+ Dot2DPathEffect(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {
fRadius = buffer.readScalar();
fPts = NULL;
}
+
virtual void flatten(SkFlattenableWriteBuffer& buffer) const SK_OVERRIDE {
this->INHERITED::flatten(buffer);
buffer.writeScalar(fRadius);
class InverseFillPE : public SkPathEffect {
public:
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->setFillType(SkPath::kInverseWinding_FillType);
return true;
SK_DECLARE_UNFLATTENABLE_OBJECT()
protected:
- virtual SkScalar begin(SkScalar contourLength)
- {
+ virtual SkScalar begin(SkScalar contourLength) const {
SkScriptValue value;
SkAnimatorScript engine(*fMaker, NULL, SkType_Float);
engine.propertyCallBack(GetContourLength, &contourLength);
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);
SkDrawPath* drawPath = NULL;
if (fDraw->addPath->isPath()) {
SK_DEFINE_INST_COUNT(SkPathEffect)
-void SkPathEffect::computeFastBounds(SkRect* dst, const SkRect& src) {
+void SkPathEffect::computeFastBounds(SkRect* dst, const SkRect& src) const {
*dst = 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
if (!fPE0 || !fPE1) {
return false;
///////////////////////////////////////////////////////////////////////////////
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
return fPE0->filterPath(dst, src, rec) | fPE1->filterPath(dst, src, rec);
}
#include "SkFlattenableBuffers.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);
do {
SkScalar length = meas.getLength();
}
bool SkPath1DPathEffect::filterPath(SkPath* dst, const SkPath& src,
- SkStrokeRec* rec) {
+ SkStrokeRec* rec) const {
if (fAdvance > 0) {
rec->setFillStyle();
return this->INHERITED::filterPath(dst, src, rec);
}
}
-SkScalar SkPath1DPathEffect::begin(SkScalar contourLength) {
+SkScalar SkPath1DPathEffect::begin(SkScalar contourLength) const {
return fInitialOffset;
}
}
SkScalar SkPath1DPathEffect::next(SkPath* dst, SkScalar distance,
- SkPathMeasure& meas) {
+ SkPathMeasure& meas) const {
switch (fStyle) {
case kTranslate_Style: {
SkPoint pos;
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) {
return false;
}
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) {
return;
}
} while (--count > 0);
}
-void Sk2DPathEffect::begin(const SkIRect& uvBounds, SkPath* dst) {}
-void Sk2DPathEffect::next(const SkPoint& loc, int u, int v, SkPath* dst) {}
-void Sk2DPathEffect::end(SkPath* dst) {}
+void Sk2DPathEffect::begin(const SkIRect& uvBounds, SkPath* dst) const {}
+void Sk2DPathEffect::next(const SkPoint& loc, int u, int v, SkPath* dst) const {}
+void Sk2DPathEffect::end(SkPath* dst) const {}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
-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)) {
rec->setStrokeStyle(fWidth);
return true;
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) {
SkPoint src[2], dstP[2];
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);
}
#include "SkPoint.h"
#include "SkFlattenableBuffers.h"
-SkCornerPathEffect::SkCornerPathEffect(SkScalar radius) : fRadius(radius)
-{
-}
-
-SkCornerPathEffect::~SkCornerPathEffect()
-{
-}
+SkCornerPathEffect::SkCornerPathEffect(SkScalar radius) : fRadius(radius) {}
+SkCornerPathEffect::~SkCornerPathEffect() {}
static bool ComputeStep(const SkPoint& a, const SkPoint& b, SkScalar radius,
SkPoint* step) {
}
bool SkCornerPathEffect::filterPath(SkPath* dst, const SkPath& src,
- SkStrokeRec*) {
- if (fRadius == 0) {
+ SkStrokeRec*) const {
+ if (0 == fRadius) {
return false;
}
};
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
if (rec->isFillStyle() || fInitialDashLength < 0) {
return false;
}
bool SkDiscretePathEffect::filterPath(SkPath* dst, const SkPath& src,
- SkStrokeRec* rec) {
+ SkStrokeRec* rec) const {
bool doFill = rec->isFillStyle();
SkPathMeasure meas(src, doFill);