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

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

Issue 1809733002: detach -> release (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: (C) Created 4 years, 9 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 | « src/core/SkStream.cpp ('k') | src/core/SkTypeface.cpp » ('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 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « src/core/SkStream.cpp ('k') | src/core/SkTypeface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698