| Index: src/gpu/GrRecordReplaceDraw.cpp
|
| diff --git a/src/gpu/GrRecordReplaceDraw.cpp b/src/gpu/GrRecordReplaceDraw.cpp
|
| index 812584f08cb4c11f5cd988d1810031e0952f1c44..b3c02040ec1a6f38063a2a5c953220c6686a6d74 100644
|
| --- a/src/gpu/GrRecordReplaceDraw.cpp
|
| +++ b/src/gpu/GrRecordReplaceDraw.cpp
|
| @@ -13,8 +13,8 @@
|
|
|
| GrReplacements::ReplacementInfo* GrReplacements::newReplacement(uint32_t pictureID,
|
| unsigned int start,
|
| - const SkMatrix& ctm) {
|
| - ReplacementInfo* replacement = SkNEW_ARGS(ReplacementInfo, (pictureID, start, ctm));
|
| + const int* key, int keySize) {
|
| + ReplacementInfo* replacement = SkNEW_ARGS(ReplacementInfo, (pictureID, start, key, keySize));
|
| fReplacementHash.add(replacement);
|
| return replacement;
|
| }
|
| @@ -30,10 +30,9 @@ void GrReplacements::freeAll() {
|
| fReplacementHash.reset();
|
| }
|
|
|
| -const GrReplacements::ReplacementInfo* GrReplacements::lookupByStart(uint32_t pictureID,
|
| - size_t start,
|
| - const SkMatrix& ctm) const {
|
| - return fReplacementHash.find(ReplacementInfo::Key(pictureID, start, ctm));
|
| +const GrReplacements::ReplacementInfo* GrReplacements::lookupByStart(uint32_t pictureID, int start,
|
| + const int* key, int keySize) const {
|
| + return fReplacementHash.find(ReplacementInfo::Key(pictureID, start, key, keySize));
|
| }
|
|
|
| static inline void draw_replacement_bitmap(const GrReplacements::ReplacementInfo* ri,
|
| @@ -119,6 +118,16 @@ public:
|
| this->INHERITED::operator()(r);
|
| }
|
| void operator()(const SkRecords::DrawPicture& dp) {
|
| +
|
| + int curOffset;
|
| + if (fOps.count()) {
|
| + curOffset = fOps[fIndex];
|
| + } else {
|
| + curOffset = fIndex;
|
| + }
|
| +
|
| + fSaveLayerOpStack.push(curOffset);
|
| +
|
| SkAutoCanvasMatrixPaint acmp(fCanvas, dp.matrix, dp.paint, dp.picture->cullRect());
|
|
|
| // Draw sub-pictures with the same replacement list but a different picture
|
| @@ -126,6 +135,8 @@ public:
|
| dp.picture, fReplacements, fInitialMatrix, fCallback);
|
|
|
| fNumReplaced += draw.draw();
|
| +
|
| + fSaveLayerOpStack.pop();
|
| }
|
| void operator()(const SkRecords::SaveLayer& sl) {
|
|
|
| @@ -138,11 +149,11 @@ public:
|
| startOffset = fIndex;
|
| }
|
|
|
| - const SkMatrix& ctm = fCanvas->getTotalMatrix();
|
| + fSaveLayerOpStack.push(startOffset);
|
| +
|
| const GrReplacements::ReplacementInfo* ri = fReplacements->lookupByStart(
|
| - fPicture->uniqueID(),
|
| - startOffset,
|
| - ctm);
|
| + fPicture->uniqueID(), startOffset,
|
| + fSaveLayerOpStack.begin(), fSaveLayerOpStack.count());
|
|
|
| if (ri) {
|
| fNumReplaced++;
|
| @@ -156,11 +167,14 @@ public:
|
| } else {
|
| fIndex = ri->fStop;
|
| }
|
| + fSaveLayerOpStack.pop();
|
| return;
|
| }
|
|
|
| // This is a fail for layer hoisting
|
| this->INHERITED::operator()(sl);
|
| +
|
| + fSaveLayerOpStack.pop();
|
| }
|
|
|
| private:
|
| @@ -174,6 +188,8 @@ private:
|
| int fIndex;
|
| int fNumReplaced;
|
|
|
| + SkTDArray<int> fSaveLayerOpStack;
|
| +
|
| typedef Draw INHERITED;
|
| };
|
|
|
|
|