OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 | 8 |
9 #include "gm.h" | 9 #include "gm.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
11 #include "SkPath.h" | 11 #include "SkPath.h" |
12 #include "SkRandom.h" | 12 #include "SkRandom.h" |
13 | 13 |
14 namespace skiagm { | 14 namespace skiagm { |
15 | 15 |
16 class ComplexClip2GM : public GM { | 16 class ComplexClip2GM : public GM { |
17 public: | 17 public: |
18 ComplexClip2GM(bool doPaths, bool antiAlias) | 18 ComplexClip2GM(bool doPaths, bool antiAlias) |
19 : fDoPaths(doPaths) | 19 : fDoPaths(doPaths) |
20 , fAntiAlias(antiAlias) { | 20 , fAntiAlias(antiAlias) { |
21 this->setBGColor(SkColorSetRGB(0xDD,0xA0,0xDD)); | 21 this->setBGColor(SkColorSetRGB(0xDD,0xA0,0xDD)); |
22 | 22 |
23 // offset the rects a bit so we get antialiasing even in the rect case | 23 // offset the rects a bit so we get antialiasing even in the rect case |
24 SkScalar xA = SkFloatToScalar(0.65f); | 24 SkScalar xA = 0.65f; |
25 SkScalar xB = SkFloatToScalar(10.65f); | 25 SkScalar xB = 10.65f; |
26 SkScalar xC = SkFloatToScalar(20.65f); | 26 SkScalar xC = 20.65f; |
27 SkScalar xD = SkFloatToScalar(30.65f); | 27 SkScalar xD = 30.65f; |
28 SkScalar xE = SkFloatToScalar(40.65f); | 28 SkScalar xE = 40.65f; |
29 SkScalar xF = SkFloatToScalar(50.65f); | 29 SkScalar xF = 50.65f; |
30 | 30 |
31 SkScalar yA = SkFloatToScalar(0.65f); | 31 SkScalar yA = 0.65f; |
32 SkScalar yB = SkFloatToScalar(10.65f); | 32 SkScalar yB = 10.65f; |
33 SkScalar yC = SkFloatToScalar(20.65f); | 33 SkScalar yC = 20.65f; |
34 SkScalar yD = SkFloatToScalar(30.65f); | 34 SkScalar yD = 30.65f; |
35 SkScalar yE = SkFloatToScalar(40.65f); | 35 SkScalar yE = 40.65f; |
36 SkScalar yF = SkFloatToScalar(50.65f); | 36 SkScalar yF = 50.65f; |
37 | 37 |
38 fWidth = xF - xA; | 38 fWidth = xF - xA; |
39 fHeight = yF - yA; | 39 fHeight = yF - yA; |
40 | 40 |
41 fRects[0].set(xB, yB, xE, yE); | 41 fRects[0].set(xB, yB, xE, yE); |
42 fPaths[0].addRoundRect(fRects[0], SkIntToScalar(5), SkIntToScalar(5)); | 42 fPaths[0].addRoundRect(fRects[0], SkIntToScalar(5), SkIntToScalar(5)); |
43 fRectColors[0] = SK_ColorRED; | 43 fRectColors[0] = SK_ColorRED; |
44 | 44 |
45 fRects[1].set(xA, yA, xD, yD); | 45 fRects[1].set(xA, yA, xD, yD); |
46 fPaths[1].addRoundRect(fRects[1], SkIntToScalar(5), SkIntToScalar(5)); | 46 fPaths[1].addRoundRect(fRects[1], SkIntToScalar(5), SkIntToScalar(5)); |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 | 173 |
174 // aa rects | 174 // aa rects |
175 static GM* MyFactory3(void*) { return new ComplexClip2GM(false, true); } | 175 static GM* MyFactory3(void*) { return new ComplexClip2GM(false, true); } |
176 static GMRegistry reg3(MyFactory3); | 176 static GMRegistry reg3(MyFactory3); |
177 | 177 |
178 // aa paths | 178 // aa paths |
179 static GM* MyFactory4(void*) { return new ComplexClip2GM(true, true); } | 179 static GM* MyFactory4(void*) { return new ComplexClip2GM(true, true); } |
180 static GMRegistry reg4(MyFactory4); | 180 static GMRegistry reg4(MyFactory4); |
181 | 181 |
182 } | 182 } |
OLD | NEW |