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 #include "SkMeshUtils.h" | 8 #include "SkMeshUtils.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkPaint.h" | 10 #include "SkPaint.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 85 |
86 #include "SkShader.h" | 86 #include "SkShader.h" |
87 | 87 |
88 void SkMeshUtils::Draw(SkCanvas* canvas, const SkBitmap& bitmap, | 88 void SkMeshUtils::Draw(SkCanvas* canvas, const SkBitmap& bitmap, |
89 int rows, int cols, const SkPoint verts[], | 89 int rows, int cols, const SkPoint verts[], |
90 const SkColor colors[], const SkPaint& paint) { | 90 const SkColor colors[], const SkPaint& paint) { |
91 SkMeshIndices idx; | 91 SkMeshIndices idx; |
92 | 92 |
93 if (idx.init(bitmap.width(), bitmap.height(), rows, cols)) { | 93 if (idx.init(bitmap.width(), bitmap.height(), rows, cols)) { |
94 SkPaint p(paint); | 94 SkPaint p(paint); |
95 p.setShader(SkShader::CreateBitmapShader(bitmap, | 95 p.setShader(SkShader::MakeBitmapShader(bitmap, |
96 SkShader::kClamp_TileMode, | 96 SkShader::kClamp_TileMode, |
97 SkShader::kClamp_TileMode))->unref(); | 97 SkShader::kClamp_TileMode)); |
98 canvas->drawVertices(SkCanvas::kTriangles_VertexMode, | 98 canvas->drawVertices(SkCanvas::kTriangles_VertexMode, |
99 rows * cols, verts, idx.tex(), colors, nullptr, | 99 rows * cols, verts, idx.tex(), colors, nullptr, |
100 idx.indices(), idx.indexCount(), p); | 100 idx.indices(), idx.indexCount(), p); |
101 } | 101 } |
102 } | 102 } |
OLD | NEW |