reed@android.com | 2ee7c64 | 2009-10-28 14:25:34 +0000 | [diff] [blame] | 1 | #ifndef SkMeshUtils_DEFINED |
| 2 | #define SkMeshUtils_DEFINED |
| 3 | |
| 4 | #include "SkPoint.h" |
| 5 | #include "SkColor.h" |
| 6 | |
| 7 | class SkBitmap; |
| 8 | class SkCanvas; |
| 9 | class SkPaint; |
| 10 | |
| 11 | class SkMeshIndices { |
| 12 | public: |
| 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 | |
| 29 | private: |
| 30 | size_t fIndexCount, fTexCount; |
| 31 | SkPoint* fTex; |
| 32 | uint16_t* fIndices; |
| 33 | void* fStorage; // may be null |
| 34 | }; |
| 35 | |
| 36 | class SkMeshUtils { |
| 37 | public: |
| 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 |