Hal Canary | 8751512 | 2019-03-15 14:22:51 -0400 | [diff] [blame] | 1 | // Copyright 2019 Google LLC. |
| 2 | // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 3 | #include "tools/fiddle/examples.h" |
Hal Canary | 8751512 | 2019-03-15 14:22:51 -0400 | [diff] [blame] | 4 | // HASH=8b3224641cb3053a7b8a5798b6cd1cf6 |
Hal Canary | a7181e7c | 2019-03-18 16:06:34 -0400 | [diff] [blame] | 5 | REG_FIDDLE(IRect_size, 256, 256, true, 0) { |
Hal Canary | 8751512 | 2019-03-15 14:22:51 -0400 | [diff] [blame] | 6 | void draw(SkCanvas* canvas) { |
| 7 | auto debugster = [](const char* prefix, const SkIRect& rect) -> void { |
| 8 | SkISize size = rect.size(); |
| 9 | SkDebugf("%s ", prefix); |
| 10 | SkDebugf("rect: %d, %d, %d, %d ", rect.left(), rect.top(), rect.right(), rect.bottom()); |
| 11 | SkDebugf("size: %d, %d\n", size.width(), size.height()); |
| 12 | }; |
| 13 | SkIRect rect = {20, 30, 40, 50}; |
| 14 | debugster("original", rect); |
| 15 | rect.offset(20, 20); |
| 16 | debugster(" offset", rect); |
| 17 | rect.outset(20, 20); |
| 18 | debugster(" outset", rect); |
| 19 | } |
| 20 | } // END FIDDLE |