| 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 "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkColorFilter.h" | 10 #include "SkColorFilter.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 return SkString("imagefilterscropexpand"); | 34 return SkString("imagefilterscropexpand"); |
| 35 } | 35 } |
| 36 | 36 |
| 37 virtual SkISize onISize() { return SkISize::Make(570, 650); } | 37 virtual SkISize onISize() { return SkISize::Make(570, 650); } |
| 38 | 38 |
| 39 void make_checkerboard(SkBitmap* bitmap) { | 39 void make_checkerboard(SkBitmap* bitmap) { |
| 40 bitmap->allocN32Pixels(64, 64); | 40 bitmap->allocN32Pixels(64, 64); |
| 41 SkCanvas canvas(*bitmap); | 41 SkCanvas canvas(*bitmap); |
| 42 canvas.clear(0xFFFF0000); | 42 canvas.clear(0xFFFF0000); |
| 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 = 8; y < 48; y += 16) { | 47 for (int y = 8; y < 48; y += 16) { |
| 48 for (int x = 8; x < 48; x += 16) { | 48 for (int x = 8; x < 48; x += 16) { |
| 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, 8, 8), darkPaint); | 51 canvas.drawRect(SkRect::MakeXYWH(0, 0, 8, 8), darkPaint); |
| 52 canvas.drawRect(SkRect::MakeXYWH(8, 0, 8, 8), lightPaint); | 52 canvas.drawRect(SkRect::MakeXYWH(8, 0, 8, 8), lightPaint); |
| 53 canvas.drawRect(SkRect::MakeXYWH(0, 8, 8, 8), lightPaint); | 53 canvas.drawRect(SkRect::MakeXYWH(0, 8, 8, 8), lightPaint); |
| 54 canvas.drawRect(SkRect::MakeXYWH(8, 8, 8, 8), darkPaint); | 54 canvas.drawRect(SkRect::MakeXYWH(8, 8, 8, 8), darkPaint); |
| 55 canvas.restore(); | 55 canvas.restore(); |
| 56 } | 56 } |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 } | 162 } |
| 163 | 163 |
| 164 private: | 164 private: |
| 165 typedef GM INHERITED; | 165 typedef GM INHERITED; |
| 166 }; | 166 }; |
| 167 | 167 |
| 168 /////////////////////////////////////////////////////////////////////////////// | 168 /////////////////////////////////////////////////////////////////////////////// |
| 169 | 169 |
| 170 static skiagm::GM* MyFactory(void*) { return new ImageFiltersCropExpandGM; } | 170 static skiagm::GM* MyFactory(void*) { return new ImageFiltersCropExpandGM; } |
| 171 static skiagm::GMRegistry reg(MyFactory); | 171 static skiagm::GMRegistry reg(MyFactory); |
| OLD | NEW |