Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Unified Diff: src/core/SkPictureRecord.cpp

Issue 464433002: Add layer counting to SkPictureRecord (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix bug Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkPictureData.cpp ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPictureRecord.cpp
diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp
index 88975d245253c2f6cf25916ea6829cd1a59dfaab..0cdf973e1a006df60bd69aa84a9915ee7ec4e161 100644
--- a/src/core/SkPictureRecord.cpp
+++ b/src/core/SkPictureRecord.cpp
@@ -155,6 +155,8 @@ void SkPictureRecord::willSave() {
}
void SkPictureRecord::recordSave() {
+ fContentInfo.onSave();
+
// op only
size_t size = kSaveSize;
size_t initialOffset = this->addDraw(SAVE, &size);
@@ -183,6 +185,8 @@ SkCanvas::SaveLayerStrategy SkPictureRecord::willSaveLayer(const SkRect* bounds,
void SkPictureRecord::recordSaveLayer(const SkRect* bounds, const SkPaint* paint,
SaveFlags flags) {
+ fContentInfo.onSaveLayer();
+
// op + bool for 'bounds'
size_t size = 2 * kUInt32Size;
if (NULL != bounds) {
@@ -526,8 +530,10 @@ enum PictureRecordOptType {
};
enum PictureRecordOptFlags {
- kSkipIfBBoxHierarchy_Flag = 0x1, // Optimization should be skipped if the
- // SkPicture has a bounding box hierarchy.
+ kSkipIfBBoxHierarchy_Flag = 0x1, // Optimization should be skipped if the
+ // SkPicture has a bounding box hierarchy.
+ kRescindLastSave_Flag = 0x2,
+ kRescindLastSaveLayer_Flag = 0x4,
};
struct PictureRecordOpt {
@@ -546,9 +552,10 @@ static const PictureRecordOpt gPictureRecordOpts[] = {
// SkPictureStateTree, and applying the optimization introduces significant
// record time overhead because it requires rewinding contents that were
// recorded into the BBoxHierarchy.
- { collapse_save_clip_restore, kRewind_OptType, kSkipIfBBoxHierarchy_Flag },
- { remove_save_layer1, kCollapseSaveLayer_OptType, 0 },
- { remove_save_layer2, kCollapseSaveLayer_OptType, 0 }
+ { collapse_save_clip_restore, kRewind_OptType,
+ kSkipIfBBoxHierarchy_Flag|kRescindLastSave_Flag },
+ { remove_save_layer1, kCollapseSaveLayer_OptType, kRescindLastSaveLayer_Flag },
+ { remove_save_layer2, kCollapseSaveLayer_OptType, kRescindLastSaveLayer_Flag }
};
// This is called after an optimization has been applied to the command stream
@@ -603,6 +610,11 @@ void SkPictureRecord::willRestore() {
// Some optimization fired so don't add the RESTORE
apply_optimization_to_bbh(gPictureRecordOpts[opt].fType,
fStateTree, fBoundingHierarchy);
+ if (gPictureRecordOpts[opt].fFlags & kRescindLastSave_Flag) {
+ fContentInfo.rescindLastSave();
+ } else if (gPictureRecordOpts[opt].fFlags & kRescindLastSaveLayer_Flag) {
+ fContentInfo.rescindLastSaveLayer();
+ }
break;
}
}
@@ -619,6 +631,8 @@ void SkPictureRecord::willRestore() {
}
void SkPictureRecord::recordRestore(bool fillInSkips) {
+ fContentInfo.onRestore();
+
if (fillInSkips) {
this->fillRestoreOffsetPlaceholdersForCurrentStackLevel((uint32_t)fWriter.bytesWritten());
}
« no previous file with comments | « src/core/SkPictureData.cpp ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698