Index: src/core/SkPicturePlayback.cpp |
=================================================================== |
--- src/core/SkPicturePlayback.cpp (revision 14632) |
+++ src/core/SkPicturePlayback.cpp (working copy) |
@@ -896,33 +896,44 @@ |
if (NULL != temp) { |
SkASSERT(NULL != temp->fBM); |
SkASSERT(NULL != temp->fPaint); |
+ canvas.save(); |
+ canvas.setMatrix(initialMatrix); |
canvas.drawBitmap(*temp->fBM, temp->fPos.fX, temp->fPos.fY, temp->fPaint); |
+ canvas.restore(); |
if (it.isValid()) { |
// This save is needed since the BBH will automatically issue |
// a restore to balanced the saveLayer we're skipping |
canvas.save(); |
- // Note: This skipping only works if the client only issues |
- // well behaved saveLayer calls (i.e., doesn't use |
- // kMatrix_SaveFlag or kClip_SaveFlag in isolation) |
- |
// At this point we know that the PictureStateTree was aiming |
// for some draw op within temp's saveLayer (although potentially |
// in a separate saveLayer nested inside it). |
// We need to skip all the operations inside temp's range |
// along with all the associated state changes but update |
// the state tree to the first operation outside temp's range. |
- SkASSERT(it.peekDraw() >= temp->fStart && it.peekDraw() <= temp->fStop); |
- while (kDrawComplete != it.peekDraw() && it.peekDraw() <= temp->fStop) { |
- it.skipDraw(); |
- } |
+ uint32_t skipTo; |
+ do { |
+ skipTo = it.nextDraw(); |
+ if (kDrawComplete == skipTo) { |
+ break; |
+ } |
- if (kDrawComplete == it.peekDraw()) { |
+ if (skipTo <= temp->fStop) { |
+ reader.setOffset(skipTo); |
+ uint32_t size; |
+ DrawType op = read_op_and_size(&reader, &size); |
+ // Convert nested saveLayers into saves |
bsalomon
2014/05/08 13:50:46
?
robertphillips
2014/05/08 18:45:41
Done - expanded comment.
|
+ if (SAVE_LAYER == op) { |
+ canvas.save(); |
+ } |
+ } |
+ } while (skipTo <= temp->fStop); |
+ |
+ if (kDrawComplete == skipTo) { |
break; |
} |
- uint32_t skipTo = it.nextDraw(); |
reader.setOffset(skipTo); |
} else { |
reader.setOffset(temp->fStop); |