aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkPictureRecord.cpp
diff options
context:
space:
mode:
authorGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-04-12 14:53:29 +0000
committerGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-04-12 14:53:29 +0000
commitc10531b50259049bd7238e85df17e8c2c09a062c (patch)
tree8eadea10b7858c07bda195ce07d9813bcd3ffea9 /src/core/SkPictureRecord.cpp
parenta53e9460913f06a4c9c1bc473d70a335082c5e17 (diff)
Add testing of optimizations to GM
Diffstat (limited to 'src/core/SkPictureRecord.cpp')
-rw-r--r--src/core/SkPictureRecord.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp
index 97ceeb15bf..7fd8a1f0b8 100644
--- a/src/core/SkPictureRecord.cpp
+++ b/src/core/SkPictureRecord.cpp
@@ -412,7 +412,7 @@ static bool merge_savelayer_paint_into_drawbitmp(SkWriter32* writer,
/*
* Restore has just been called (but not recorded), look back at the
* matching save* and see if we are in the configuration:
- * SAVE_LAYER
+ * SAVE_LAYER (with NULL == bounds)
* SAVE
* CLIP_RECT
* DRAW_BITMAP|DRAW_BITMAP_MATRIX|DRAW_BITMAP_NINE|DRAW_BITMAP_RECT_TO_RECT
@@ -565,18 +565,21 @@ void SkPictureRecord::restore() {
uint32_t initialOffset, size;
size_t opt;
- for (opt = 0; opt < SK_ARRAY_COUNT(gPictureRecordOpts); ++opt) {
- if ((*gPictureRecordOpts[opt].fProc)(&fWriter, fRestoreOffsetStack.top(), &fPaints)) {
- // Some optimization fired so don't add the RESTORE
- size = 0;
- initialOffset = fWriter.size();
- apply_optimization_to_bbh(gPictureRecordOpts[opt].fType,
- fStateTree, fBoundingHierarchy);
- break;
+ if (!(fRecordFlags & SkPicture::kDisableRecordOptimizations_RecordingFlag)) {
+ for (opt = 0; opt < SK_ARRAY_COUNT(gPictureRecordOpts); ++opt) {
+ if ((*gPictureRecordOpts[opt].fProc)(&fWriter, fRestoreOffsetStack.top(), &fPaints)) {
+ // Some optimization fired so don't add the RESTORE
+ size = 0;
+ initialOffset = fWriter.size();
+ apply_optimization_to_bbh(gPictureRecordOpts[opt].fType,
+ fStateTree, fBoundingHierarchy);
+ break;
+ }
}
- }
+ }
- if (SK_ARRAY_COUNT(gPictureRecordOpts) == opt) {
+ if ((fRecordFlags & SkPicture::kDisableRecordOptimizations_RecordingFlag) ||
+ SK_ARRAY_COUNT(gPictureRecordOpts) == opt) {
// No optimization fired so add the RESTORE
fillRestoreOffsetPlaceholdersForCurrentStackLevel((uint32_t)fWriter.size());
size = 1 * kUInt32Size; // RESTORE consists solely of 1 op code