aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkPicture.cpp6
-rw-r--r--src/core/SkPictureRecord.cpp8
-rw-r--r--src/core/SkPictureRecord.h7
3 files changed, 16 insertions, 5 deletions
diff --git a/src/core/SkPicture.cpp b/src/core/SkPicture.cpp
index 2ea4641bf8..f83a5fb9aa 100644
--- a/src/core/SkPicture.cpp
+++ b/src/core/SkPicture.cpp
@@ -143,6 +143,12 @@ SkPicture::~SkPicture() {
SkDELETE(fPlayback);
}
+void SkPicture::internalOnly_EnableOpts(bool enableOpts) {
+ if (NULL != fRecord) {
+ fRecord->internalOnly_EnableOpts(enableOpts);
+ }
+}
+
void SkPicture::swap(SkPicture& other) {
SkTSwap(fRecord, other.fRecord);
SkTSwap(fPlayback, other.fPlayback);
diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp
index dda6f46b10..213d1aa454 100644
--- a/src/core/SkPictureRecord.cpp
+++ b/src/core/SkPictureRecord.cpp
@@ -34,7 +34,8 @@ SkPictureRecord::SkPictureRecord(const SkISize& dimensions, uint32_t flags)
, fStateTree(NULL)
, fFlattenableHeap(HEAP_BLOCK_SIZE)
, fPaints(&fFlattenableHeap)
- , fRecordFlags(flags) {
+ , fRecordFlags(flags)
+ , fOptsEnabled(true) {
#ifdef SK_DEBUG_SIZE
fPointBytes = fRectBytes = fTextBytes = 0;
fPointWrites = fRectWrites = fTextWrites = 0;
@@ -627,7 +628,7 @@ void SkPictureRecord::restore() {
}
size_t opt = 0;
- if (!(fRecordFlags & SkPicture::kDisableRecordOptimizations_RecordingFlag)) {
+ if (fOptsEnabled) {
for (opt = 0; opt < SK_ARRAY_COUNT(gPictureRecordOpts); ++opt) {
if (0 != (gPictureRecordOpts[opt].fFlags & kSkipIfBBoxHierarchy_Flag)
&& NULL != fBoundingHierarchy) {
@@ -642,8 +643,7 @@ void SkPictureRecord::restore() {
}
}
- if ((fRecordFlags & SkPicture::kDisableRecordOptimizations_RecordingFlag) ||
- SK_ARRAY_COUNT(gPictureRecordOpts) == opt) {
+ if (!fOptsEnabled || SK_ARRAY_COUNT(gPictureRecordOpts) == opt) {
// No optimization fired so add the RESTORE
this->recordRestore();
}
diff --git a/src/core/SkPictureRecord.h b/src/core/SkPictureRecord.h
index 1b62f3dadc..e7c6d7f343 100644
--- a/src/core/SkPictureRecord.h
+++ b/src/core/SkPictureRecord.h
@@ -103,6 +103,10 @@ public:
void beginRecording();
void endRecording();
+ void internalOnly_EnableOpts(bool optsEnabled) {
+ fOptsEnabled = optsEnabled;
+ }
+
private:
void handleOptimization(int opt);
int recordRestoreOffsetPlaceholder(SkRegion::Op);
@@ -287,7 +291,8 @@ private:
SkTDArray<SkPicture*> fPictureRefs;
uint32_t fRecordFlags;
- int fInitialSaveCount;
+ bool fOptsEnabled;
+ int fInitialSaveCount;
friend class SkPicturePlayback;
friend class SkPictureTester; // for unit testing