1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/skia/trunk/include/utils/SkMeshUtils.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,50 @@ 1.4 + 1.5 +/* 1.6 + * Copyright 2011 Google Inc. 1.7 + * 1.8 + * Use of this source code is governed by a BSD-style license that can be 1.9 + * found in the LICENSE file. 1.10 + */ 1.11 +#ifndef SkMeshUtils_DEFINED 1.12 +#define SkMeshUtils_DEFINED 1.13 + 1.14 +#include "SkPoint.h" 1.15 +#include "SkColor.h" 1.16 + 1.17 +class SkBitmap; 1.18 +class SkCanvas; 1.19 +class SkPaint; 1.20 + 1.21 +class SkMeshIndices { 1.22 +public: 1.23 + SkMeshIndices(); 1.24 + ~SkMeshIndices(); 1.25 + 1.26 + bool init(int texW, int texH, int rows, int cols) { 1.27 + return this->init(NULL, NULL, texW, texH, rows, cols); 1.28 + } 1.29 + 1.30 + bool init(SkPoint tex[], uint16_t indices[], 1.31 + int texW, int texH, int rows, int cols); 1.32 + 1.33 + int indexCount() const { return fIndexCount; } 1.34 + const uint16_t* indices() const { return fIndices; } 1.35 + 1.36 + size_t texCount() const { return fTexCount; } 1.37 + const SkPoint* tex() const { return fTex; } 1.38 + 1.39 +private: 1.40 + int fIndexCount, fTexCount; 1.41 + SkPoint* fTex; 1.42 + uint16_t* fIndices; 1.43 + void* fStorage; // may be null 1.44 +}; 1.45 + 1.46 +class SkMeshUtils { 1.47 +public: 1.48 + static void Draw(SkCanvas*, const SkBitmap&, int rows, int cols, 1.49 + const SkPoint verts[], const SkColor colors[], 1.50 + const SkPaint& paint); 1.51 +}; 1.52 + 1.53 +#endif