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 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 , fRunCount(0) | 479 , fRunCount(0) |
480 , fDeferredBounds(false) | 480 , fDeferredBounds(false) |
481 , fLastRun(0) { | 481 , fLastRun(0) { |
482 fBounds.setEmpty(); | 482 fBounds.setEmpty(); |
483 } | 483 } |
484 | 484 |
485 SkTextBlobBuilder::~SkTextBlobBuilder() { | 485 SkTextBlobBuilder::~SkTextBlobBuilder() { |
486 if (nullptr != fStorage.get()) { | 486 if (nullptr != fStorage.get()) { |
487 // We are abandoning runs and must destruct the associated font data. | 487 // We are abandoning runs and must destruct the associated font data. |
488 // The easiest way to accomplish that is to use the blob destructor. | 488 // The easiest way to accomplish that is to use the blob destructor. |
489 build()->unref(); | 489 this->make(); |
490 } | 490 } |
491 } | 491 } |
492 | 492 |
493 SkRect SkTextBlobBuilder::TightRunBounds(const SkTextBlob::RunRecord& run) { | 493 SkRect SkTextBlobBuilder::TightRunBounds(const SkTextBlob::RunRecord& run) { |
494 SkRect bounds; | 494 SkRect bounds; |
495 SkPaint paint; | 495 SkPaint paint; |
496 run.font().applyToPaint(&paint); | 496 run.font().applyToPaint(&paint); |
497 | 497 |
498 if (SkTextBlob::kDefault_Positioning == run.positioning()) { | 498 if (SkTextBlob::kDefault_Positioning == run.positioning()) { |
499 paint.measureText(run.glyphBuffer(), run.glyphCount() * sizeof(uint16_t)
, &bounds); | 499 paint.measureText(run.glyphBuffer(), run.glyphCount() * sizeof(uint16_t)
, &bounds); |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
770 ) | 770 ) |
771 | 771 |
772 fStorageUsed = 0; | 772 fStorageUsed = 0; |
773 fStorageSize = 0; | 773 fStorageSize = 0; |
774 fRunCount = 0; | 774 fRunCount = 0; |
775 fLastRun = 0; | 775 fLastRun = 0; |
776 fBounds.setEmpty(); | 776 fBounds.setEmpty(); |
777 | 777 |
778 return sk_sp<SkTextBlob>(blob); | 778 return sk_sp<SkTextBlob>(blob); |
779 } | 779 } |
OLD | NEW |