blob: d561c809459ddb2502cc1b198eee9758c71120d7 [file] [log] [blame]
Hal Canary87515122019-03-15 14:22:51 -04001// 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 Kleinc0bd9f92019-04-23 12:05:21 -05003#include "tools/fiddle/examples.h"
Hal Canary87515122019-03-15 14:22:51 -04004// HASH=8b3224641cb3053a7b8a5798b6cd1cf6
Hal Canarya7181e7c2019-03-18 16:06:34 -04005REG_FIDDLE(IRect_size, 256, 256, true, 0) {
Hal Canary87515122019-03-15 14:22:51 -04006void 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