| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 void draw(SkCanvas* canvas, int x, int y, const SkIPoint& target, | 50 void draw(SkCanvas* canvas, int x, int y, const SkIPoint& target, |
| 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 = NULL) { |
| 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 = SkFloatToScalar(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 SkNEW_ARGS(SkMatrixConvolutionImageFilter, (kernelSize, | 62 SkNEW_ARGS(SkMatrixConvolutionImageFilter, (kernelSize, |
| 63 kernel, | 63 kernel, |
| 64 gain, | 64 gain, |
| 65 bias, | 65 bias, |
| 66 target, | 66 target, |
| 67 tileMode, | 67 tileMode, |
| 68 convolveAlpha, | 68 convolveAlpha, |
| 69 NULL, | 69 NULL, |
| (...skipping 38 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 |