OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkPatchUtils.h" | 9 #include "SkPatchUtils.h" |
10 #include "SkPictureData.h" | 10 #include "SkPictureData.h" |
11 #include "SkPicturePlayback.h" | 11 #include "SkPicturePlayback.h" |
12 #include "SkPictureRecord.h" | 12 #include "SkPictureRecord.h" |
13 #include "SkPictureStateTree.h" | 13 #include "SkPictureStateTree.h" |
14 #include "SkReader32.h" | 14 #include "SkReader32.h" |
| 15 #include "SkTextBlob.h" |
15 #include "SkTDArray.h" | 16 #include "SkTDArray.h" |
16 #include "SkTypes.h" | 17 #include "SkTypes.h" |
17 | 18 |
18 /* | 19 /* |
19 * Read the next op code and chunk size from 'reader'. The returned size | 20 * Read the next op code and chunk size from 'reader'. The returned size |
20 * is the entire size of the chunk (including the opcode). Thus, the | 21 * is the entire size of the chunk (including the opcode). Thus, the |
21 * offset just prior to calling ReadOpAndSize + 'size' is the offset | 22 * offset just prior to calling ReadOpAndSize + 'size' is the offset |
22 * to the next chunk's op code. This also means that the size of a chunk | 23 * to the next chunk's op code. This also means that the size of a chunk |
23 * with no arguments (just an opcode) will be 4. | 24 * with no arguments (just an opcode) will be 4. |
24 */ | 25 */ |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 canvas->drawSprite(bitmap, left, top, paint); | 414 canvas->drawSprite(bitmap, left, top, paint); |
414 } break; | 415 } break; |
415 case DRAW_TEXT: { | 416 case DRAW_TEXT: { |
416 const SkPaint& paint = *fPictureData->getPaint(reader); | 417 const SkPaint& paint = *fPictureData->getPaint(reader); |
417 TextContainer text; | 418 TextContainer text; |
418 get_text(reader, &text); | 419 get_text(reader, &text); |
419 SkScalar x = reader->readScalar(); | 420 SkScalar x = reader->readScalar(); |
420 SkScalar y = reader->readScalar(); | 421 SkScalar y = reader->readScalar(); |
421 canvas->drawText(text.text(), text.length(), x, y, paint); | 422 canvas->drawText(text.text(), text.length(), x, y, paint); |
422 } break; | 423 } break; |
| 424 case DRAW_TEXT_BLOB: { |
| 425 const SkPaint& paint = *fPictureData->getPaint(reader); |
| 426 const SkTextBlob* blob = fPictureData->getTextBlob(reader); |
| 427 SkScalar x = reader->readScalar(); |
| 428 SkScalar y = reader->readScalar(); |
| 429 canvas->drawTextBlob(blob, x, y, paint); |
| 430 } break; |
423 case DRAW_TEXT_TOP_BOTTOM: { | 431 case DRAW_TEXT_TOP_BOTTOM: { |
424 const SkPaint& paint = *fPictureData->getPaint(reader); | 432 const SkPaint& paint = *fPictureData->getPaint(reader); |
425 TextContainer text; | 433 TextContainer text; |
426 get_text(reader, &text); | 434 get_text(reader, &text); |
427 const SkScalar* ptr = (const SkScalar*)reader->skip(4 * sizeof(SkSca
lar)); | 435 const SkScalar* ptr = (const SkScalar*)reader->skip(4 * sizeof(SkSca
lar)); |
428 // ptr[0] == x | 436 // ptr[0] == x |
429 // ptr[1] == y | 437 // ptr[1] == y |
430 // ptr[2] == top | 438 // ptr[2] == top |
431 // ptr[3] == bottom | 439 // ptr[3] == bottom |
432 if (!canvas->quickRejectY(ptr[2], ptr[3])) { | 440 if (!canvas->quickRejectY(ptr[2], ptr[3])) { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 case TRANSLATE: { | 518 case TRANSLATE: { |
511 SkScalar dx = reader->readScalar(); | 519 SkScalar dx = reader->readScalar(); |
512 SkScalar dy = reader->readScalar(); | 520 SkScalar dy = reader->readScalar(); |
513 canvas->translate(dx, dy); | 521 canvas->translate(dx, dy); |
514 } break; | 522 } break; |
515 default: | 523 default: |
516 SkASSERT(0); | 524 SkASSERT(0); |
517 } | 525 } |
518 } | 526 } |
519 | 527 |
OLD | NEW |