Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(275)

Side by Side Diff: src/core/SkTextBlob.cpp

Issue 2335493005: Use sk_sp text blob APIs (Closed)
Patch Set: SK_SUPPORT_LEGACY_TEXTBLOB_BUILDER Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « public.bzl ('k') | src/gpu/text/GrStencilAndCoverTextContext.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « public.bzl ('k') | src/gpu/text/GrStencilAndCoverTextContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698