blob: 1235485880d845c6d76d77de1e6860c6f5822594 [file] [log] [blame]
reed@android.com2ee7c642009-10-28 14:25:34 +00001#ifndef SkMeshUtils_DEFINED
2#define SkMeshUtils_DEFINED
3
4#include "SkPoint.h"
5#include "SkColor.h"
6
7class SkBitmap;
8class SkCanvas;
9class SkPaint;
10
11class SkMeshIndices {
12public:
13 SkMeshIndices();
14 ~SkMeshIndices();
15
16 bool init(int texW, int texH, int rows, int cols) {
17 return this->init(NULL, NULL, texW, texH, rows, cols);
18 }
19
20 bool init(SkPoint tex[], uint16_t indices[],
21 int texW, int texH, int rows, int cols);
22
23 size_t indexCount() const { return fIndexCount; }
24 const uint16_t* indices() const { return fIndices; }
25
26 size_t texCount() const { return fTexCount; }
27 const SkPoint* tex() const { return fTex; }
28
29private:
30 size_t fIndexCount, fTexCount;
31 SkPoint* fTex;
32 uint16_t* fIndices;
33 void* fStorage; // may be null
34};
35
36class SkMeshUtils {
37public:
38 static void Draw(SkCanvas*, const SkBitmap&, int rows, int cols,
39 const SkPoint verts[], const SkColor colors[],
40 const SkPaint& paint);
41};
42
43#endif