OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright 2016 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 | |
10 DEF_SIMPLE_GM(bigrect, canvas, 35, 35) { | |
11 static const SkScalar kBig = SkFloatToScalar(5e10f); | |
12 | |
13 SkPaint outlinePaint; | |
14 outlinePaint.setColor(SK_ColorBLUE); | |
15 outlinePaint.setStyle(SkPaint::kStroke_Style); | |
16 outlinePaint.setStrokeWidth(0); | |
17 | |
18 SkPaint outOfBoundsPaint; | |
19 outOfBoundsPaint.setColor(SK_ColorRED); | |
20 outOfBoundsPaint.setStyle(SkPaint::kStroke_Style); | |
21 outOfBoundsPaint.setStrokeWidth(0); | |
22 | |
23 // Looks like this: | |
24 // +-+-+--+-+------+ | |
25 // | | | | | +---+ | |
26 // | +-+ | | +---+ | |
27 // | | | | | |
28 // +------+-+------+ | |
29 // +------+-+------+ | |
30 // | | | | | |
31 // +---+ | | +-+ | | |
32 // +---+ | | | | | | |
33 // +------+-+--+-+-+ | |
34 | |
35 SkRect tl = SkRect::MakeLTRB(SkIntToScalar(5), | |
36 -kBig, | |
37 SkIntToScalar(10), | |
38 SkIntToScalar(10)); | |
39 canvas->drawRect(tl, outlinePaint); | |
40 | |
41 SkRect tr = SkRect::MakeLTRB(SkIntToScalar(25), | |
42 SkIntToScalar(5), | |
43 kBig, | |
44 SkIntToScalar(10)); | |
45 canvas->drawRect(tr, outlinePaint); | |
46 | |
47 SkRect br = SkRect::MakeLTRB(SkIntToScalar(25), | |
48 SkIntToScalar(25), | |
49 SkIntToScalar(30), | |
50 kBig); | |
51 canvas->drawRect(br, outlinePaint); | |
52 | |
53 SkRect bl = SkRect::MakeLTRB(-kBig, | |
54 SkIntToScalar(25), | |
55 SkIntToScalar(10), | |
56 SkIntToScalar(30)); | |
57 canvas->drawRect(bl, outlinePaint); | |
58 | |
59 SkRect horiz = SkRect::MakeLTRB(-kBig, | |
60 SkIntToScalar(15), | |
61 kBig, | |
62 SkIntToScalar(20)); | |
63 canvas->drawRect(horiz, outlinePaint); | |
64 | |
65 SkRect vert = SkRect::MakeLTRB(SkIntToScalar(15), | |
66 -kBig, | |
67 SkIntToScalar(20), | |
68 kBig); | |
69 canvas->drawRect(vert, outlinePaint); | |
70 | |
71 SkRect leftBorder = SkRect::MakeLTRB(-2, -1, 0, 35); | |
72 canvas->drawRect(leftBorder, outlinePaint); | |
73 | |
74 SkRect topBorder = SkRect::MakeLTRB(-1, -2, 35, 0); | |
75 canvas->drawRect(topBorder, outlinePaint); | |
76 | |
77 SkRect rightBorder = SkRect::MakeLTRB(34, -1, 36, 35); | |
78 canvas->drawRect(rightBorder, outlinePaint); | |
79 | |
80 SkRect bottomBorder = SkRect::MakeLTRB(-1, 34, 35, 36); | |
81 canvas->drawRect(bottomBorder, outlinePaint); | |
82 | |
83 SkRect outOfBounds = SkRect::MakeLTRB(-1, -1, 35, 35); | |
84 canvas->drawRect(outOfBounds, outOfBoundsPaint); | |
85 } | |
OLD | NEW |