OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "SampleCode.h" | 9 #include "SampleCode.h" |
10 #include "SkRandom.h" | 10 #include "SkRandom.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 SkPaint redFill; | 93 SkPaint redFill; |
94 redFill.setColor(SK_ColorRED); | 94 redFill.setColor(SK_ColorRED); |
95 | 95 |
96 SkRect r = SkRect::MakeWH(SkIntToScalar(kWidth), SkIntToScalar(kHeight))
; | 96 SkRect r = SkRect::MakeWH(SkIntToScalar(kWidth), SkIntToScalar(kHeight))
; |
97 | 97 |
98 canvas->clear(SK_ColorWHITE); | 98 canvas->clear(SK_ColorWHITE); |
99 canvas->drawRect(r, blackStroke); | 99 canvas->drawRect(r, blackStroke); |
100 | 100 |
101 long totArea = 0; | 101 long totArea = 0; |
102 for (int i = 0; i < fCurRandRect; ++i) { | 102 for (int i = 0; i < fCurRandRect; ++i) { |
103 r = SkRect::MakeXYWH(SkIntToScalar(fRectLocations[i].fX), | 103 r = SkRect::MakeXYWH(SkIntToScalar(fRectLocations[i].fX), |
104 SkIntToScalar(fRectLocations[i].fY), | 104 SkIntToScalar(fRectLocations[i].fY), |
105 SkIntToScalar((*fCurRects)[i].fWidth), | 105 SkIntToScalar((*fCurRects)[i].fWidth), |
106 SkIntToScalar((*fCurRects)[i].fHeight)); | 106 SkIntToScalar((*fCurRects)[i].fHeight)); |
107 canvas->drawRect(r, redFill); | 107 canvas->drawRect(r, redFill); |
108 canvas->drawRect(r, blackStroke); | 108 canvas->drawRect(r, blackStroke); |
109 totArea += (*fCurRects)[i].fWidth * (*fCurRects)[i].fHeight; | 109 totArea += (*fCurRects)[i].fWidth * (*fCurRects)[i].fHeight; |
110 } | 110 } |
111 | 111 |
112 SkString str; | 112 SkString str; |
113 | 113 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 } | 189 } |
190 | 190 |
191 typedef SampleView INHERITED; | 191 typedef SampleView INHERITED; |
192 }; | 192 }; |
193 | 193 |
194 ////////////////////////////////////////////////////////////////////////////// | 194 ////////////////////////////////////////////////////////////////////////////// |
195 static SkView* MyFactory() { return new RectanizerView; } | 195 static SkView* MyFactory() { return new RectanizerView; } |
196 static SkViewRegister reg(MyFactory); | 196 static SkViewRegister reg(MyFactory); |
197 | 197 |
198 #endif | 198 #endif |
OLD | NEW |