Chromium Code Reviews| Index: src/core/SkPictureRecord.cpp |
| diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp |
| index c59dfe3d715415c764cd19610d2888735fb621d6..26146be258f37a4b4f0b03670a84ce511a112881 100644 |
| --- a/src/core/SkPictureRecord.cpp |
| +++ b/src/core/SkPictureRecord.cpp |
| @@ -522,9 +522,15 @@ enum PictureRecordOptType { |
| kCollapseSaveLayer_OptType, // Optimization eliminates a save/restore pair |
| }; |
| +enum PictureRecordOptFlags { |
| + kSkipIfBBoxHierarchy_Flag = 0x1, // Optimization should be skipped if the |
|
reed1
2013/11/20 21:08:52
Lets augment the comment to explain why (which you
|
| + // SkPicture has a bounding box hierarchy. |
| +}; |
| + |
| struct PictureRecordOpt { |
| PictureRecordOptProc fProc; |
| PictureRecordOptType fType; |
| + unsigned fFlags; |
| }; |
| /* |
| * A list of the optimizations that are tried upon seeing a restore |
| @@ -532,9 +538,9 @@ struct PictureRecordOpt { |
| * Add the ability to fire optimizations on any op (not just RESTORE) |
| */ |
| static const PictureRecordOpt gPictureRecordOpts[] = { |
| - { collapse_save_clip_restore, kRewind_OptType }, |
| - { remove_save_layer1, kCollapseSaveLayer_OptType }, |
| - { remove_save_layer2, kCollapseSaveLayer_OptType } |
| + { collapse_save_clip_restore, kRewind_OptType, kSkipIfBBoxHierarchy_Flag }, |
| + { remove_save_layer1, kCollapseSaveLayer_OptType, 0 }, |
| + { remove_save_layer2, kCollapseSaveLayer_OptType, 0 } |
| }; |
| // This is called after an optimization has been applied to the command stream |
| @@ -582,6 +588,10 @@ void SkPictureRecord::restore() { |
| size_t opt = 0; |
| if (!(fRecordFlags & SkPicture::kDisableRecordOptimizations_RecordingFlag)) { |
| for (opt = 0; opt < SK_ARRAY_COUNT(gPictureRecordOpts); ++opt) { |
| + if (0 != gPictureRecordOpts[opt].fFlags & kSkipIfBBoxHierarchy_Flag |
| + && NULL != fBoundingHierarchy) { |
| + continue; |
| + } |
| if ((*gPictureRecordOpts[opt].fProc)(&fWriter, fRestoreOffsetStack.top(), &fPaints)) { |
| // Some optimization fired so don't add the RESTORE |
| size = 0; |