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

Unified Diff: src/pipe/utils/SamplePipeControllers.cpp

Issue 277653004: Manually revert "4x allocation in PipeController is probably overkill." (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 7 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/pipe/utils/SamplePipeControllers.h ('k') | tests/DeferredCanvasTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pipe/utils/SamplePipeControllers.cpp
diff --git a/src/pipe/utils/SamplePipeControllers.cpp b/src/pipe/utils/SamplePipeControllers.cpp
index de26346a15ab0fb8aea789e356af629d279601b2..1e25cb61c40f5890887d046d10ef538d02f9b5d9 100644
--- a/src/pipe/utils/SamplePipeControllers.cpp
+++ b/src/pipe/utils/SamplePipeControllers.cpp
@@ -13,16 +13,23 @@
#include "SkMatrix.h"
PipeController::PipeController(SkCanvas* target, SkPicture::InstallPixelRefProc proc)
- : fReader(target), fBlockSize(0), fBytesWritten(0) {
+:fReader(target) {
+ fBlock = NULL;
+ fBlockSize = fBytesWritten = 0;
fReader.setBitmapDecoder(proc);
}
-void* PipeController::requestBlock(size_t minRequest, size_t* actual) {
- fBlockSize = minRequest;
- fBlock.reset(fBlockSize);
+PipeController::~PipeController() {
+ sk_free(fBlock);
+}
+
+void* PipeController::requestBlock(size_t minRequest, size_t *actual) {
+ sk_free(fBlock);
+ fBlockSize = minRequest * 4;
+ fBlock = sk_malloc_throw(fBlockSize);
fBytesWritten = 0;
*actual = fBlockSize;
- return fBlock.get();
+ return fBlock;
}
void PipeController::notifyWritten(size_t bytes) {
« no previous file with comments | « src/pipe/utils/SamplePipeControllers.h ('k') | tests/DeferredCanvasTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698