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

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

Issue 1316233002: Style Change: NULL->nullptr (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-27 (Thursday) 10:25:06 EDT Created 5 years, 3 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
« no previous file with comments | « src/utils/SkLua.cpp ('k') | src/utils/SkNinePatch.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 11
12 SkMeshIndices::SkMeshIndices() { 12 SkMeshIndices::SkMeshIndices() {
13 sk_bzero(this, sizeof(*this)); 13 sk_bzero(this, sizeof(*this));
14 } 14 }
15 15
16 SkMeshIndices::~SkMeshIndices() { 16 SkMeshIndices::~SkMeshIndices() {
17 sk_free(fStorage); 17 sk_free(fStorage);
18 } 18 }
19 19
20 bool SkMeshIndices::init(SkPoint tex[], uint16_t indices[], 20 bool SkMeshIndices::init(SkPoint tex[], uint16_t indices[],
21 int texW, int texH, int rows, int cols) { 21 int texW, int texH, int rows, int cols) {
22 if (rows < 2 || cols < 2) { 22 if (rows < 2 || cols < 2) {
23 sk_free(fStorage); 23 sk_free(fStorage);
24 fStorage = NULL; 24 fStorage = nullptr;
25 fTex = NULL; 25 fTex = nullptr;
26 fIndices = NULL; 26 fIndices = nullptr;
27 fTexCount = fIndexCount = 0; 27 fTexCount = fIndexCount = 0;
28 return false; 28 return false;
29 } 29 }
30 30
31 sk_free(fStorage); 31 sk_free(fStorage);
32 fStorage = NULL; 32 fStorage = nullptr;
33 33
34 fTexCount = rows * cols; 34 fTexCount = rows * cols;
35 rows -= 1; 35 rows -= 1;
36 cols -= 1; 36 cols -= 1;
37 fIndexCount = rows * cols * 6; 37 fIndexCount = rows * cols * 6;
38 38
39 if (tex) { 39 if (tex) {
40 fTex = tex; 40 fTex = tex;
41 fIndices = indices; 41 fIndices = indices;
42 } else { 42 } else {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::CreateBitmapShader(bitmap,
96 SkShader::kClamp_TileMode, 96 SkShader::kClamp_TileMode,
97 SkShader::kClamp_TileMode))->unref(); 97 SkShader::kClamp_TileMode))->unref();
98 canvas->drawVertices(SkCanvas::kTriangles_VertexMode, 98 canvas->drawVertices(SkCanvas::kTriangles_VertexMode,
99 rows * cols, verts, idx.tex(), colors, NULL, 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
« no previous file with comments | « src/utils/SkLua.cpp ('k') | src/utils/SkNinePatch.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698