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 23 matching lines...) Expand all Loading... |
34 } | 34 } |
35 | 35 |
36 virtual SkISize onISize() { | 36 virtual SkISize onISize() { |
37 return SkISize::Make(420, 100); | 37 return SkISize::Make(420, 100); |
38 } | 38 } |
39 | 39 |
40 void make_checkerboard(SkBitmap* bitmap) { | 40 void make_checkerboard(SkBitmap* bitmap) { |
41 bitmap->allocN32Pixels(64, 64); | 41 bitmap->allocN32Pixels(64, 64); |
42 SkCanvas canvas(*bitmap); | 42 SkCanvas canvas(*bitmap); |
43 SkPaint darkPaint; | 43 SkPaint darkPaint; |
44 darkPaint.setColor(0xFF404040); | 44 darkPaint.setColor(sk_tool_utils::color_to_565(0xFF404040)); |
45 SkPaint lightPaint; | 45 SkPaint lightPaint; |
46 lightPaint.setColor(0xFFA0A0A0); | 46 lightPaint.setColor(sk_tool_utils::color_to_565(0xFFA0A0A0)); |
47 for (int y = 0; y < 64; y += 32) { | 47 for (int y = 0; y < 64; y += 32) { |
48 for (int x = 0; x < 64; x += 32) { | 48 for (int x = 0; x < 64; x += 32) { |
49 canvas.save(); | 49 canvas.save(); |
50 canvas.translate(SkIntToScalar(x), SkIntToScalar(y)); | 50 canvas.translate(SkIntToScalar(x), SkIntToScalar(y)); |
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 } |
(...skipping 29 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 |