Index: src/pipe/SkGPipeWrite.cpp |
diff --git a/src/pipe/SkGPipeWrite.cpp b/src/pipe/SkGPipeWrite.cpp |
index 6711eb06640b659faae22866172974ea3c732469..46e4260f311f238600c9979ccbada19a3b73f109 100644 |
--- a/src/pipe/SkGPipeWrite.cpp |
+++ b/src/pipe/SkGPipeWrite.cpp |
@@ -475,12 +475,14 @@ bool SkGPipeCanvas::needOpBytes(size_t needed) { |
} |
needed += 4; // size of DrawOp atom |
- needed = SkTMax<size_t>(MIN_BLOCK_SIZE, needed); |
needed = SkAlign4(needed); |
if (fWriter.bytesWritten() + needed > fBlockSize) { |
- // Before we wipe out any data that has already been written, read it |
- // out. |
+ // Before we wipe out any data that has already been written, read it out. |
this->doNotify(); |
+ |
+ // If we're going to allocate a new block, allocate enough to make it worthwhile. |
+ needed = SkTMax<size_t>(MIN_BLOCK_SIZE, needed); |
+ |
void* block = fController->requestBlock(needed, &fBlockSize); |
if (NULL == block) { |
// Do not notify the readers, which would call this function again. |