michael@0: michael@0: /* michael@0: * Copyright 2011 Google Inc. michael@0: * michael@0: * Use of this source code is governed by a BSD-style license that can be michael@0: * found in the LICENSE file. michael@0: */ michael@0: #ifndef SkMeshUtils_DEFINED michael@0: #define SkMeshUtils_DEFINED michael@0: michael@0: #include "SkPoint.h" michael@0: #include "SkColor.h" michael@0: michael@0: class SkBitmap; michael@0: class SkCanvas; michael@0: class SkPaint; michael@0: michael@0: class SkMeshIndices { michael@0: public: michael@0: SkMeshIndices(); michael@0: ~SkMeshIndices(); michael@0: michael@0: bool init(int texW, int texH, int rows, int cols) { michael@0: return this->init(NULL, NULL, texW, texH, rows, cols); michael@0: } michael@0: michael@0: bool init(SkPoint tex[], uint16_t indices[], michael@0: int texW, int texH, int rows, int cols); michael@0: michael@0: int indexCount() const { return fIndexCount; } michael@0: const uint16_t* indices() const { return fIndices; } michael@0: michael@0: size_t texCount() const { return fTexCount; } michael@0: const SkPoint* tex() const { return fTex; } michael@0: michael@0: private: michael@0: int fIndexCount, fTexCount; michael@0: SkPoint* fTex; michael@0: uint16_t* fIndices; michael@0: void* fStorage; // may be null michael@0: }; michael@0: michael@0: class SkMeshUtils { michael@0: public: michael@0: static void Draw(SkCanvas*, const SkBitmap&, int rows, int cols, michael@0: const SkPoint verts[], const SkColor colors[], michael@0: const SkPaint& paint); michael@0: }; michael@0: michael@0: #endif