OLD | NEW |
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 19 matching lines...) Expand all Loading... |
30 canvas.clear(0x00000000); | 30 canvas.clear(0x00000000); |
31 SkPaint paint; | 31 SkPaint paint; |
32 paint.setAntiAlias(true); | 32 paint.setAntiAlias(true); |
33 sk_tool_utils::set_portable_typeface(&paint); | 33 sk_tool_utils::set_portable_typeface(&paint); |
34 paint.setColor(0xFFFFFFFF); | 34 paint.setColor(0xFFFFFFFF); |
35 paint.setTextSize(SkIntToScalar(180)); | 35 paint.setTextSize(SkIntToScalar(180)); |
36 SkPoint pts[2] = { SkPoint::Make(0, 0), | 36 SkPoint pts[2] = { SkPoint::Make(0, 0), |
37 SkPoint::Make(0, SkIntToScalar(80)) }; | 37 SkPoint::Make(0, SkIntToScalar(80)) }; |
38 SkColor colors[2] = { 0xFFFFFFFF, 0x40404040 }; | 38 SkColor colors[2] = { 0xFFFFFFFF, 0x40404040 }; |
39 SkScalar pos[2] = { 0, SkIntToScalar(80) }; | 39 SkScalar pos[2] = { 0, SkIntToScalar(80) }; |
40 paint.setShader(SkGradientShader::MakeLinear( | 40 paint.setShader(SkGradientShader::CreateLinear( |
41 pts, colors, pos, 2, SkShader::kClamp_TileMode)); | 41 pts, colors, pos, 2, SkShader::kClamp_TileMode))->unref(); |
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 SkISize onISize() override { | 46 SkISize onISize() override { |
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, |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 SkBitmap fBitmap; | 108 SkBitmap fBitmap; |
109 | 109 |
110 typedef GM INHERITED; | 110 typedef GM INHERITED; |
111 }; | 111 }; |
112 | 112 |
113 ////////////////////////////////////////////////////////////////////////////// | 113 ////////////////////////////////////////////////////////////////////////////// |
114 | 114 |
115 DEF_GM(return new MatrixConvolutionGM;) | 115 DEF_GM(return new MatrixConvolutionGM;) |
116 | 116 |
117 } | 117 } |
OLD | NEW |