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

Unified Diff: src/pipe/SkGPipeWrite.cpp

Issue 285693007: Reland one more bug fix from "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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pipe/SkGPipeWrite.cpp
diff --git a/src/pipe/SkGPipeWrite.cpp b/src/pipe/SkGPipeWrite.cpp
index b78c291d2399ca16c3149adb33ef71ceb7241492..4a5dcd51a085747ce50ef00e8cf01d690596b2f5 100644
--- a/src/pipe/SkGPipeWrite.cpp
+++ b/src/pipe/SkGPipeWrite.cpp
@@ -762,16 +762,23 @@ bool SkGPipeCanvas::commonDrawBitmap(const SkBitmap& bm, DrawOps op,
unsigned flags,
size_t opBytesNeeded,
const SkPaint* paint) {
+ if (fDone) {
+ return false;
+ }
+
if (paint != NULL) {
flags |= kDrawBitmap_HasPaint_DrawOpFlag;
this->writePaint(*paint);
}
+ // This needs to run first so its calls to needOpBytes() and its writes
+ // don't interlace with the needOpBytes() and write below.
+ SkASSERT(fBitmapHeap != NULL);
+ int32_t bitmapIndex = fBitmapHeap->insert(bm);
+ if (SkBitmapHeap::INVALID_SLOT == bitmapIndex) {
+ return false;
+ }
+
if (this->needOpBytes(opBytesNeeded)) {
- SkASSERT(fBitmapHeap != NULL);
- int32_t bitmapIndex = fBitmapHeap->insert(bm);
- if (SkBitmapHeap::INVALID_SLOT == bitmapIndex) {
- return false;
- }
this->writeOp(op, flags, bitmapIndex);
return true;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698