| Index: src/core/SkPicturePlayback.cpp
|
| ===================================================================
|
| --- src/core/SkPicturePlayback.cpp (revision 14079)
|
| +++ src/core/SkPicturePlayback.cpp (working copy)
|
| @@ -861,7 +861,30 @@
|
| SkPicturePlayback* fPlayback;
|
| };
|
|
|
| -void SkPicturePlayback::draw(SkCanvas& canvas, SkDrawPictureCallback* callback) {
|
| +SkPicturePlayback::Foo* SkPicturePlayback::Bar::lookupStart(size_t start) {
|
| + for (int i = 0; i < fFoo.count(); ++i) {
|
| + if (start == fFoo[i].fStart) {
|
| + return &fFoo[i];
|
| + }
|
| + }
|
| +
|
| + return NULL;
|
| +}
|
| +
|
| +SkPicturePlayback::Foo* SkPicturePlayback::Bar::lookupStop(size_t stop) {
|
| + for (int i = 0; i < fFoo.count(); ++i) {
|
| + if (stop == fFoo[i].fStop) {
|
| + return &fFoo[i];
|
| + }
|
| + }
|
| +
|
| + return NULL;
|
| +}
|
| +
|
| +void SkPicturePlayback::draw(SkCanvas& canvas,
|
| + int start, int stop,
|
| + SkDrawPictureCallback* callback,
|
| + Bar* foo) {
|
| SkAutoResetOpID aroi(this);
|
| SkASSERT(0 == fCurOffset);
|
|
|
| @@ -886,20 +909,22 @@
|
| TextContainer text;
|
| const SkTDArray<void*>* activeOps = NULL;
|
|
|
| - if (NULL != fStateTree && NULL != fBoundingHierarchy) {
|
| - SkRect clipBounds;
|
| - if (canvas.getClipBounds(&clipBounds)) {
|
| - SkIRect query;
|
| - clipBounds.roundOut(&query);
|
| + if (start == -1 ) {
|
| + if (NULL != fStateTree && NULL != fBoundingHierarchy) {
|
| + SkRect clipBounds;
|
| + if (canvas.getClipBounds(&clipBounds)) {
|
| + SkIRect query;
|
| + clipBounds.roundOut(&query);
|
|
|
| - const SkPicture::OperationList& activeOpsList = this->getActiveOps(query);
|
| - if (activeOpsList.valid()) {
|
| - if (0 == activeOpsList.numOps()) {
|
| - return; // nothing to draw
|
| + const SkPicture::OperationList& activeOpsList = this->getActiveOps(query);
|
| + if (activeOpsList.valid()) {
|
| + if (0 == activeOpsList.numOps()) {
|
| + return; // nothing to draw
|
| + }
|
| +
|
| + // Since the opList is valid we know it is our derived class
|
| + activeOps = &((const CachedOperationList&)activeOpsList).fOps;
|
| }
|
| -
|
| - // Since the opList is valid we know it is our derived class
|
| - activeOps = &((const CachedOperationList&)activeOpsList).fOps;
|
| }
|
| }
|
| }
|
| @@ -908,6 +933,14 @@
|
| SkPictureStateTree::Iterator() :
|
| fStateTree->getIterator(*activeOps, &canvas);
|
|
|
| + if (start != -1) {
|
| + reader.setOffset(start);
|
| + uint32_t size;
|
| + SkDEBUGCODE(DrawType op =) read_op_and_size(&reader, &size);
|
| + SkASSERT(SAVE_LAYER == op);
|
| + reader.setOffset(start+size);
|
| + }
|
| +
|
| if (it.isValid()) {
|
| uint32_t skipTo = it.draw();
|
| if (kDrawComplete == skipTo) {
|
| @@ -940,7 +973,50 @@
|
| return;
|
| }
|
| #endif
|
| + if (stop != -1) {
|
| + if (reader.offset() >= (unsigned int) stop) {
|
| + uint32_t size;
|
| + SkDEBUGCODE(DrawType op =) read_op_and_size(&reader, &size);
|
| + SkASSERT(RESTORE == op);
|
| + return;
|
| + }
|
| + }
|
|
|
| + if (NULL != foo) {
|
| +#if 0
|
| + // replace the saveLayer/restore block with a drawBitmap call
|
| + SkPicturePlayback::Foo* temp = foo->lookupStart(reader.offset());
|
| +
|
| + if (NULL != temp) {
|
| + SkASSERT(NULL != temp->fBM);
|
| + canvas.drawBitmap(*temp->fBM, temp->fPos.fX, temp->fPos.fY, temp->fPaint);
|
| +
|
| + reader.setOffset(temp->fStop);
|
| + uint32_t size;
|
| + SkDEBUGCODE(DrawType op =) read_op_and_size(&reader, &size);
|
| + SkASSERT(RESTORE == op);
|
| + continue;
|
| + }
|
| +#else
|
| + // execute the saveLayer/restore block but follow it with a drawBitmap call
|
| + // This is intended (with conversion of saveLayers to saves) to
|
| + // separate out the overhead of the saveLayer render target changes
|
| + // from all the other work
|
| + SkPicturePlayback::Foo* temp = foo->lookupStop(reader.offset());
|
| + if (NULL != temp) {
|
| + SkASSERT(NULL != temp->fBM);
|
| + uint32_t size;
|
| + SkDEBUGCODE(DrawType op =) read_op_and_size(&reader, &size);
|
| + SkASSERT(RESTORE == op);
|
| +
|
| + canvas.restore();
|
| +
|
| + canvas.drawBitmap(*temp->fBM, temp->fPos.fX, temp->fPos.fY, temp->fPaint);
|
| + continue;
|
| + }
|
| +#endif
|
| + }
|
| +
|
| #ifdef SPEW_CLIP_SKIPPING
|
| opCount++;
|
| #endif
|
| @@ -1272,9 +1348,16 @@
|
| canvas.save((SkCanvas::SaveFlags) reader.readInt());
|
| break;
|
| case SAVE_LAYER: {
|
| +#if 1
|
| const SkRect* boundsPtr = this->getRectPtr(reader);
|
| const SkPaint* paint = this->getPaint(reader);
|
| canvas.saveLayer(boundsPtr, paint, (SkCanvas::SaveFlags) reader.readInt());
|
| +#else
|
| + // replace all saveLayers with a save
|
| + this->getRectPtr(reader);
|
| + this->getPaint(reader);
|
| + canvas.save((SkCanvas::SaveFlags) reader.readInt());
|
| +#endif
|
| } break;
|
| case SCALE: {
|
| SkScalar sx = reader.readScalar();
|
|
|