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 "SkBBoxHierarchy.h" | 9 #include "SkBBoxHierarchy.h" |
10 #include "SkDevice.h" | 10 #include "SkDevice.h" |
(...skipping 1526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1537 fWriter.writeRegion(region); | 1537 fWriter.writeRegion(region); |
1538 } | 1538 } |
1539 | 1539 |
1540 void SkPictureRecord::addText(const void* text, size_t byteLength) { | 1540 void SkPictureRecord::addText(const void* text, size_t byteLength) { |
1541 fContentInfo.onDrawText(); | 1541 fContentInfo.onDrawText(); |
1542 addInt(SkToInt(byteLength)); | 1542 addInt(SkToInt(byteLength)); |
1543 fWriter.writePad(text, byteLength); | 1543 fWriter.writePad(text, byteLength); |
1544 } | 1544 } |
1545 | 1545 |
1546 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) { | 1546 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) { |
1547 int index = fTextBlobRefs.find(blob); | 1547 int index = fTextBlobRefs.count(); |
1548 if (index < 0) { // not found | 1548 *fTextBlobRefs.append() = blob; |
1549 index = fTextBlobRefs.count(); | 1549 blob->ref(); |
1550 *fTextBlobRefs.append() = blob; | |
1551 blob->ref(); | |
1552 } | |
1553 // follow the convention of recording a 1-based index | 1550 // follow the convention of recording a 1-based index |
1554 this->addInt(index + 1); | 1551 this->addInt(index + 1); |
1555 } | 1552 } |
1556 | 1553 |
1557 /////////////////////////////////////////////////////////////////////////////// | 1554 /////////////////////////////////////////////////////////////////////////////// |
1558 | 1555 |
OLD | NEW |