| 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 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 fWriter.write(texCoords, SkPatchUtils::kNumCorners * sizeof(SkPoint)); | 792 fWriter.write(texCoords, SkPatchUtils::kNumCorners * sizeof(SkPoint)); |
| 793 } | 793 } |
| 794 if (flag & DRAW_VERTICES_HAS_XFER) { | 794 if (flag & DRAW_VERTICES_HAS_XFER) { |
| 795 SkXfermode::Mode mode = SkXfermode::kModulate_Mode; | 795 SkXfermode::Mode mode = SkXfermode::kModulate_Mode; |
| 796 xmode->asMode(&mode); | 796 xmode->asMode(&mode); |
| 797 this->addInt(mode); | 797 this->addInt(mode); |
| 798 } | 798 } |
| 799 this->validate(initialOffset, size); | 799 this->validate(initialOffset, size); |
| 800 } | 800 } |
| 801 | 801 |
| 802 void SkPictureRecord::drawData(const void* data, size_t length) { | |
| 803 // op + length + 'length' worth of data | |
| 804 size_t size = 2 * kUInt32Size + SkAlign4(length); | |
| 805 size_t initialOffset = this->addDraw(DRAW_DATA, &size); | |
| 806 this->addInt(SkToInt(length)); | |
| 807 fWriter.writePad(data, length); | |
| 808 this->validate(initialOffset, size); | |
| 809 } | |
| 810 | |
| 811 void SkPictureRecord::beginCommentGroup(const char* description) { | 802 void SkPictureRecord::beginCommentGroup(const char* description) { |
| 812 // op/size + length of string + \0 terminated chars | 803 // op/size + length of string + \0 terminated chars |
| 813 size_t length = strlen(description); | 804 size_t length = strlen(description); |
| 814 size_t size = 2 * kUInt32Size + SkAlign4(length + 1); | 805 size_t size = 2 * kUInt32Size + SkAlign4(length + 1); |
| 815 size_t initialOffset = this->addDraw(BEGIN_COMMENT_GROUP, &size); | 806 size_t initialOffset = this->addDraw(BEGIN_COMMENT_GROUP, &size); |
| 816 fWriter.writeString(description, length); | 807 fWriter.writeString(description, length); |
| 817 this->validate(initialOffset, size); | 808 this->validate(initialOffset, size); |
| 818 } | 809 } |
| 819 | 810 |
| 820 void SkPictureRecord::addComment(const char* kywd, const char* value) { | 811 void SkPictureRecord::addComment(const char* kywd, const char* value) { |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1001 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) { | 992 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) { |
| 1002 int index = fTextBlobRefs.count(); | 993 int index = fTextBlobRefs.count(); |
| 1003 *fTextBlobRefs.append() = blob; | 994 *fTextBlobRefs.append() = blob; |
| 1004 blob->ref(); | 995 blob->ref(); |
| 1005 // follow the convention of recording a 1-based index | 996 // follow the convention of recording a 1-based index |
| 1006 this->addInt(index + 1); | 997 this->addInt(index + 1); |
| 1007 } | 998 } |
| 1008 | 999 |
| 1009 /////////////////////////////////////////////////////////////////////////////// | 1000 /////////////////////////////////////////////////////////////////////////////// |
| 1010 | 1001 |
| OLD | NEW |