aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pipe/SkGPipeWrite.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/pipe/SkGPipeWrite.cpp')
-rw-r--r--src/pipe/SkGPipeWrite.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/pipe/SkGPipeWrite.cpp b/src/pipe/SkGPipeWrite.cpp
index b78c291d23..4a5dcd51a0 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;
}