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.
3 #include "tools/fiddle/examples.h"
4 // HASH=8b3224641cb3053a7b8a5798b6cd1cf6
5 REG_FIDDLE(IRect_size, 256, 256, true, 0) {
draw(SkCanvas * canvas)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
21