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

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

Issue 1068383003: Revert of Rearrange SkRecord with small N in mind (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 8 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/SkRecord.h ('k') | src/core/SkVarAlloc.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 /*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "SkRecord.h" 1 #include "SkRecord.h"
9 2
10 SkRecord::~SkRecord() { 3 SkRecord::~SkRecord() {
11 Destroyer destroyer; 4 Destroyer destroyer;
12 for (unsigned i = 0; i < this->count(); i++) { 5 for (unsigned i = 0; i < this->count(); i++) {
13 this->mutate<void>(i, destroyer); 6 this->mutate<void>(i, destroyer);
14 } 7 }
15 } 8 }
16 9
17 void SkRecord::grow() { 10 void SkRecord::grow() {
18 SkASSERT(fCount == fReserved); 11 SkASSERT(fCount == fReserved);
19 SkASSERT(fReserved > 0); 12 fReserved = SkTMax<unsigned>(kFirstReserveCount, fReserved*2);
20 fReserved *= 2;
21 fRecords.realloc(fReserved); 13 fRecords.realloc(fReserved);
14 fTypes.realloc(fReserved);
22 } 15 }
23 16
24 size_t SkRecord::bytesUsed() const { 17 size_t SkRecord::bytesUsed() const {
25 return fAlloc.approxBytesAllocated() + 18 return fAlloc.approxBytesAllocated() +
26 (fReserved - kInlineRecords) * sizeof(Record) + 19 fReserved * (sizeof(Record) + sizeof(Type8)) +
27 sizeof(SkRecord); 20 sizeof(SkRecord);
28 } 21 }
OLDNEW
« no previous file with comments | « src/core/SkRecord.h ('k') | src/core/SkVarAlloc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698