OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "gm.h" | 8 #include "gm.h" |
9 #include "SkRandom.h" | 9 #include "SkRandom.h" |
10 #include "SkRRect.h" | 10 #include "SkRRect.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 shapePaint.setAntiAlias(fDoAA); | 66 shapePaint.setAntiAlias(fDoAA); |
67 | 67 |
68 SkRect outerRect = SkRect::MakeWH(40, 40); | 68 SkRect outerRect = SkRect::MakeWH(40, 40); |
69 | 69 |
70 SkRect innerRects[] = { | 70 SkRect innerRects[] = { |
71 { 10, 10, 30, 30 }, // small | 71 { 10, 10, 30, 30 }, // small |
72 { .5f, 18, 4.5f, 22 } // smaller and offset to left | 72 { .5f, 18, 4.5f, 22 } // smaller and offset to left |
73 }; | 73 }; |
74 | 74 |
75 // draw a background pattern to make transparency errors more apparent | 75 // draw a background pattern to make transparency errors more apparent |
76 SkMWCRandom rand; | 76 SkRandom rand; |
77 | 77 |
78 for (int y = 0; y < kImageHeight; y += 10) { | 78 for (int y = 0; y < kImageHeight; y += 10) { |
79 for (int x = 0; x < kImageWidth; x += 10) { | 79 for (int x = 0; x < kImageWidth; x += 10) { |
80 SkRect r = SkRect::MakeXYWH(SkIntToScalar(x), | 80 SkRect r = SkRect::MakeXYWH(SkIntToScalar(x), |
81 SkIntToScalar(y), | 81 SkIntToScalar(y), |
82 10, 10); | 82 10, 10); |
83 SkPaint p; | 83 SkPaint p; |
84 p.setColor(rand.nextU() | 0xFF000000); | 84 p.setColor(rand.nextU() | 0xFF000000); |
85 canvas->drawRect(r, p); | 85 canvas->drawRect(r, p); |
86 } | 86 } |
(...skipping 29 matching lines...) Expand all Loading... |
116 typedef GM INHERITED; | 116 typedef GM INHERITED; |
117 }; | 117 }; |
118 | 118 |
119 /////////////////////////////////////////////////////////////////////////////// | 119 /////////////////////////////////////////////////////////////////////////////// |
120 | 120 |
121 DEF_GM( return new NestedGM(true); ) | 121 DEF_GM( return new NestedGM(true); ) |
122 DEF_GM( return new NestedGM(false); ) | 122 DEF_GM( return new NestedGM(false); ) |
123 | 123 |
124 | 124 |
125 } | 125 } |
OLD | NEW |