OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2015 Google Inc. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. |
| 6 */ |
| 7 |
| 8 #include "gm.h" |
| 9 #include "sk_tool_utils.h" |
| 10 #include "Resources.h" |
| 11 |
| 12 DEF_SIMPLE_GM(repeated_bitmap, canvas, 576, 576) { |
| 13 sk_tool_utils::draw_checkerboard(canvas, 0xFF999999, SK_ColorWHITE, 12); |
| 14 SkRect rect = SkRect::MakeLTRB(-4.25f, -4.25f, 4.25f, 4.25f); |
| 15 SkPaint paint; |
| 16 paint.setColor(0xFF333333); |
| 17 SkBitmap bm; |
| 18 if (GetResourceAsBitmap("randPixels.png", &bm)) { |
| 19 for (int j = 0; j < 4; ++j) { |
| 20 for (int i = 0; i < 4; ++i) { |
| 21 SkAutoCanvasRestore autoCanvasRestore(canvas, true); |
| 22 canvas->scale(12.0f, 12.0f); |
| 23 canvas->translate(6.0f + 12.0f * SkIntToScalar(i), |
| 24 6.0f + 12.0f * SkIntToScalar(j)); |
| 25 canvas->rotate(18.0f * (i + 4 * j)); |
| 26 canvas->drawRect(rect, paint); |
| 27 canvas->drawBitmap(bm, -4.0f, -4.0f); |
| 28 } |
| 29 } |
| 30 } |
| 31 } |
OLD | NEW |