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 #include "gm.h" | 7 #include "gm.h" |
8 #include "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkPaint.h" | 9 #include "SkPaint.h" |
10 #include "Sk1DPathEffect.h" | 10 #include "Sk1DPathEffect.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 paint->setPathEffect(MakeTileEffect())->unref(); | 100 paint->setPathEffect(MakeTileEffect())->unref(); |
101 } | 101 } |
102 | 102 |
103 static const PE_Proc gPE2[] = { fill_pe, discrete_pe, tile_pe }; | 103 static const PE_Proc gPE2[] = { fill_pe, discrete_pe, tile_pe }; |
104 | 104 |
105 class PathEffectGM : public GM { | 105 class PathEffectGM : public GM { |
106 public: | 106 public: |
107 PathEffectGM() {} | 107 PathEffectGM() {} |
108 | 108 |
109 protected: | 109 protected: |
110 virtual uint32_t onGetFlags() const SK_OVERRIDE { | 110 uint32_t onGetFlags() const SK_OVERRIDE { |
111 return kSkipTiled_Flag; | 111 return kSkipTiled_Flag; |
112 } | 112 } |
113 | 113 |
114 SkString onShortName() SK_OVERRIDE { | 114 SkString onShortName() SK_OVERRIDE { |
115 return SkString("patheffect"); | 115 return SkString("patheffect"); |
116 } | 116 } |
117 | 117 |
118 SkISize onISize() SK_OVERRIDE { return SkISize::Make(800, 600); } | 118 SkISize onISize() SK_OVERRIDE { return SkISize::Make(800, 600); } |
119 | 119 |
120 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 120 void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
121 SkPaint paint; | 121 SkPaint paint; |
122 paint.setAntiAlias(true); | 122 paint.setAntiAlias(true); |
123 paint.setStyle(SkPaint::kStroke_Style); | 123 paint.setStyle(SkPaint::kStroke_Style); |
124 | 124 |
125 SkPath path; | 125 SkPath path; |
126 path.moveTo(20, 20); | 126 path.moveTo(20, 20); |
127 path.lineTo(70, 120); | 127 path.lineTo(70, 120); |
128 path.lineTo(120, 30); | 128 path.lineTo(120, 30); |
129 path.lineTo(170, 80); | 129 path.lineTo(170, 80); |
130 path.lineTo(240, 50); | 130 path.lineTo(240, 50); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 private: | 165 private: |
166 typedef GM INHERITED; | 166 typedef GM INHERITED; |
167 }; | 167 }; |
168 | 168 |
169 ////////////////////////////////////////////////////////////////////////////// | 169 ////////////////////////////////////////////////////////////////////////////// |
170 | 170 |
171 static GM* PathEffectFactory(void*) { return new PathEffectGM; } | 171 static GM* PathEffectFactory(void*) { return new PathEffectGM; } |
172 static GMRegistry regPathEffect(PathEffectFactory); | 172 static GMRegistry regPathEffect(PathEffectFactory); |
173 | 173 |
174 } | 174 } |
OLD | NEW |