OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #ifndef SkMeshUtils_DEFINED | 8 #ifndef SkMeshUtils_DEFINED |
9 #define SkMeshUtils_DEFINED | 9 #define SkMeshUtils_DEFINED |
10 | 10 |
11 #include "SkPoint.h" | 11 #include "SkPoint.h" |
12 #include "SkColor.h" | 12 #include "SkColor.h" |
13 | 13 |
14 class SkBitmap; | 14 class SkBitmap; |
15 class SkCanvas; | 15 class SkCanvas; |
16 class SkPaint; | 16 class SkPaint; |
17 | 17 |
18 class SkMeshIndices { | 18 class SkMeshIndices { |
19 public: | 19 public: |
20 SkMeshIndices(); | 20 SkMeshIndices(); |
21 ~SkMeshIndices(); | 21 ~SkMeshIndices(); |
22 | 22 |
23 bool init(int texW, int texH, int rows, int cols) { | 23 bool init(int texW, int texH, int rows, int cols) { |
24 return this->init(NULL, NULL, texW, texH, rows, cols); | 24 return this->init(NULL, NULL, texW, texH, rows, cols); |
25 } | 25 } |
26 | 26 |
27 bool init(SkPoint tex[], uint16_t indices[], | 27 bool init(SkPoint tex[], uint16_t indices[], |
28 int texW, int texH, int rows, int cols); | 28 int texW, int texH, int rows, int cols); |
29 | 29 |
30 size_t indexCount() const { return fIndexCount; } | 30 int indexCount() const { return fIndexCount; } |
31 const uint16_t* indices() const { return fIndices; } | 31 const uint16_t* indices() const { return fIndices; } |
32 | 32 |
33 size_t texCount() const { return fTexCount; } | 33 size_t texCount() const { return fTexCount; } |
34 const SkPoint* tex() const { return fTex; } | 34 const SkPoint* tex() const { return fTex; } |
35 | 35 |
36 private: | 36 private: |
37 size_t fIndexCount, fTexCount; | 37 int fIndexCount, fTexCount; |
38 SkPoint* fTex; | 38 SkPoint* fTex; |
39 uint16_t* fIndices; | 39 uint16_t* fIndices; |
40 void* fStorage; // may be null | 40 void* fStorage; // may be null |
41 }; | 41 }; |
42 | 42 |
43 class SkMeshUtils { | 43 class SkMeshUtils { |
44 public: | 44 public: |
45 static void Draw(SkCanvas*, const SkBitmap&, int rows, int cols, | 45 static void Draw(SkCanvas*, const SkBitmap&, int rows, int cols, |
46 const SkPoint verts[], const SkColor colors[], | 46 const SkPoint verts[], const SkColor colors[], |
47 const SkPaint& paint); | 47 const SkPaint& paint); |
48 }; | 48 }; |
49 | 49 |
50 #endif | 50 #endif |
OLD | NEW |