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

Side by Side Diff: gm/matrixconvolution.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/lumafilter.cpp ('k') | gm/mipmap.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 2012 Google Inc. 2 * Copyright 2012 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 #include "SkColor.h" 9 #include "SkColor.h"
10 #include "SkMatrixConvolutionImageFilter.h" 10 #include "SkMatrixConvolutionImageFilter.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 const char* str = "e"; 42 const char* str = "e";
43 canvas.drawText(str, strlen(str), SkIntToScalar(-10), SkIntToScalar(80), paint); 43 canvas.drawText(str, strlen(str), SkIntToScalar(-10), SkIntToScalar(80), paint);
44 } 44 }
45 45
46 virtual SkISize onISize() { 46 virtual SkISize onISize() {
47 return SkISize::Make(500, 300); 47 return SkISize::Make(500, 300);
48 } 48 }
49 49
50 void draw(SkCanvas* canvas, int x, int y, const SkIPoint& kernelOffset, 50 void draw(SkCanvas* canvas, int x, int y, const SkIPoint& kernelOffset,
51 SkMatrixConvolutionImageFilter::TileMode tileMode, bool convolveAl pha, 51 SkMatrixConvolutionImageFilter::TileMode tileMode, bool convolveAl pha,
52 const SkImageFilter::CropRect* cropRect = NULL) { 52 const SkImageFilter::CropRect* cropRect = nullptr) {
53 SkScalar kernel[9] = { 53 SkScalar kernel[9] = {
54 SkIntToScalar( 1), SkIntToScalar( 1), SkIntToScalar( 1), 54 SkIntToScalar( 1), SkIntToScalar( 1), SkIntToScalar( 1),
55 SkIntToScalar( 1), SkIntToScalar(-7), SkIntToScalar( 1), 55 SkIntToScalar( 1), SkIntToScalar(-7), SkIntToScalar( 1),
56 SkIntToScalar( 1), SkIntToScalar( 1), SkIntToScalar( 1), 56 SkIntToScalar( 1), SkIntToScalar( 1), SkIntToScalar( 1),
57 }; 57 };
58 SkISize kernelSize = SkISize::Make(3, 3); 58 SkISize kernelSize = SkISize::Make(3, 3);
59 SkScalar gain = 0.3f, bias = SkIntToScalar(100); 59 SkScalar gain = 0.3f, bias = SkIntToScalar(100);
60 SkPaint paint; 60 SkPaint paint;
61 SkAutoTUnref<SkImageFilter> filter( 61 SkAutoTUnref<SkImageFilter> filter(
62 SkMatrixConvolutionImageFilter::Create(kernelSize, 62 SkMatrixConvolutionImageFilter::Create(kernelSize,
63 kernel, 63 kernel,
64 gain, 64 gain,
65 bias, 65 bias,
66 kernelOffset, 66 kernelOffset,
67 tileMode, 67 tileMode,
68 convolveAlpha, 68 convolveAlpha,
69 NULL, 69 nullptr,
70 cropRect)); 70 cropRect));
71 paint.setImageFilter(filter); 71 paint.setImageFilter(filter);
72 canvas->save(); 72 canvas->save();
73 canvas->translate(SkIntToScalar(x), SkIntToScalar(y)); 73 canvas->translate(SkIntToScalar(x), SkIntToScalar(y));
74 canvas->clipRect(SkRect::MakeWH(SkIntToScalar(fBitmap.width()), 74 canvas->clipRect(SkRect::MakeWH(SkIntToScalar(fBitmap.width()),
75 SkIntToScalar(fBitmap.height()))); 75 SkIntToScalar(fBitmap.height())));
76 canvas->drawBitmap(fBitmap, 0, 0, &paint); 76 canvas->drawBitmap(fBitmap, 0, 0, &paint);
77 canvas->restore(); 77 canvas->restore();
78 } 78 }
79 79
(...skipping 28 matching lines...) Expand all
108 SkBitmap fBitmap; 108 SkBitmap fBitmap;
109 bool fInitialized; 109 bool fInitialized;
110 }; 110 };
111 111
112 ////////////////////////////////////////////////////////////////////////////// 112 //////////////////////////////////////////////////////////////////////////////
113 113
114 static GM* MyFactory(void*) { return new MatrixConvolutionGM; } 114 static GM* MyFactory(void*) { return new MatrixConvolutionGM; }
115 static GMRegistry reg(MyFactory); 115 static GMRegistry reg(MyFactory);
116 116
117 } 117 }
OLDNEW
« no previous file with comments | « gm/lumafilter.cpp ('k') | gm/mipmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698