OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 // This test only works with the GPU backend. | 9 // This test only works with the GPU backend. |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 /** | 27 /** |
28 * This GM directly exercises a GrProcessor that draws convex polygons. | 28 * This GM directly exercises a GrProcessor that draws convex polygons. |
29 */ | 29 */ |
30 class ConvexPolyEffect : public GM { | 30 class ConvexPolyEffect : public GM { |
31 public: | 31 public: |
32 ConvexPolyEffect() { | 32 ConvexPolyEffect() { |
33 this->setBGColor(0xFFFFFFFF); | 33 this->setBGColor(0xFFFFFFFF); |
34 } | 34 } |
35 | 35 |
36 protected: | 36 protected: |
37 virtual SkString onShortName() SK_OVERRIDE { | 37 SkString onShortName() SK_OVERRIDE { |
38 return SkString("convex_poly_effect"); | 38 return SkString("convex_poly_effect"); |
39 } | 39 } |
40 | 40 |
41 virtual SkISize onISize() SK_OVERRIDE { | 41 SkISize onISize() SK_OVERRIDE { |
42 return SkISize::Make(720, 800); | 42 return SkISize::Make(720, 800); |
43 } | 43 } |
44 | 44 |
45 virtual uint32_t onGetFlags() const SK_OVERRIDE { | 45 uint32_t onGetFlags() const SK_OVERRIDE { |
46 // This is a GPU-specific GM. | 46 // This is a GPU-specific GM. |
47 return kGPUOnly_Flag; | 47 return kGPUOnly_Flag; |
48 } | 48 } |
49 | 49 |
50 virtual void onOnceBeforeDraw() SK_OVERRIDE { | 50 void onOnceBeforeDraw() SK_OVERRIDE { |
51 SkPath tri; | 51 SkPath tri; |
52 tri.moveTo(5.f, 5.f); | 52 tri.moveTo(5.f, 5.f); |
53 tri.lineTo(100.f, 20.f); | 53 tri.lineTo(100.f, 20.f); |
54 tri.lineTo(15.f, 100.f); | 54 tri.lineTo(15.f, 100.f); |
55 | 55 |
56 fPaths.addToTail(tri); | 56 fPaths.addToTail(tri); |
57 fPaths.addToTail(SkPath())->reverseAddPath(tri); | 57 fPaths.addToTail(SkPath())->reverseAddPath(tri); |
58 | 58 |
59 tri.close(); | 59 tri.close(); |
60 fPaths.addToTail(tri); | 60 fPaths.addToTail(tri); |
(...skipping 29 matching lines...) Expand all Loading... |
90 fRects.addToTail(SkRect::MakeLTRB(5.5f, 0.5f, 29.5f, 0.75f)); | 90 fRects.addToTail(SkRect::MakeLTRB(5.5f, 0.5f, 29.5f, 0.75f)); |
91 // vertically/horizontally thin rects that don't cover pixel centers | 91 // vertically/horizontally thin rects that don't cover pixel centers |
92 fRects.addToTail(SkRect::MakeLTRB(5.55f, 0.5f, 5.75f, 24.5f)); | 92 fRects.addToTail(SkRect::MakeLTRB(5.55f, 0.5f, 5.75f, 24.5f)); |
93 fRects.addToTail(SkRect::MakeLTRB(5.5f, .05f, 29.5f, .25f)); | 93 fRects.addToTail(SkRect::MakeLTRB(5.5f, .05f, 29.5f, .25f)); |
94 // small in x and y | 94 // small in x and y |
95 fRects.addToTail(SkRect::MakeLTRB(5.05f, .55f, 5.45f, .85f)); | 95 fRects.addToTail(SkRect::MakeLTRB(5.05f, .55f, 5.45f, .85f)); |
96 // inverted in x and y | 96 // inverted in x and y |
97 fRects.addToTail(SkRect::MakeLTRB(100.f, 50.5f, 5.f, 0.5f)); | 97 fRects.addToTail(SkRect::MakeLTRB(100.f, 50.5f, 5.f, 0.5f)); |
98 } | 98 } |
99 | 99 |
100 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 100 void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
101 GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget
(); | 101 GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget
(); |
102 if (NULL == rt) { | 102 if (NULL == rt) { |
103 return; | 103 return; |
104 } | 104 } |
105 GrContext* context = rt->getContext(); | 105 GrContext* context = rt->getContext(); |
106 if (NULL == context) { | 106 if (NULL == context) { |
107 return; | 107 return; |
108 } | 108 } |
109 | 109 |
110 SkScalar y = 0; | 110 SkScalar y = 0; |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 SkTLList<SkPath> fPaths; | 228 SkTLList<SkPath> fPaths; |
229 SkTLList<SkRect> fRects; | 229 SkTLList<SkRect> fRects; |
230 | 230 |
231 typedef GM INHERITED; | 231 typedef GM INHERITED; |
232 }; | 232 }; |
233 | 233 |
234 DEF_GM( return SkNEW(ConvexPolyEffect); ) | 234 DEF_GM( return SkNEW(ConvexPolyEffect); ) |
235 } | 235 } |
236 | 236 |
237 #endif | 237 #endif |
OLD | NEW |