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

Side by Side Diff: gm/patchgrid.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 | « gm/patch.cpp ('k') | gm/patheffects.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 2014 Google Inc. 3 * Copyright 2014 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 8
9 #include "gm.h" 9 #include "gm.h"
10 #include "SkPatchGrid.h" 10 #include "SkPatchGrid.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 {{50,175},{150,175},{220,225},{350,175},{470,225}}, 103 {{50,175},{150,175},{220,225},{350,175},{470,225}},
104 {{50,225},{150,225},{220,175},{350,225},{470,155}}, 104 {{50,225},{150,225},{220,175},{350,225},{470,155}},
105 {{50,275},{150,275},{250,275},{350,275},{400,305}}, 105 {{50,275},{150,275},{250,275},{350,275},{400,305}},
106 {{50,325},{150,325},{250,325},{350,325},{450,325}} 106 {{50,325},{150,325},{250,325},{350,325},{450,325}}
107 }; 107 };
108 108
109 static const int kRows = 3; 109 static const int kRows = 3;
110 static const int kCols = 4; 110 static const int kCols = 4;
111 111
112 canvas->scale(3, 3); 112 canvas->scale(3, 3);
113 SkPatchGrid grid(kRows, kCols, SkPatchGrid::kColors_VertexType, NULL); 113 SkPatchGrid grid(kRows, kCols, SkPatchGrid::kColors_VertexType, nullptr) ;
114 for (int i = 0; i < kRows; i++) { 114 for (int i = 0; i < kRows; i++) {
115 for (int j = 0; j < kCols; j++) { 115 for (int j = 0; j < kCols; j++) {
116 SkPoint points[12]; 116 SkPoint points[12];
117 117
118 //set corners 118 //set corners
119 points[SkPatchUtils::kTopP0_CubicCtrlPts] = vertices[i][j]; 119 points[SkPatchUtils::kTopP0_CubicCtrlPts] = vertices[i][j];
120 points[SkPatchUtils::kTopP3_CubicCtrlPts] = vertices[i][j + 1]; 120 points[SkPatchUtils::kTopP3_CubicCtrlPts] = vertices[i][j + 1];
121 points[SkPatchUtils::kBottomP0_CubicCtrlPts] = vertices[i + 1][j ]; 121 points[SkPatchUtils::kBottomP0_CubicCtrlPts] = vertices[i + 1][j ];
122 points[SkPatchUtils::kBottomP3_CubicCtrlPts] = vertices[i + 1][j + 1]; 122 points[SkPatchUtils::kBottomP3_CubicCtrlPts] = vertices[i + 1][j + 1];
123 123
124 points[SkPatchUtils::kTopP1_CubicCtrlPts] = hrzCtrl[i][j * 2]; 124 points[SkPatchUtils::kTopP1_CubicCtrlPts] = hrzCtrl[i][j * 2];
125 points[SkPatchUtils::kTopP2_CubicCtrlPts] = hrzCtrl[i][j * 2 + 1 ]; 125 points[SkPatchUtils::kTopP2_CubicCtrlPts] = hrzCtrl[i][j * 2 + 1 ];
126 points[SkPatchUtils::kBottomP1_CubicCtrlPts] = hrzCtrl[i + 1][j * 2]; 126 points[SkPatchUtils::kBottomP1_CubicCtrlPts] = hrzCtrl[i + 1][j * 2];
127 points[SkPatchUtils::kBottomP2_CubicCtrlPts] = hrzCtrl[i + 1][j * 2 + 1]; 127 points[SkPatchUtils::kBottomP2_CubicCtrlPts] = hrzCtrl[i + 1][j * 2 + 1];
128 128
129 points[SkPatchUtils::kLeftP1_CubicCtrlPts] = vrtCtrl[i * 2][j]; 129 points[SkPatchUtils::kLeftP1_CubicCtrlPts] = vrtCtrl[i * 2][j];
130 points[SkPatchUtils::kLeftP2_CubicCtrlPts] = vrtCtrl[i * 2 + 1][ j]; 130 points[SkPatchUtils::kLeftP2_CubicCtrlPts] = vrtCtrl[i * 2 + 1][ j];
131 points[SkPatchUtils::kRightP1_CubicCtrlPts] = vrtCtrl[i * 2][j + 1]; 131 points[SkPatchUtils::kRightP1_CubicCtrlPts] = vrtCtrl[i * 2][j + 1];
132 points[SkPatchUtils::kRightP2_CubicCtrlPts] = vrtCtrl[i * 2 + 1] [j + 1]; 132 points[SkPatchUtils::kRightP2_CubicCtrlPts] = vrtCtrl[i * 2 + 1] [j + 1];
133 133
134 SkColor colors[4]; 134 SkColor colors[4];
135 colors[0] = cornerColors[i][j]; 135 colors[0] = cornerColors[i][j];
136 colors[1] = cornerColors[i][j + 1]; 136 colors[1] = cornerColors[i][j + 1];
137 colors[3] = cornerColors[i + 1][j]; 137 colors[3] = cornerColors[i + 1][j];
138 colors[2] = cornerColors[i + 1][j + 1]; 138 colors[2] = cornerColors[i + 1][j + 1];
139 139
140 grid.setPatch(j, i, points, colors, NULL); 140 grid.setPatch(j, i, points, colors, nullptr);
141 } 141 }
142 } 142 }
143 143
144 grid.draw(canvas, paint); 144 grid.draw(canvas, paint);
145 SkISize dims = grid.getDimensions(); 145 SkISize dims = grid.getDimensions();
146 for (int y = 0; y < dims.height(); y++) { 146 for (int y = 0; y < dims.height(); y++) {
147 for (int x = 0; x < dims.width(); x++) { 147 for (int x = 0; x < dims.width(); x++) {
148 SkPoint cubics[12]; 148 SkPoint cubics[12];
149 grid.getPatch(x, y, cubics, NULL, NULL); 149 grid.getPatch(x, y, cubics, nullptr, nullptr);
150 draw_control_points(canvas, cubics); 150 draw_control_points(canvas, cubics);
151 } 151 }
152 } 152 }
153 } 153 }
154 154
155 private: 155 private:
156 typedef GM INHERITED; 156 typedef GM INHERITED;
157 }; 157 };
158 158
159 DEF_GM(return new SkPatchGridGM;) 159 DEF_GM(return new SkPatchGridGM;)
160 } 160 }
OLDNEW
« no previous file with comments | « gm/patch.cpp ('k') | gm/patheffects.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698