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

Side by Side Diff: bench/ColorCubeBench.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 | « bench/CodecBench.cpp ('k') | bench/ColorFilterBench.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 #include "Benchmark.h" 7 #include "Benchmark.h"
8 #include "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkColorCubeFilter.h" 9 #include "SkColorCubeFilter.h"
10 #include "SkGradientShader.h" 10 #include "SkGradientShader.h"
11 11
12 class ColorCubeBench : public Benchmark { 12 class ColorCubeBench : public Benchmark {
13 SkISize fSize; 13 SkISize fSize;
14 int fCubeDimension; 14 int fCubeDimension;
15 SkData* fCubeData; 15 SkData* fCubeData;
16 SkBitmap fBitmap; 16 SkBitmap fBitmap;
17 17
18 public: 18 public:
19 ColorCubeBench() 19 ColorCubeBench()
20 : fCubeDimension(0) 20 : fCubeDimension(0)
21 , fCubeData(NULL) { 21 , fCubeData(nullptr) {
22 fSize = SkISize::Make(2880, 1800); // 2014 Macbook Pro resolution 22 fSize = SkISize::Make(2880, 1800); // 2014 Macbook Pro resolution
23 } 23 }
24 24
25 ~ColorCubeBench() { 25 ~ColorCubeBench() {
26 SkSafeUnref(fCubeData); 26 SkSafeUnref(fCubeData);
27 } 27 }
28 28
29 protected: 29 protected:
30 const char* onGetName() override { 30 const char* onGetName() override {
31 return "colorcube"; 31 return "colorcube";
(...skipping 15 matching lines...) Expand all
47 } 47 }
48 48
49 private: 49 private:
50 static SkShader* MakeLinear(const SkISize& size) { 50 static SkShader* MakeLinear(const SkISize& size) {
51 const SkPoint pts[2] = { 51 const SkPoint pts[2] = {
52 { 0, 0 }, 52 { 0, 0 },
53 { SkIntToScalar(size.width()), SkIntToScalar(size.height()) } 53 { SkIntToScalar(size.width()), SkIntToScalar(size.height()) }
54 }; 54 };
55 static const SkColor colors[] = { SK_ColorYELLOW, SK_ColorBLUE }; 55 static const SkColor colors[] = { SK_ColorYELLOW, SK_ColorBLUE };
56 return SkGradientShader::CreateLinear( 56 return SkGradientShader::CreateLinear(
57 pts, colors, NULL, 2, SkShader::kRepeat_TileMode, 0, &SkMatrix::I()) ; 57 pts, colors, nullptr, 2, SkShader::kRepeat_TileMode, 0, &SkMatrix::I ());
58 } 58 }
59 59
60 void make_bitmap() { 60 void make_bitmap() {
61 fBitmap.allocN32Pixels(fSize.width(), fSize.height()); 61 fBitmap.allocN32Pixels(fSize.width(), fSize.height());
62 SkCanvas canvas(fBitmap); 62 SkCanvas canvas(fBitmap);
63 canvas.clear(0x00000000); 63 canvas.clear(0x00000000);
64 SkPaint paint; 64 SkPaint paint;
65 paint.setAntiAlias(true); 65 paint.setAntiAlias(true);
66 SkShader* shader = MakeLinear(fSize); 66 SkShader* shader = MakeLinear(fSize);
67 paint.setShader(shader); 67 paint.setShader(shader);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 canvas->drawBitmap(fBitmap, 0, 0, &paint); 102 canvas->drawBitmap(fBitmap, 0, 0, &paint);
103 } 103 }
104 } 104 }
105 105
106 typedef Benchmark INHERITED; 106 typedef Benchmark INHERITED;
107 }; 107 };
108 108
109 /////////////////////////////////////////////////////////////////////////////// 109 ///////////////////////////////////////////////////////////////////////////////
110 110
111 DEF_BENCH( return new ColorCubeBench(); ) 111 DEF_BENCH( return new ColorCubeBench(); )
OLDNEW
« no previous file with comments | « bench/CodecBench.cpp ('k') | bench/ColorFilterBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698