OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 enum SkGeomTypes { | 46 enum SkGeomTypes { |
47 kRect_GeomType, | 47 kRect_GeomType, |
48 kPath_GeomType, | 48 kPath_GeomType, |
49 kAAClip_GeomType | 49 kAAClip_GeomType |
50 }; | 50 }; |
51 | 51 |
52 SimpleClipGM(SkGeomTypes geomType) | 52 SimpleClipGM(SkGeomTypes geomType) |
53 : fGeomType(geomType) { | 53 : fGeomType(geomType) { |
54 | 54 |
55 // offset the rects a bit so we get anti-aliasing in the rect case | 55 // offset the rects a bit so we get anti-aliasing in the rect case |
56 fBase.set(SkFloatToScalar(100.65f), | 56 fBase.set(100.65f, |
57 SkFloatToScalar(100.65f), | 57 100.65f, |
58 SkFloatToScalar(150.65f), | 58 150.65f, |
59 SkFloatToScalar(150.65f)); | 59 150.65f); |
60 fRect = fBase; | 60 fRect = fBase; |
61 fRect.inset(5, 5); | 61 fRect.inset(5, 5); |
62 fRect.offset(25, 25); | 62 fRect.offset(25, 25); |
63 | 63 |
64 fBasePath.addRoundRect(fBase, SkIntToScalar(5), SkIntToScalar(5)); | 64 fBasePath.addRoundRect(fBase, SkIntToScalar(5), SkIntToScalar(5)); |
65 fRectPath.addRoundRect(fRect, SkIntToScalar(5), SkIntToScalar(5)); | 65 fRectPath.addRoundRect(fRect, SkIntToScalar(5), SkIntToScalar(5)); |
66 INHERITED::setBGColor(0xFFDDDDDD); | 66 INHERITED::setBGColor(0xFFDDDDDD); |
67 } | 67 } |
68 | 68 |
69 protected: | 69 protected: |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 }; | 193 }; |
194 | 194 |
195 ////////////////////////////////////////////////////////////////////////////// | 195 ////////////////////////////////////////////////////////////////////////////// |
196 | 196 |
197 // rects | 197 // rects |
198 DEF_GM( return new SimpleClipGM(SimpleClipGM::kRect_GeomType); ) | 198 DEF_GM( return new SimpleClipGM(SimpleClipGM::kRect_GeomType); ) |
199 DEF_GM( return new SimpleClipGM(SimpleClipGM::kPath_GeomType); ) | 199 DEF_GM( return new SimpleClipGM(SimpleClipGM::kPath_GeomType); ) |
200 DEF_GM( return new SimpleClipGM(SimpleClipGM::kAAClip_GeomType); ) | 200 DEF_GM( return new SimpleClipGM(SimpleClipGM::kAAClip_GeomType); ) |
201 | 201 |
202 } | 202 } |
OLD | NEW |