aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-03-04 19:08:57 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-03-04 19:08:57 +0000
commite494dbdec36f0ffa4affeac1c3f405b58ac41220 (patch)
treee95f978f055e48869abd1a2f9fafb584d8dd56b6 /src
parentcb336874e468d5a2cb9e6287a3388fdd7a66dc1f (diff)
The motivation for this CL is to de-clutter SkPicture's beginRecording method.
R=reed@google.com Author: robertphillips@google.com Review URL: https://codereview.chromium.org/186813003 git-svn-id: http://skia.googlecode.com/svn/trunk@13658 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-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