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 "SkPictureRecord.h" | 8 #include "SkPictureRecord.h" |
9 #include "SkDevice.h" | 9 #include "SkDevice.h" |
10 #include "SkPatchUtils.h" | 10 #include "SkPatchUtils.h" |
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
634 size_t initialOffset = this->addDraw(DRAW_POS_TEXT_H, &size); | 634 size_t initialOffset = this->addDraw(DRAW_POS_TEXT_H, &size); |
635 this->addPaint(paint); | 635 this->addPaint(paint); |
636 this->addText(text, byteLength); | 636 this->addText(text, byteLength); |
637 this->addInt(points); | 637 this->addInt(points); |
638 this->addScalar(constY); | 638 this->addScalar(constY); |
639 fWriter.writeMul4(xpos, points * sizeof(SkScalar)); | 639 fWriter.writeMul4(xpos, points * sizeof(SkScalar)); |
640 this->validate(initialOffset, size); | 640 this->validate(initialOffset, size); |
641 } | 641 } |
642 | 642 |
643 void SkPictureRecord::onDrawTextOnPath(const void* text, size_t byteLength, cons t SkPath& path, | 643 void SkPictureRecord::onDrawTextOnPath(const void* text, size_t byteLength, cons t SkPath& path, |
644 const SkMatrix* matrix, const SkPaint& pa int) { | 644 const SkMatrix* matrix, |
645 // op + paint index + length + 'length' worth of data + path index + matrix | 645 SK_SUPPORT_LEGACY_DRAWTEXTONPATH_PARAM con st SkPaint& paint) { |
f(malita)
2015/02/16 15:31:50
indentation
| |
646 // op + paint index + length + 'length' worth of data + path index + matrix + method | |
646 const SkMatrix& m = matrix ? *matrix : SkMatrix::I(); | 647 const SkMatrix& m = matrix ? *matrix : SkMatrix::I(); |
647 size_t size = 3 * kUInt32Size + SkAlign4(byteLength) + kUInt32Size + m.write ToMemory(NULL); | 648 size_t size = 3 * kUInt32Size + SkAlign4(byteLength) + kUInt32Size + m.write ToMemory(NULL) |
649 + sizeof(int32_t); // method | |
650 SK_SUPPORT_LEGACY_DRAWTEXTONPATH_DEFAULT_METHOD | |
648 size_t initialOffset = this->addDraw(DRAW_TEXT_ON_PATH, &size); | 651 size_t initialOffset = this->addDraw(DRAW_TEXT_ON_PATH, &size); |
649 SkASSERT(initialOffset+get_paint_offset(DRAW_TEXT_ON_PATH, size) == fWriter. bytesWritten()); | 652 SkASSERT(initialOffset+get_paint_offset(DRAW_TEXT_ON_PATH, size) == fWriter. bytesWritten()); |
650 this->addPaint(paint); | 653 this->addPaint(paint); |
651 this->addText(text, byteLength); | 654 this->addText(text, byteLength); |
652 this->addPath(path); | 655 this->addPath(path); |
653 this->addMatrix(m); | 656 this->addMatrix(m); |
657 this->addInt(method); | |
654 this->validate(initialOffset, size); | 658 this->validate(initialOffset, size); |
655 } | 659 } |
656 | 660 |
657 void SkPictureRecord::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScala r y, | 661 void SkPictureRecord::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScala r y, |
658 const SkPaint& paint) { | 662 const SkPaint& paint) { |
659 | 663 |
660 // op + paint index + blob index + x/y | 664 // op + paint index + blob index + x/y |
661 size_t size = 3 * kUInt32Size + 2 * sizeof(SkScalar); | 665 size_t size = 3 * kUInt32Size + 2 * sizeof(SkScalar); |
662 size_t initialOffset = this->addDraw(DRAW_TEXT_BLOB, &size); | 666 size_t initialOffset = this->addDraw(DRAW_TEXT_BLOB, &size); |
663 SkASSERT(initialOffset + get_paint_offset(DRAW_TEXT_BLOB, size) == fWriter.b ytesWritten()); | 667 SkASSERT(initialOffset + get_paint_offset(DRAW_TEXT_BLOB, size) == fWriter.b ytesWritten()); |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
991 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) { | 995 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) { |
992 int index = fTextBlobRefs.count(); | 996 int index = fTextBlobRefs.count(); |
993 *fTextBlobRefs.append() = blob; | 997 *fTextBlobRefs.append() = blob; |
994 blob->ref(); | 998 blob->ref(); |
995 // follow the convention of recording a 1-based index | 999 // follow the convention of recording a 1-based index |
996 this->addInt(index + 1); | 1000 this->addInt(index + 1); |
997 } | 1001 } |
998 | 1002 |
999 /////////////////////////////////////////////////////////////////////////////// | 1003 /////////////////////////////////////////////////////////////////////////////// |
1000 | 1004 |
OLD | NEW |