1 #ifndef GrMesh_DEFINED 2 #define GrMesh_DEFINED 3 4 #include "SkRect.h" 5 #include "SkPoint.h" 6 7 class SkCanvas; 8 class SkPaint; 9 10 class GrMesh { 11 public: 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 31 private: 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 43