skia2/include/utils/SkBoundaryPatch.h
rmistry@google.com fbfcd56021 Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/)
This CL is part I of IV (I broke down the 1280 files into 4 CLs).
Review URL: https://codereview.appspot.com/6485054

git-svn-id: http://skia.googlecode.com/svn/trunk@5262 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-08-23 18:09:54 +00:00

68 lines
1.4 KiB
C++

/*
* Copyright 2011 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkBoundaryPatch_DEFINED
#define SkBoundaryPatch_DEFINED
#include "SkPoint.h"
#include "SkRefCnt.h"
class SkBoundary : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(SkBoundary)
// 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;
private:
typedef SkRefCnt INHERITED;
};
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