| 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 12 matching lines...) Expand all Loading... |
| 23 virtual SkString onShortName() { | 23 virtual SkString onShortName() { |
| 24 return SkString("matrixconvolution"); | 24 return SkString("matrixconvolution"); |
| 25 } | 25 } |
| 26 | 26 |
| 27 void make_bitmap() { | 27 void make_bitmap() { |
| 28 fBitmap.allocN32Pixels(80, 80); | 28 fBitmap.allocN32Pixels(80, 80); |
| 29 SkCanvas canvas(fBitmap); | 29 SkCanvas canvas(fBitmap); |
| 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_always(&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::CreateLinear( | 40 paint.setShader(SkGradientShader::CreateLinear( |
| 41 pts, colors, pos, 2, SkShader::kClamp_TileMode))->unref(); | 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); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } |
| OLD | NEW |