OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 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 #include "SampleCode.h" | 8 #include "SampleCode.h" |
9 #include "SkBlurMask.h" | 9 #include "SkBlurMask.h" |
10 #include "SkBlurMaskFilter.h" | 10 #include "SkBlurMaskFilter.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 | 117 |
118 scale_to_width(&fPath, fWidth); | 118 scale_to_width(&fPath, fWidth); |
119 const SkRect& bounds = fPath.getBounds(); | 119 const SkRect& bounds = fPath.getBounds(); |
120 fPath.offset(-bounds.fLeft, -bounds.fTop); | 120 fPath.offset(-bounds.fLeft, -bounds.fTop); |
121 | 121 |
122 this->setBGColor(0xFFDDDDDD); | 122 this->setBGColor(0xFFDDDDDD); |
123 } | 123 } |
124 | 124 |
125 protected: | 125 protected: |
126 // overrides from SkEventSink | 126 // overrides from SkEventSink |
127 virtual bool onQuery(SkEvent* evt) SK_OVERRIDE { | 127 bool onQuery(SkEvent* evt) SK_OVERRIDE { |
128 if (SampleCode::TitleQ(*evt)) { | 128 if (SampleCode::TitleQ(*evt)) { |
129 SampleCode::TitleR(evt, "StrokePath"); | 129 SampleCode::TitleR(evt, "StrokePath"); |
130 return true; | 130 return true; |
131 } | 131 } |
132 return this->INHERITED::onQuery(evt); | 132 return this->INHERITED::onQuery(evt); |
133 } | 133 } |
134 | 134 |
135 SkRandom rand; | 135 SkRandom rand; |
136 | 136 |
137 void drawSet(SkCanvas* canvas, SkPaint* paint) { | 137 void drawSet(SkCanvas* canvas, SkPaint* paint) { |
138 SkAutoCanvasRestore acr(canvas, true); | 138 SkAutoCanvasRestore acr(canvas, true); |
139 | 139 |
140 for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); i++) { | 140 for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); i++) { |
141 paint->setStyle(gRec[i].fStyle); | 141 paint->setStyle(gRec[i].fStyle); |
142 paint->setStrokeJoin(gRec[i].fJoin); | 142 paint->setStrokeJoin(gRec[i].fJoin); |
143 paint->setStrokeWidth(SkIntToScalar(gRec[i].fStrokeWidth)); | 143 paint->setStrokeWidth(SkIntToScalar(gRec[i].fStrokeWidth)); |
144 canvas->drawPath(fPath, *paint); | 144 canvas->drawPath(fPath, *paint); |
145 canvas->translate(fWidth * 5 / 4, 0); | 145 canvas->translate(fWidth * 5 / 4, 0); |
146 } | 146 } |
147 } | 147 } |
148 | 148 |
149 virtual void onDrawContent(SkCanvas* canvas) SK_OVERRIDE { | 149 void onDrawContent(SkCanvas* canvas) SK_OVERRIDE { |
150 test_huge_stroke(canvas); return; | 150 test_huge_stroke(canvas); return; |
151 canvas->translate(SkIntToScalar(10), SkIntToScalar(10)); | 151 canvas->translate(SkIntToScalar(10), SkIntToScalar(10)); |
152 | 152 |
153 SkPaint paint; | 153 SkPaint paint; |
154 paint.setAntiAlias(true); | 154 paint.setAntiAlias(true); |
155 | 155 |
156 if (true) { | 156 if (true) { |
157 canvas->drawColor(SK_ColorBLACK); | 157 canvas->drawColor(SK_ColorBLACK); |
158 | 158 |
159 paint.setTextSize(24); | 159 paint.setTextSize(24); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 return this->INHERITED::onFindClickHandler(x, y, modi); | 215 return this->INHERITED::onFindClickHandler(x, y, modi); |
216 } | 216 } |
217 private: | 217 private: |
218 typedef SampleView INHERITED; | 218 typedef SampleView INHERITED; |
219 }; | 219 }; |
220 | 220 |
221 ////////////////////////////////////////////////////////////////////////////// | 221 ////////////////////////////////////////////////////////////////////////////// |
222 | 222 |
223 static SkView* MyFactory() { return new StrokePathView; } | 223 static SkView* MyFactory() { return new StrokePathView; } |
224 static SkViewRegister reg(MyFactory); | 224 static SkViewRegister reg(MyFactory); |
OLD | NEW |