| 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 "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 | 329 |
| 330 void drawPicture(SkCanvas* canvas, int spriteOffset) { | 330 void drawPicture(SkCanvas* canvas, int spriteOffset) { |
| 331 SkMatrix matrix; matrix.reset(); | 331 SkMatrix matrix; matrix.reset(); |
| 332 SkPaint paint; | 332 SkPaint paint; |
| 333 SkPath path; | 333 SkPath path; |
| 334 SkPoint start = {0, 0}; | 334 SkPoint start = {0, 0}; |
| 335 SkPoint stop = { SkIntToScalar(40), SkIntToScalar(40) }; | 335 SkPoint stop = { SkIntToScalar(40), SkIntToScalar(40) }; |
| 336 SkRect rect = {0, 0, SkIntToScalar(40), SkIntToScalar(40) }; | 336 SkRect rect = {0, 0, SkIntToScalar(40), SkIntToScalar(40) }; |
| 337 SkRect rect2 = {0, 0, SkIntToScalar(65), SkIntToScalar(20) }; | 337 SkRect rect2 = {0, 0, SkIntToScalar(65), SkIntToScalar(20) }; |
| 338 SkScalar left = 0, top = 0, x = 0, y = 0; | 338 SkScalar left = 0, top = 0, x = 0, y = 0; |
| 339 size_t index; | 339 int index; |
| 340 | 340 |
| 341 char ascii[] = "ascii..."; | 341 char ascii[] = "ascii..."; |
| 342 size_t asciiLength = sizeof(ascii) - 1; | 342 int asciiLength = sizeof(ascii) - 1; |
| 343 char utf8[] = "utf8" "\xe2\x80\xa6"; | 343 char utf8[] = "utf8" "\xe2\x80\xa6"; |
| 344 short utf16[] = {'u', 't', 'f', '1', '6', 0x2026 }; | 344 short utf16[] = {'u', 't', 'f', '1', '6', 0x2026 }; |
| 345 short utf16simple[] = {'u', 't', 'f', '1', '6', '!' }; | 345 short utf16simple[] = {'u', 't', 'f', '1', '6', '!' }; |
| 346 | 346 |
| 347 makePath(path); | 347 makePath(path); |
| 348 SkTDArray<SkPoint>(pos); | 348 SkTDArray<SkPoint>(pos); |
| 349 pos.setCount(asciiLength); | 349 pos.setCount(asciiLength); |
| 350 for (index = 0; index < asciiLength; index++) | 350 for (index = 0; index < asciiLength; index++) |
| 351 pos[index].set(SkIntToScalar((unsigned int)index * 10), | 351 pos[index].set(SkIntToScalar((unsigned int)index * 10), |
| 352 SkIntToScalar((unsigned int)index * 2)); | 352 SkIntToScalar((unsigned int)index * 2)); |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 SkPaint paint; | 595 SkPaint paint; |
| 596 | 596 |
| 597 paint.setAntiAlias(true); | 597 paint.setAntiAlias(true); |
| 598 paint.setTextSize(SkIntToScalar(48)); | 598 paint.setTextSize(SkIntToScalar(48)); |
| 599 paint.setTypeface(SkTypeface::CreateFromName("sans-serif", | 599 paint.setTypeface(SkTypeface::CreateFromName("sans-serif", |
| 600 SkTypeface::kBold)); | 600 SkTypeface::kBold)); |
| 601 | 601 |
| 602 SkString str("GOOGLE"); | 602 SkString str("GOOGLE"); |
| 603 | 603 |
| 604 for (size_t i = 0; i < SK_ARRAY_COUNT(gRastProcs); i++) { | 604 for (size_t i = 0; i < SK_ARRAY_COUNT(gRastProcs); i++) { |
| 605 apply_shader(&paint, i); | 605 apply_shader(&paint, (int)i); |
| 606 | 606 |
| 607 // paint.setMaskFilter(NULL); | 607 // paint.setMaskFilter(NULL); |
| 608 // paint.setColor(SK_ColorBLACK); | 608 // paint.setColor(SK_ColorBLACK); |
| 609 | 609 |
| 610 #if 01 | 610 #if 01 |
| 611 int index = i % SK_ARRAY_COUNT(gLightingColors); | 611 int index = i % SK_ARRAY_COUNT(gLightingColors); |
| 612 paint.setColorFilter(SkColorFilter::CreateLightingFilter( | 612 paint.setColorFilter(SkColorFilter::CreateLightingFilter( |
| 613 gLightingColors[index].fMul, | 613 gLightingColors[index].fMul, |
| 614 gLightingColors[index].fAdd))->unref(); | 614 gLightingColors[index].fAdd))->unref(); |
| 615 #endif | 615 #endif |
| (...skipping 25 matching lines...) Expand all Loading... |
| 641 private: | 641 private: |
| 642 SkPoint fClickPt; | 642 SkPoint fClickPt; |
| 643 SkBitmap fBug, fTb, fTx; | 643 SkBitmap fBug, fTb, fTx; |
| 644 typedef SampleView INHERITED; | 644 typedef SampleView INHERITED; |
| 645 }; | 645 }; |
| 646 | 646 |
| 647 ////////////////////////////////////////////////////////////////////////////// | 647 ////////////////////////////////////////////////////////////////////////////// |
| 648 | 648 |
| 649 static SkView* MyFactory() { return new DemoView; } | 649 static SkView* MyFactory() { return new DemoView; } |
| 650 static SkViewRegister reg(MyFactory); | 650 static SkViewRegister reg(MyFactory); |
| OLD | NEW |