OLD | NEW |
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 | 7 |
8 #include "gm.h" | 8 #include "gm.h" |
9 #include "SkColor.h" | 9 #include "SkColor.h" |
10 #include "SkImageFilter.h" | 10 #include "SkImageFilter.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 canvas.drawRect(SkRect::MakeXYWH(0, 0, 16, 16), darkPaint); | 51 canvas.drawRect(SkRect::MakeXYWH(0, 0, 16, 16), darkPaint); |
52 canvas.drawRect(SkRect::MakeXYWH(16, 0, 16, 16), lightPaint); | 52 canvas.drawRect(SkRect::MakeXYWH(16, 0, 16, 16), lightPaint); |
53 canvas.drawRect(SkRect::MakeXYWH(0, 16, 16, 16), lightPaint); | 53 canvas.drawRect(SkRect::MakeXYWH(0, 16, 16, 16), lightPaint); |
54 canvas.drawRect(SkRect::MakeXYWH(16, 16, 16, 16), darkPaint); | 54 canvas.drawRect(SkRect::MakeXYWH(16, 16, 16, 16), darkPaint); |
55 canvas.restore(); | 55 canvas.restore(); |
56 } | 56 } |
57 } | 57 } |
58 } | 58 } |
59 | 59 |
60 virtual void onDraw(SkCanvas* canvas) { | 60 virtual void onDraw(SkCanvas* canvas) { |
61 canvas->clear(0x00000000); | 61 canvas->clear(SK_ColorBLACK); |
62 SkMatrix matrix; | 62 SkMatrix matrix; |
63 SkScalar margin = SkIntToScalar(10); | 63 SkScalar margin = SkIntToScalar(10); |
64 matrix.setSkew(SkDoubleToScalar(0.5), SkDoubleToScalar(0.2)); | 64 matrix.setSkew(SkDoubleToScalar(0.5), SkDoubleToScalar(0.2)); |
65 SkBitmap checkerboard; | 65 SkBitmap checkerboard; |
66 make_checkerboard(&checkerboard); | 66 make_checkerboard(&checkerboard); |
67 | 67 |
68 SkRect srcRect = SkRect::MakeWH(96, 96); | 68 SkRect srcRect = SkRect::MakeWH(96, 96); |
69 | 69 |
70 canvas->translate(margin, margin); | 70 canvas->translate(margin, margin); |
71 draw(canvas, srcRect, checkerboard, matrix, kNone_SkFilterQuality); | 71 draw(canvas, srcRect, checkerboard, matrix, kNone_SkFilterQuality); |
(...skipping 14 matching lines...) Expand all Loading... |
86 private: | 86 private: |
87 typedef GM INHERITED; | 87 typedef GM INHERITED; |
88 }; | 88 }; |
89 | 89 |
90 ////////////////////////////////////////////////////////////////////////////// | 90 ////////////////////////////////////////////////////////////////////////////// |
91 | 91 |
92 static GM* MyFactory(void*) { return new MatrixImageFilterGM; } | 92 static GM* MyFactory(void*) { return new MatrixImageFilterGM; } |
93 static GMRegistry reg(MyFactory); | 93 static GMRegistry reg(MyFactory); |
94 | 94 |
95 } | 95 } |
OLD | NEW |