blob: 4d904e41bd18b77cc0510154b7c1bf21d781472c [file] [log] [blame]
reed@google.comac10a2d2010-12-22 21:39:39 +00001#ifndef GrMesh_DEFINED
2#define GrMesh_DEFINED
3
4#include "SkRect.h"
5#include "SkPoint.h"
6
7class SkCanvas;
8class SkPaint;
9
10class GrMesh {
11public:
12 GrMesh();
13 ~GrMesh();
14
15 GrMesh& operator=(const GrMesh& src);
16
17 void init(const SkRect& bounds, int rows, int cols,
18 const SkRect& texture);
19
20 const SkRect& bounds() const { return fBounds; }
21
22 int rows() const { return fRows; }
23 int cols() const { return fCols; }
24 SkPoint& pt(int row, int col) {
25 return fPts[row * (fRows + 1) + col];
26 }
27
28 void draw(SkCanvas*, const SkPaint&);
29 void drawWireframe(SkCanvas* canvas, const SkPaint& paint);
30
31private:
32 SkRect fBounds;
33 int fRows, fCols;
34 SkPoint* fPts;
35 SkPoint* fTex; // just points into fPts, not separately allocated
36 int fCount;
37 uint16_t* fIndices;
38 int fIndexCount;
39};
40
41#endif
42