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 "SkBlurDrawLooper.h" | 10 #include "SkBlurDrawLooper.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 r.set(SkIntToScalar(100), SkIntToScalar(100), | 98 r.set(SkIntToScalar(100), SkIntToScalar(100), |
99 SkIntToScalar(300), SkIntToScalar(300)); | 99 SkIntToScalar(300), SkIntToScalar(300)); |
100 fPath.addOval(r); | 100 fPath.addOval(r); |
101 fPath.offset(SkIntToScalar(-50), SkIntToScalar(-50)); | 101 fPath.offset(SkIntToScalar(-50), SkIntToScalar(-50)); |
102 | 102 |
103 fHOffset = SkIntToScalar(50); | 103 fHOffset = SkIntToScalar(50); |
104 } | 104 } |
105 | 105 |
106 protected: | 106 protected: |
107 // overrides from SkEventSink | 107 // overrides from SkEventSink |
108 virtual bool onQuery(SkEvent* evt) SK_OVERRIDE { | 108 bool onQuery(SkEvent* evt) SK_OVERRIDE { |
109 if (SampleCode::TitleQ(*evt)) { | 109 if (SampleCode::TitleQ(*evt)) { |
110 SampleCode::TitleR(evt, "Text On Path"); | 110 SampleCode::TitleR(evt, "Text On Path"); |
111 return true; | 111 return true; |
112 } | 112 } |
113 return this->INHERITED::onQuery(evt); | 113 return this->INHERITED::onQuery(evt); |
114 } | 114 } |
115 | 115 |
116 virtual void onDrawContent(SkCanvas* canvas) SK_OVERRIDE { | 116 void onDrawContent(SkCanvas* canvas) SK_OVERRIDE { |
117 SkPaint paint; | 117 SkPaint paint; |
118 paint.setAntiAlias(true); | 118 paint.setAntiAlias(true); |
119 paint.setTextSize(SkIntToScalar(48)); | 119 paint.setTextSize(SkIntToScalar(48)); |
120 | 120 |
121 const char* text = "Hamburgefons"; | 121 const char* text = "Hamburgefons"; |
122 size_t len = strlen(text); | 122 size_t len = strlen(text); |
123 | 123 |
124 for (int j = 0; j < REPEAT_COUNT; j++) { | 124 for (int j = 0; j < REPEAT_COUNT; j++) { |
125 SkScalar x = fHOffset; | 125 SkScalar x = fHOffset; |
126 | 126 |
(...skipping 17 matching lines...) Expand all Loading... |
144 canvas->translate(SkIntToScalar(275), 0); | 144 canvas->translate(SkIntToScalar(275), 0); |
145 textStrokePath(canvas); | 145 textStrokePath(canvas); |
146 | 146 |
147 canvas->translate(SkIntToScalar(-275), SkIntToScalar(250)); | 147 canvas->translate(SkIntToScalar(-275), SkIntToScalar(250)); |
148 textPathMatrix(canvas); | 148 textPathMatrix(canvas); |
149 | 149 |
150 if (REPEAT_COUNT > 1) | 150 if (REPEAT_COUNT > 1) |
151 this->inval(NULL); | 151 this->inval(NULL); |
152 } | 152 } |
153 | 153 |
154 virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned m
odi) SK_OVERRIDE { | 154 SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) SK_
OVERRIDE { |
155 fHints += 1; | 155 fHints += 1; |
156 this->inval(NULL); | 156 this->inval(NULL); |
157 return this->INHERITED::onFindClickHandler(x, y, modi); | 157 return this->INHERITED::onFindClickHandler(x, y, modi); |
158 } | 158 } |
159 | 159 |
160 virtual bool onClick(Click* click) SK_OVERRIDE { | 160 bool onClick(Click* click) SK_OVERRIDE { |
161 return this->INHERITED::onClick(click); | 161 return this->INHERITED::onClick(click); |
162 } | 162 } |
163 | 163 |
164 private: | 164 private: |
165 int fHints; | 165 int fHints; |
166 typedef SampleView INHERITED; | 166 typedef SampleView INHERITED; |
167 }; | 167 }; |
168 | 168 |
169 ////////////////////////////////////////////////////////////////////////////// | 169 ////////////////////////////////////////////////////////////////////////////// |
170 | 170 |
171 static SkView* MyFactory() { | 171 static SkView* MyFactory() { |
172 return new TextOnPathView; | 172 return new TextOnPathView; |
173 } | 173 } |
174 | 174 |
175 static SkViewRegister reg(MyFactory); | 175 static SkViewRegister reg(MyFactory); |
OLD | NEW |