27dddae313
This reverts commit32a4910e57
. Reason for revert: SkMatrix::toString use has been removed from flutter and has been picked up in fuchsia Additionally some bookmaker changes take into account recent additions of typedef comments and the generated header comment. Original change's description: > Revert "remove toString" > > This reverts commit5191880cbf
. > > Reason for revert: broke flutter > > Original change's description: > > remove toString > > > > toString may have been used by obsolete debugger only > > find out if that is so > > > > R=​brianosman@google.com,bsalomon@google.com > > > > Docs-Preview: https://skia.org/?cl=119894 > > Bug:830651 > > Change-Id: I737f19b7d3fbc869bea2f443fa3b5ed7c1393ffd > > Reviewed-on: https://skia-review.googlesource.com/119894 > > Commit-Queue: Cary Clark <caryclark@google.com> > > Reviewed-by: Brian Salomon <bsalomon@google.com> > > TBR=bsalomon@google.com,brianosman@google.com,caryclark@google.com,caryclark@skia.org > > Change-Id: I9f81de6c3615ee0608bcea9081b77239b4b8816c TBR=bsalomon@google.com,brianosman@google.com # Not skipping CQ checks because original CL landed > 1 day ago. Reviewed-on: https://skia-review.googlesource.com/129623 Reviewed-by: Cary Clark <caryclark@skia.org> Commit-Queue: Cary Clark <caryclark@google.com> Docs-Preview: https://skia.org/?cl=133583 Bug: 830651 Change-Id: If8499e796be63580ad419e150e94d43e8b89de1b Reviewed-on: https://skia-review.googlesource.com/133583 Commit-Queue: Cary Clark <caryclark@skia.org> Auto-Submit: Cary Clark <caryclark@skia.org>
115 lines
3.4 KiB
C++
115 lines
3.4 KiB
C++
/*
|
|
* Copyright 2006 The Android Open Source Project
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#ifndef Sk2DPathEffect_DEFINED
|
|
#define Sk2DPathEffect_DEFINED
|
|
|
|
#include "SkFlattenable.h"
|
|
#include "SkPath.h"
|
|
#include "SkPathEffect.h"
|
|
#include "SkMatrix.h"
|
|
|
|
class SK_API Sk2DPathEffect : public SkPathEffect {
|
|
public:
|
|
bool filterPath(SkPath*, const SkPath&, SkStrokeRec*, const SkRect*) const override;
|
|
|
|
protected:
|
|
/** New virtual, to be overridden by subclasses.
|
|
This is called once from filterPath, and provides the
|
|
uv parameter bounds for the path. Subsequent calls to
|
|
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) 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) const;
|
|
|
|
const SkMatrix& getMatrix() const { return fMatrix; }
|
|
|
|
// protected so that subclasses can call this during unflattening
|
|
explicit Sk2DPathEffect(const SkMatrix& mat);
|
|
void flatten(SkWriteBuffer&) const override;
|
|
|
|
private:
|
|
SkMatrix fMatrix, fInverse;
|
|
bool fMatrixIsInvertible;
|
|
|
|
// illegal
|
|
Sk2DPathEffect(const Sk2DPathEffect&);
|
|
Sk2DPathEffect& operator=(const Sk2DPathEffect&);
|
|
|
|
friend class Sk2DPathEffectBlitter;
|
|
typedef SkPathEffect INHERITED;
|
|
};
|
|
|
|
class SK_API SkLine2DPathEffect : public Sk2DPathEffect {
|
|
public:
|
|
static sk_sp<SkPathEffect> Make(SkScalar width, const SkMatrix& matrix) {
|
|
if (!(width >= 0)) {
|
|
return nullptr;
|
|
}
|
|
return sk_sp<SkPathEffect>(new SkLine2DPathEffect(width, matrix));
|
|
}
|
|
|
|
virtual bool filterPath(SkPath* dst, const SkPath& src,
|
|
SkStrokeRec*, const SkRect*) const override;
|
|
|
|
Factory getFactory() const override { return CreateProc; }
|
|
|
|
protected:
|
|
SkLine2DPathEffect(SkScalar width, const SkMatrix& matrix)
|
|
: Sk2DPathEffect(matrix), fWidth(width) {
|
|
SkASSERT(width >= 0);
|
|
}
|
|
void flatten(SkWriteBuffer&) const override;
|
|
|
|
void nextSpan(int u, int v, int ucount, SkPath*) const override;
|
|
|
|
private:
|
|
static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&);
|
|
friend class SkFlattenable::PrivateInitializer;
|
|
|
|
SkScalar fWidth;
|
|
|
|
typedef Sk2DPathEffect INHERITED;
|
|
};
|
|
|
|
class SK_API SkPath2DPathEffect : public Sk2DPathEffect {
|
|
public:
|
|
/**
|
|
* Stamp the specified path to fill the shape, using the matrix to define
|
|
* the latice.
|
|
*/
|
|
static sk_sp<SkPathEffect> Make(const SkMatrix& matrix, const SkPath& path) {
|
|
return sk_sp<SkPathEffect>(new SkPath2DPathEffect(matrix, path));
|
|
}
|
|
|
|
Factory getFactory() const override { return CreateProc; }
|
|
|
|
protected:
|
|
SkPath2DPathEffect(const SkMatrix&, const SkPath&);
|
|
void flatten(SkWriteBuffer&) const override;
|
|
|
|
void next(const SkPoint&, int u, int v, SkPath*) const override;
|
|
|
|
private:
|
|
static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&);
|
|
friend class SkFlattenable::PrivateInitializer;
|
|
|
|
SkPath fPath;
|
|
|
|
typedef Sk2DPathEffect INHERITED;
|
|
};
|
|
|
|
#endif
|