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 "SkTextBlobRunIterator.h" | 8 #include "SkTextBlobRunIterator.h" |
9 | 9 |
10 #include "SkReadBuffer.h" | 10 #include "SkReadBuffer.h" |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 SkASSERT((fRunCount > 0) == (nullptr != fStorage.get())); | 617 SkASSERT((fRunCount > 0) == (nullptr != fStorage.get())); |
618 | 618 |
619 this->updateDeferredBounds(); | 619 this->updateDeferredBounds(); |
620 | 620 |
621 if (0 == fRunCount) { | 621 if (0 == fRunCount) { |
622 SkASSERT(nullptr == fStorage.get()); | 622 SkASSERT(nullptr == fStorage.get()); |
623 fStorageUsed = sizeof(SkTextBlob); | 623 fStorageUsed = sizeof(SkTextBlob); |
624 fStorage.realloc(fStorageUsed); | 624 fStorage.realloc(fStorageUsed); |
625 } | 625 } |
626 | 626 |
627 const SkTextBlob* blob = new (fStorage.detach()) SkTextBlob(fRunCount, fBoun
ds); | 627 const SkTextBlob* blob = new (fStorage.release()) SkTextBlob(fRunCount, fBou
nds); |
628 SkDEBUGCODE(const_cast<SkTextBlob*>(blob)->fStorageSize = fStorageSize;) | 628 SkDEBUGCODE(const_cast<SkTextBlob*>(blob)->fStorageSize = fStorageSize;) |
629 | 629 |
630 SkDEBUGCODE( | 630 SkDEBUGCODE( |
631 size_t validateSize = sizeof(SkTextBlob); | 631 size_t validateSize = sizeof(SkTextBlob); |
632 const SkTextBlob::RunRecord* run = SkTextBlob::RunRecord::First(blob); | 632 const SkTextBlob::RunRecord* run = SkTextBlob::RunRecord::First(blob); |
633 for (int i = 0; i < fRunCount; ++i) { | 633 for (int i = 0; i < fRunCount; ++i) { |
634 validateSize += SkTextBlob::RunRecord::StorageSize(run->fCount, run-
>fPositioning); | 634 validateSize += SkTextBlob::RunRecord::StorageSize(run->fCount, run-
>fPositioning); |
635 run->validate(reinterpret_cast<const uint8_t*>(blob) + fStorageUsed)
; | 635 run->validate(reinterpret_cast<const uint8_t*>(blob) + fStorageUsed)
; |
636 run = SkTextBlob::RunRecord::Next(run); | 636 run = SkTextBlob::RunRecord::Next(run); |
637 } | 637 } |
638 SkASSERT(validateSize == fStorageUsed); | 638 SkASSERT(validateSize == fStorageUsed); |
639 ) | 639 ) |
640 | 640 |
641 fStorageUsed = 0; | 641 fStorageUsed = 0; |
642 fStorageSize = 0; | 642 fStorageSize = 0; |
643 fRunCount = 0; | 643 fRunCount = 0; |
644 fLastRun = 0; | 644 fLastRun = 0; |
645 fBounds.setEmpty(); | 645 fBounds.setEmpty(); |
646 | 646 |
647 return blob; | 647 return blob; |
648 } | 648 } |
649 | 649 |
OLD | NEW |