Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: src/utils/SkMeshUtils.cpp

Issue 1772463002: use Make instead of Create to return a shared shader (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: partial update of skia call-sites Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698