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 "SkView.h" | 9 #include "SkView.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 } | 46 } |
47 return this->INHERITED::onQuery(evt); | 47 return this->INHERITED::onQuery(evt); |
48 } | 48 } |
49 | 49 |
50 virtual void onDrawContent(SkCanvas* canvas) { | 50 virtual void onDrawContent(SkCanvas* canvas) { |
51 SkPaint paint; | 51 SkPaint paint; |
52 | 52 |
53 paint.setAntiAlias(true); | 53 paint.setAntiAlias(true); |
54 paint.setStyle(SkPaint::kStroke_Style); | 54 paint.setStyle(SkPaint::kStroke_Style); |
55 paint.setStrokeWidth(SkIntToScalar(10)); | 55 paint.setStrokeWidth(SkIntToScalar(10)); |
56 paint.setMaskFilter(new SkEmbossMaskFilter(fLight, SkIntToScalar(4)))->u
nref(); | 56 paint.setMaskFilter(new SkEmbossMaskFilter(SkFloatToScalar(2.8094f), fLi
ght))->unref(); |
57 paint.setShader(new SkColorShader(SK_ColorBLUE))->unref(); | 57 paint.setShader(new SkColorShader(SK_ColorBLUE))->unref(); |
58 paint.setDither(true); | 58 paint.setDither(true); |
59 | 59 |
60 canvas->drawCircle(SkIntToScalar(50), SkIntToScalar(50), | 60 canvas->drawCircle(SkIntToScalar(50), SkIntToScalar(50), |
61 SkIntToScalar(30), paint); | 61 SkIntToScalar(30), paint); |
62 } | 62 } |
63 | 63 |
64 private: | 64 private: |
65 | 65 |
66 typedef SampleView INHERITED; | 66 typedef SampleView INHERITED; |
67 }; | 67 }; |
68 | 68 |
69 ////////////////////////////////////////////////////////////////////////////// | 69 ////////////////////////////////////////////////////////////////////////////// |
70 | 70 |
71 static SkView* MyFactory() { return new EmbossView; } | 71 static SkView* MyFactory() { return new EmbossView; } |
72 static SkViewRegister reg(MyFactory); | 72 static SkViewRegister reg(MyFactory); |
OLD | NEW |