From a563162780d589938aef8a4d8b63d2957139313b Mon Sep 17 00:00:00 2001 From: "reed@android.com" Date: Wed, 28 Oct 2009 14:27:20 +0000 Subject: move boundarypatch into utils git-svn-id: http://skia.googlecode.com/svn/trunk@410 2bbb7eff-a529-9590-31e7-b0007b416f81 --- include/utils/SkBoundaryPatch.h | 55 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 include/utils/SkBoundaryPatch.h (limited to 'include/utils') diff --git a/include/utils/SkBoundaryPatch.h b/include/utils/SkBoundaryPatch.h new file mode 100644 index 0000000000..835fc3e641 --- /dev/null +++ b/include/utils/SkBoundaryPatch.h @@ -0,0 +1,55 @@ +#ifndef SkBoundaryPatch_DEFINED +#define SkBoundaryPatch_DEFINED + +#include "SkPoint.h" +#include "SkRefCnt.h" + +class SkBoundary : public SkRefCnt { +public: + // These must be 0, 1, 2, 3 for efficiency in the subclass implementations + enum Edge { + kTop = 0, + kRight = 1, + kBottom = 2, + kLeft = 3 + }; + // Edge index goes clockwise around the boundary, beginning at the "top" + virtual SkPoint eval(Edge, SkScalar unitInterval) = 0; +}; + +class SkBoundaryPatch { +public: + SkBoundaryPatch(); + ~SkBoundaryPatch(); + + SkBoundary* getBoundary() const { return fBoundary; } + SkBoundary* setBoundary(SkBoundary*); + + SkPoint eval(SkScalar unitU, SkScalar unitV); + bool evalPatch(SkPoint verts[], int rows, int cols); + +private: + SkBoundary* fBoundary; +}; + +//////////////////////////////////////////////////////////////////////// + +class SkLineBoundary : public SkBoundary { +public: + SkPoint fPts[4]; + + // override + virtual SkPoint eval(Edge, SkScalar); +}; + +class SkCubicBoundary : public SkBoundary { +public: + // the caller sets the first 12 entries. The 13th is used by the impl. + SkPoint fPts[13]; + + // override + virtual SkPoint eval(Edge, SkScalar); +}; + +#endif + -- cgit v1.2.3