aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-05-14 15:38:25 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-05-14 15:38:25 +0000
commit44803fb451e87287282f95043c6b367fdd509519 (patch)
tree9ee26a76a3fa190370adf5cac1fb4c8e262ec958 /src
parent8041f3dacedd37da887262793b663917679bc309 (diff)
Reland one more bug fix from "4x allocation in PipeController is probably overkill.".
BUG=372671 R=mtklein@google.com Author: mtklein@chromium.org Review URL: https://codereview.chromium.org/285693007 git-svn-id: http://skia.googlecode.com/svn/trunk@14731 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-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;
}