OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 | 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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 // overrides from SkEventSink | 266 // overrides from SkEventSink |
267 virtual bool onQuery(SkEvent* evt) { | 267 virtual bool onQuery(SkEvent* evt) { |
268 if (SampleCode::TitleQ(*evt)) { | 268 if (SampleCode::TitleQ(*evt)) { |
269 SampleCode::TitleR(evt, "Text"); | 269 SampleCode::TitleR(evt, "Text"); |
270 return true; | 270 return true; |
271 } | 271 } |
272 return this->INHERITED::onQuery(evt); | 272 return this->INHERITED::onQuery(evt); |
273 } | 273 } |
274 | 274 |
275 static void make_textstrip(SkBitmap* bm) { | 275 static void make_textstrip(SkBitmap* bm) { |
276 bm->setConfig(SkBitmap::kRGB_565_Config, 200, 18); | 276 bm->allocPixels(SkImageInfo::Make(200, 18, kRGB_565_SkColorType, |
277 bm->allocPixels(); | 277 kOpaque_SkAlphaType)); |
278 bm->eraseColor(SK_ColorWHITE); | 278 bm->eraseColor(SK_ColorWHITE); |
279 | 279 |
280 SkCanvas canvas(*bm); | 280 SkCanvas canvas(*bm); |
281 SkPaint paint; | 281 SkPaint paint; |
282 const char* s = "Lorem ipsum dolor sit amet, consectetuer adipiscing eli
t"; | 282 const char* s = "Lorem ipsum dolor sit amet, consectetuer adipiscing eli
t"; |
283 | 283 |
284 paint.setFlags(paint.getFlags() | SkPaint::kAntiAlias_Flag | 284 paint.setFlags(paint.getFlags() | SkPaint::kAntiAlias_Flag |
285 | SkPaint::kDevKernText_Flag); | 285 | SkPaint::kDevKernText_Flag); |
286 paint.setTextSize(SkIntToScalar(14)); | 286 paint.setTextSize(SkIntToScalar(14)); |
287 canvas.drawText(s, strlen(s), SkIntToScalar(8), SkIntToScalar(14), paint
); | 287 canvas.drawText(s, strlen(s), SkIntToScalar(8), SkIntToScalar(14), paint
); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 SkScalar fClickX; | 351 SkScalar fClickX; |
352 SkMaskFilter* fMF; | 352 SkMaskFilter* fMF; |
353 | 353 |
354 typedef SampleView INHERITED; | 354 typedef SampleView INHERITED; |
355 }; | 355 }; |
356 | 356 |
357 ////////////////////////////////////////////////////////////////////////////// | 357 ////////////////////////////////////////////////////////////////////////////// |
358 | 358 |
359 static SkView* MyFactory() { return new TextSpeedView; } | 359 static SkView* MyFactory() { return new TextSpeedView; } |
360 static SkViewRegister reg(MyFactory); | 360 static SkViewRegister reg(MyFactory); |
OLD | NEW |