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

Unified Diff: src/core/SkRecord.cpp

Issue 1061783002: Rearrange SkRecord with small N in mind (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 32-bit fix 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkRecord.h ('k') | src/core/SkVarAlloc.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkRecord.cpp
diff --git a/src/core/SkRecord.cpp b/src/core/SkRecord.cpp
index e2d919b777448f7f1a12839b3a514b482f7762a0..c2008a850a730362e5d3b7a810c05b950ceb3eea 100644
--- a/src/core/SkRecord.cpp
+++ b/src/core/SkRecord.cpp
@@ -1,3 +1,10 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
#include "SkRecord.h"
SkRecord::~SkRecord() {
@@ -9,13 +16,13 @@ SkRecord::~SkRecord() {
void SkRecord::grow() {
SkASSERT(fCount == fReserved);
- fReserved = SkTMax<unsigned>(kFirstReserveCount, fReserved*2);
+ SkASSERT(fReserved > 0);
+ fReserved *= 2;
fRecords.realloc(fReserved);
- fTypes.realloc(fReserved);
}
size_t SkRecord::bytesUsed() const {
return fAlloc.approxBytesAllocated() +
- fReserved * (sizeof(Record) + sizeof(Type8)) +
+ (fReserved - kInlineRecords) * sizeof(Record) +
sizeof(SkRecord);
}
« 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