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

Side by Side Diff: gm/pictureshader.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/pictureimagefilter.cpp ('k') | gm/pictureshadertile.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 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "gm.h" 8 #include "gm.h"
9 9
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 15 matching lines...) Expand all
26 public: 26 public:
27 PictureShaderGM(SkScalar tileSize, SkScalar sceneSize) 27 PictureShaderGM(SkScalar tileSize, SkScalar sceneSize)
28 : fTileSize(tileSize) 28 : fTileSize(tileSize)
29 , fSceneSize(sceneSize) { 29 , fSceneSize(sceneSize) {
30 } 30 }
31 31
32 protected: 32 protected:
33 void onOnceBeforeDraw() override { 33 void onOnceBeforeDraw() override {
34 // Build the picture. 34 // Build the picture.
35 SkPictureRecorder recorder; 35 SkPictureRecorder recorder;
36 SkCanvas* pictureCanvas = recorder.beginRecording(fTileSize, fTileSize, NULL, 0); 36 SkCanvas* pictureCanvas = recorder.beginRecording(fTileSize, fTileSize, nullptr, 0);
37 this->drawTile(pictureCanvas); 37 this->drawTile(pictureCanvas);
38 fPicture.reset(recorder.endRecording()); 38 fPicture.reset(recorder.endRecording());
39 39
40 // Build a reference bitmap. 40 // Build a reference bitmap.
41 fBitmap.allocN32Pixels(SkScalarCeilToInt(fTileSize), SkScalarCeilToInt(f TileSize)); 41 fBitmap.allocN32Pixels(SkScalarCeilToInt(fTileSize), SkScalarCeilToInt(f TileSize));
42 fBitmap.eraseColor(SK_ColorTRANSPARENT); 42 fBitmap.eraseColor(SK_ColorTRANSPARENT);
43 SkCanvas bitmapCanvas(fBitmap); 43 SkCanvas bitmapCanvas(fBitmap);
44 this->drawTile(&bitmapCanvas); 44 this->drawTile(&bitmapCanvas);
45 } 45 }
46 46
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 143
144 SkPaint paint; 144 SkPaint paint;
145 paint.setStyle(SkPaint::kFill_Style); 145 paint.setStyle(SkPaint::kFill_Style);
146 paint.setColor(sk_tool_utils::color_to_565(SK_ColorLTGRAY)); 146 paint.setColor(sk_tool_utils::color_to_565(SK_ColorLTGRAY));
147 147
148 canvas->save(); 148 canvas->save();
149 canvas->concat(matrix); 149 canvas->concat(matrix);
150 canvas->drawRect(SkRect::MakeWH(fSceneSize, fSceneSize), paint); 150 canvas->drawRect(SkRect::MakeWH(fSceneSize, fSceneSize), paint);
151 canvas->drawRect(SkRect::MakeXYWH(fSceneSize * 1.1f, 0, fSceneSize, fSce neSize), paint); 151 canvas->drawRect(SkRect::MakeXYWH(fSceneSize * 1.1f, 0, fSceneSize, fSce neSize), paint);
152 152
153 SkAutoTUnref<SkShader> pictureShader(SkShader::CreatePictureShader( 153 SkAutoTUnref<SkShader> pictureShader(
154 fPicture, 154 SkShader::CreatePictureShader(fPicture, kTileConfigs[tileMode].t mx,
155 kTileConfigs[tileMode].tmx, 155 kTileConfigs[tileMode].tmy, &local Matrix, nullptr));
156 kTileConfigs[tileMode].tmy,
157 &localMatrix,
158 NULL));
159 paint.setShader(pictureShader.get()); 156 paint.setShader(pictureShader.get());
160 canvas->drawRect(SkRect::MakeWH(fSceneSize, fSceneSize), paint); 157 canvas->drawRect(SkRect::MakeWH(fSceneSize, fSceneSize), paint);
161 158
162 canvas->translate(fSceneSize * 1.1f, 0); 159 canvas->translate(fSceneSize * 1.1f, 0);
163 160
164 SkAutoTUnref<SkShader> bitmapShader(SkShader::CreateBitmapShader( 161 SkAutoTUnref<SkShader> bitmapShader(SkShader::CreateBitmapShader(
165 fBitmap, 162 fBitmap,
166 kTileConfigs[tileMode].tmx, 163 kTileConfigs[tileMode].tmx,
167 kTileConfigs[tileMode].tmy, 164 kTileConfigs[tileMode].tmy,
168 &localMatrix)); 165 &localMatrix));
(...skipping 24 matching lines...) Expand all
193 SkRect r = tile; 190 SkRect r = tile;
194 r.inset(4, 4); 191 r.inset(4, 4);
195 SkPaint p; 192 SkPaint p;
196 p.setColor(sk_tool_utils::color_to_565(0xFF303F9F)); // dark blue 193 p.setColor(sk_tool_utils::color_to_565(0xFF303F9F)); // dark blue
197 c->drawRect(r, p); 194 c->drawRect(r, p);
198 p.setColor(sk_tool_utils::color_to_565(0xFFC5CAE9)); // light blue 195 p.setColor(sk_tool_utils::color_to_565(0xFFC5CAE9)); // light blue
199 p.setStrokeWidth(10); 196 p.setStrokeWidth(10);
200 c->drawLine(20, 20, 80, 80, p); 197 c->drawLine(20, 20, 80, 80, p);
201 198
202 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); 199 SkAutoTUnref<SkPicture> picture(recorder.endRecording());
203 SkAutoTUnref<SkShader> shader(SkShader::CreatePictureShader( 200 SkAutoTUnref<SkShader> shader(
204 » picture.get(), 201 SkShader::CreatePictureShader(picture.get(), SkShader::kRepeat_TileM ode,
205 » SkShader::kRepeat_TileMode, 202 SkShader::kRepeat_TileMode, nullptr, n ullptr));
206 » SkShader::kRepeat_TileMode,
207 » NULL,
208 » NULL));
209 203
210 p.setColor(sk_tool_utils::color_to_565(0xFF8BC34A)); // green 204 p.setColor(sk_tool_utils::color_to_565(0xFF8BC34A)); // green
211 canvas->drawPaint(p); 205 canvas->drawPaint(p);
212 206
213 canvas->clipRect(SkRect::MakeXYWH(0, 0, 400, 350)); 207 canvas->clipRect(SkRect::MakeXYWH(0, 0, 400, 350));
214 p.setColor(sk_tool_utils::color_to_565(0xFFB6B6B6)); // gray 208 p.setColor(sk_tool_utils::color_to_565(0xFFB6B6B6)); // gray
215 canvas->drawPaint(p); 209 canvas->drawPaint(p);
216 p.setShader(shader.get()); 210 p.setShader(shader.get());
217 211
218 canvas->drawPaint(p); 212 canvas->drawPaint(p);
219 } 213 }
OLDNEW
« no previous file with comments | « gm/pictureimagefilter.cpp ('k') | gm/pictureshadertile.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698