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

Unified Diff: src/core/SkVarAlloc.cpp

Issue 718203006: Revert of Deparameterize SkVarAlloc. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 1 month 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/SkVarAlloc.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkVarAlloc.cpp
diff --git a/src/core/SkVarAlloc.cpp b/src/core/SkVarAlloc.cpp
index a636c54198b1b2adbc298eefed90dc9556c37aac..5c3a41c6cf8af967531b16a55b4184d86d2b9b26 100644
--- a/src/core/SkVarAlloc.cpp
+++ b/src/core/SkVarAlloc.cpp
@@ -20,10 +20,11 @@
}
};
-SkVarAlloc::SkVarAlloc()
+SkVarAlloc::SkVarAlloc(size_t smallest, float growth)
: fByte(NULL)
- , fRemaining(0)
- , fLgMinSize(0)
+ , fLimit(NULL)
+ , fSmallest(SkToUInt(smallest))
+ , fGrowth(growth)
, fBlock(NULL) {}
SkVarAlloc::~SkVarAlloc() {
@@ -38,13 +39,14 @@
void SkVarAlloc::makeSpace(size_t bytes, unsigned flags) {
SkASSERT(SkIsAlignPtr(bytes));
- size_t alloc = 1<<(fLgMinSize++);
+ size_t alloc = fSmallest;
while (alloc < bytes + sizeof(Block)) {
alloc *= 2;
}
fBlock = Block::Alloc(fBlock, alloc, flags);
fByte = fBlock->data();
- fRemaining = alloc - sizeof(Block);
+ fLimit = fByte + alloc - sizeof(Block);
+ fSmallest = SkToUInt(SkScalarTruncToInt(fSmallest * fGrowth));
#if defined(SK_BUILD_FOR_MAC)
SkASSERT(alloc == malloc_good_size(alloc));
« no previous file with comments | « src/core/SkVarAlloc.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698