aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2014-06-03 10:04:47 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-06-03 10:04:47 -0700
commitdcf9ab14a194be0cbea896e1dc44a2a04106a38b (patch)
treedb433629b2484484f01ad6b9578a9da8defe4464 /src
parent66aa609a493b10d7c0a0101e2e16ba11e4c276a2 (diff)
Remove legacy picture recording
This is unblocked now that Android no longer uses the old interface. This is just the first step in cleaning this up. Future CLs will constify SkPicture access in SkCanvas and split up the SkPicture/SkPicturePlayback/SkPictureRecord trio. R=bsalomon@google.com, reed@google.com, mtklein@google.com Author: robertphillips@google.com Review URL: https://codereview.chromium.org/313613002
Diffstat (limited to 'src')
-rw-r--r--src/core/SkPicture.cpp67
-rw-r--r--src/core/SkQuadTreePicture.cpp18
-rw-r--r--src/core/SkQuadTreePicture.h50
-rw-r--r--src/core/SkRTreePicture.cpp28
-rw-r--r--src/core/SkTileGridPicture.cpp33
5 files changed, 3 insertions, 193 deletions
diff --git a/src/core/SkPicture.cpp b/src/core/SkPicture.cpp
index 8bb12543b5..00bcbef275 100644
--- a/src/core/SkPicture.cpp
+++ b/src/core/SkPicture.cpp
@@ -312,41 +312,6 @@ SkPicture::AccelData::Domain SkPicture::AccelData::GenerateDomain() {
///////////////////////////////////////////////////////////////////////////////
-#ifdef SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES
-
-SkCanvas* SkPicture::beginRecording(int width, int height,
- uint32_t recordingFlags) {
- if (fPlayback) {
- SkDELETE(fPlayback);
- fPlayback = NULL;
- }
- SkSafeUnref(fAccelData);
- SkSafeSetNull(fRecord);
- fContentInfo.reset();
-
- this->needsNewGenID();
-
- // Must be set before calling createBBoxHierarchy
- fWidth = width;
- fHeight = height;
-
- const SkISize size = SkISize::Make(width, height);
-
- if (recordingFlags & kOptimizeForClippedPlayback_RecordingFlag) {
- SkBBoxHierarchy* tree = this->createBBoxHierarchy();
- SkASSERT(NULL != tree);
- fRecord = SkNEW_ARGS(SkBBoxHierarchyRecord, (this, size, recordingFlags, tree));
- tree->unref();
- } else {
- fRecord = SkNEW_ARGS(SkPictureRecord, (this, size, recordingFlags));
- }
- fRecord->beginRecording();
-
- return fRecord;
-}
-
-#endif
-
SkCanvas* SkPicture::beginRecording(int width, int height,
SkBBHFactory* bbhFactory,
uint32_t recordingFlags) {
@@ -369,10 +334,7 @@ SkCanvas* SkPicture::beginRecording(int width, int height,
if (NULL != bbhFactory) {
SkAutoTUnref<SkBBoxHierarchy> tree((*bbhFactory)(width, height));
SkASSERT(NULL != tree);
- fRecord = SkNEW_ARGS(SkBBoxHierarchyRecord, (this, size,
- recordingFlags|
- kOptimizeForClippedPlayback_RecordingFlag,
- tree.get()));
+ fRecord = SkNEW_ARGS(SkBBoxHierarchyRecord, (this, size, recordingFlags, tree.get()));
} else {
fRecord = SkNEW_ARGS(SkPictureRecord, (this, size, recordingFlags));
}
@@ -381,29 +343,6 @@ SkCanvas* SkPicture::beginRecording(int width, int height,
return fRecord;
}
-
-#ifdef SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES
-
-SkBBoxHierarchy* SkPicture::createBBoxHierarchy() const {
- // TODO: this code is now replicated in SkRTreePicture. Once all external
- // clients have been weaned off of kOptimizeForClippedPlayback_RecordingFlag,
- // this code can be removed.
-
- // These values were empirically determined to produce reasonable
- // performance in most cases.
- static const int kRTreeMinChildren = 6;
- static const int kRTreeMaxChildren = 11;
-
- SkScalar aspectRatio = SkScalarDiv(SkIntToScalar(fWidth),
- SkIntToScalar(fHeight));
- bool sortDraws = false; // Do not sort draw calls when bulk loading.
-
- return SkRTree::Create(kRTreeMinChildren, kRTreeMaxChildren,
- aspectRatio, sortDraws);
-}
-
-#endif
-
SkCanvas* SkPicture::getRecordingCanvas() const {
// will be null if we are not recording
return fRecord;
@@ -428,7 +367,7 @@ const SkPicture::OperationList& SkPicture::OperationList::InvalidList() {
}
const SkPicture::OperationList& SkPicture::EXPERIMENTAL_getActiveOps(const SkIRect& queryRect) {
- this->endRecording(); // TODO: remove eventually
+ SkASSERT(NULL != fPlayback && NULL == fRecord);
if (NULL != fPlayback) {
return fPlayback->getActiveOps(queryRect);
}
@@ -443,7 +382,7 @@ size_t SkPicture::EXPERIMENTAL_curOpID() const {
}
void SkPicture::draw(SkCanvas* surface, SkDrawPictureCallback* callback) {
- this->endRecording(); // TODO: remove eventually
+ SkASSERT(NULL != fPlayback && NULL == fRecord);
if (NULL != fPlayback) {
fPlayback->draw(*surface, callback);
}
diff --git a/src/core/SkQuadTreePicture.cpp b/src/core/SkQuadTreePicture.cpp
deleted file mode 100644
index a76899ee29..0000000000
--- a/src/core/SkQuadTreePicture.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Copyright 2014 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifdef SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES
-
-#include "SkQuadTreePicture.h"
-
-#include "SkQuadTree.h"
-
-SkBBoxHierarchy* SkQuadTreePicture::createBBoxHierarchy() const {
- return SkNEW_ARGS(SkQuadTree, (fBounds));
-}
-
-#endif
diff --git a/src/core/SkQuadTreePicture.h b/src/core/SkQuadTreePicture.h
deleted file mode 100644
index 5ebbef93cb..0000000000
--- a/src/core/SkQuadTreePicture.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2014 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef SkQuadTreePicture_DEFINED
-#define SkQuadTreePicture_DEFINED
-
-#ifdef SK_SUPPORT_LEGACY_PICTURE_HEADERS
-#include "SkBBHFactory.h"
-#endif
-
-#ifdef SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES
-
-#include "SkPicture.h"
-#include "SkRect.h"
-
-/**
- * Subclass of SkPicture that creates an SkQuadGrid
- * structure. The quad tree has generally faster
- * tree creation time, but slightly slower query times, as compared to
- * R-Tree, so some cases may be faster and some cases slower.
- */
-class SK_API SkQuadTreePicture : public SkPicture {
-public:
- SkQuadTreePicture(const SkIRect& bounds) : fBounds(bounds) {}
- virtual SkBBoxHierarchy* createBBoxHierarchy() const SK_OVERRIDE;
-private:
- SkIRect fBounds;
-
- typedef SkPicture INHERITED;
-};
-
-class SkQuadTreePictureFactory : public SkPictureFactory {
-public:
- SkQuadTreePictureFactory() {}
-
- virtual SkPicture* create(int width, int height) SK_OVERRIDE {
- return SkNEW_ARGS(SkQuadTreePicture, (SkIRect::MakeWH(width, height)));
- }
-
-private:
- typedef SkPictureFactory INHERITED;
-};
-
-#endif
-
-#endif
diff --git a/src/core/SkRTreePicture.cpp b/src/core/SkRTreePicture.cpp
deleted file mode 100644
index a9118aeb5f..0000000000
--- a/src/core/SkRTreePicture.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2014 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifdef SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES
-
-#include "SkRTreePicture.h"
-
-#include "SkRTree.h"
-
-SkBBoxHierarchy* SkRTreePicture::createBBoxHierarchy() const {
- // These values were empirically determined to produce reasonable
- // performance in most cases.
- static const int kRTreeMinChildren = 6;
- static const int kRTreeMaxChildren = 11;
-
- SkScalar aspectRatio = SkScalarDiv(SkIntToScalar(fWidth),
- SkIntToScalar(fHeight));
- bool sortDraws = false; // Do not sort draw calls when bulk loading.
-
- return SkRTree::Create(kRTreeMinChildren, kRTreeMaxChildren,
- aspectRatio, sortDraws);
-}
-
-#endif
diff --git a/src/core/SkTileGridPicture.cpp b/src/core/SkTileGridPicture.cpp
deleted file mode 100644
index 4a43f8a063..0000000000
--- a/src/core/SkTileGridPicture.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2012 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifdef SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES
-
-#include "SkTileGridPicture.h"
-
-#include "SkPictureStateTree.h"
-#include "SkTileGrid.h"
-
-SkTileGridPicture::SkTileGridPicture(int width, int height,
- const SkTileGridFactory::TileGridInfo& info) {
- SkASSERT(info.fMargin.width() >= 0);
- SkASSERT(info.fMargin.height() >= 0);
- fInfo = info;
- // Note: SkIRects are non-inclusive of the right() column and bottom() row.
- // For example, an SkIRect at 0,0 with a size of (1,1) will only have
- // content at pixel (0,0) and will report left=0 and right=1, hence the
- // "-1"s below.
- fXTileCount = (width + info.fTileInterval.width() - 1) / info.fTileInterval.width();
- fYTileCount = (height + info.fTileInterval.height() - 1) / info.fTileInterval.height();
-}
-
-SkBBoxHierarchy* SkTileGridPicture::createBBoxHierarchy() const {
- return SkNEW_ARGS(SkTileGrid, (fXTileCount, fYTileCount, fInfo,
- SkTileGridNextDatum<SkPictureStateTree::Draw>));
-}
-
-#endif