OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkColorFilter.h" | 10 #include "SkColorFilter.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 return SkString("imagefilterscropped"); | 100 return SkString("imagefilterscropped"); |
101 } | 101 } |
102 | 102 |
103 virtual SkISize onISize() override { return SkISize::Make(400, 880); } | 103 virtual SkISize onISize() override { return SkISize::Make(400, 880); } |
104 | 104 |
105 void make_checkerboard() { | 105 void make_checkerboard() { |
106 fCheckerboard.allocN32Pixels(80, 80); | 106 fCheckerboard.allocN32Pixels(80, 80); |
107 SkCanvas canvas(fCheckerboard); | 107 SkCanvas canvas(fCheckerboard); |
108 canvas.clear(SK_ColorTRANSPARENT); | 108 canvas.clear(SK_ColorTRANSPARENT); |
109 SkPaint darkPaint; | 109 SkPaint darkPaint; |
110 darkPaint.setColor(0xFF404040); | 110 darkPaint.setColor(sk_tool_utils::color_to_565(0xFF404040)); |
111 SkPaint lightPaint; | 111 SkPaint lightPaint; |
112 lightPaint.setColor(0xFFA0A0A0); | 112 lightPaint.setColor(sk_tool_utils::color_to_565(0xFFA0A0A0)); |
113 for (int y = 0; y < 80; y += 16) { | 113 for (int y = 0; y < 80; y += 16) { |
114 for (int x = 0; x < 80; x += 16) { | 114 for (int x = 0; x < 80; x += 16) { |
115 canvas.save(); | 115 canvas.save(); |
116 canvas.translate(SkIntToScalar(x), SkIntToScalar(y)); | 116 canvas.translate(SkIntToScalar(x), SkIntToScalar(y)); |
117 canvas.drawRect(SkRect::MakeXYWH(0, 0, 8, 8), darkPaint); | 117 canvas.drawRect(SkRect::MakeXYWH(0, 0, 8, 8), darkPaint); |
118 canvas.drawRect(SkRect::MakeXYWH(8, 0, 8, 8), lightPaint); | 118 canvas.drawRect(SkRect::MakeXYWH(8, 0, 8, 8), lightPaint); |
119 canvas.drawRect(SkRect::MakeXYWH(0, 8, 8, 8), lightPaint); | 119 canvas.drawRect(SkRect::MakeXYWH(0, 8, 8, 8), lightPaint); |
120 canvas.drawRect(SkRect::MakeXYWH(8, 8, 8, 8), darkPaint); | 120 canvas.drawRect(SkRect::MakeXYWH(8, 8, 8, 8), darkPaint); |
121 canvas.restore(); | 121 canvas.restore(); |
122 } | 122 } |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 | 193 |
194 private: | 194 private: |
195 SkBitmap fCheckerboard; | 195 SkBitmap fCheckerboard; |
196 typedef GM INHERITED; | 196 typedef GM INHERITED; |
197 }; | 197 }; |
198 | 198 |
199 /////////////////////////////////////////////////////////////////////////////// | 199 /////////////////////////////////////////////////////////////////////////////// |
200 | 200 |
201 static skiagm::GM* MyFactory(void*) { return new ImageFiltersCroppedGM; } | 201 static skiagm::GM* MyFactory(void*) { return new ImageFiltersCroppedGM; } |
202 static skiagm::GMRegistry reg(MyFactory); | 202 static skiagm::GMRegistry reg(MyFactory); |
OLD | NEW |