aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core
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 /include/core
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 'include/core')
-rw-r--r--include/core/SkPicture.h117
-rw-r--r--include/core/SkPictureRecorder.h33
-rw-r--r--include/core/SkRTreePicture.h43
-rw-r--r--include/core/SkTileGridPicture.h64
4 files changed, 28 insertions, 229 deletions
diff --git a/include/core/SkPicture.h b/include/core/SkPicture.h
index 7ccd3379e2..7ca59bf1ba 100644
--- a/include/core/SkPicture.h
+++ b/include/core/SkPicture.h
@@ -132,6 +132,9 @@ public:
*/
void clone(SkPicture* pictures, int count) const;
+ // TODO: kUsePathBoundsForClip_RecordingFlag no longer belongs in
+ // SkPicture. It should be moved to SkPictureRecorder (or just made
+ // the default behavior).
enum RecordingFlags {
/* This flag specifies that when clipPath() is called, the path will
be faithfully recorded, but the recording canvas' current clip will
@@ -144,68 +147,6 @@ public:
kUsePathBoundsForClip_RecordingFlag = 0x01
};
-#ifndef SK_SUPPORT_DEPRECATED_RECORD_FLAGS
- // TODO: once kOptimizeForClippedPlayback_RecordingFlag is hidden from
- // all external consumers, SkPicture::createBBoxHierarchy can also be
- // cleaned up.
-private:
-#endif
- enum Deprecated_RecordingFlags {
- /* This flag causes the picture to compute bounding boxes and build
- up a spatial hierarchy (currently an R-Tree), plus a tree of Canvas'
- usually stack-based clip/etc state. This requires an increase in
- recording time (often ~2x; likely more for very complex pictures),
- but allows us to perform much faster culling at playback time, and
- completely avoid some unnecessary clips and other operations. This
- is ideal for tiled rendering, or any other situation where you're
- drawing a fraction of a large scene into a smaller viewport.
-
- In most cases the record cost is offset by the playback improvement
- after a frame or two of tiled rendering (and complex pictures that
- induce the worst record times will generally get the largest
- speedups at playback time).
-
- Note: Currently this is not serializable, the bounding data will be
- discarded if you serialize into a stream and then deserialize.
- */
- kOptimizeForClippedPlayback_RecordingFlag = 0x02,
- };
-#ifndef SK_SUPPORT_DEPRECATED_RECORD_FLAGS
-public:
-#endif
-
-#ifndef SK_SUPPORT_LEGACY_PICTURE_CAN_RECORD
-private:
-#endif
-
-#ifdef SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES
-
- /** Returns the canvas that records the drawing commands.
- @param width the base width for the picture, as if the recording
- canvas' bitmap had this width.
- @param height the base width for the picture, as if the recording
- canvas' bitmap had this height.
- @param recordFlags optional flags that control recording.
- @return the picture canvas.
- */
- SkCanvas* beginRecording(int width, int height, uint32_t recordFlags = 0);
-#endif
-
- /** Returns the recording canvas if one is active, or NULL if recording is
- not active. This does not alter the refcnt on the canvas (if present).
- */
- SkCanvas* getRecordingCanvas() const;
- /** Signal that the caller is done recording. This invalidates the canvas
- returned by beginRecording/getRecordingCanvas, and prepares the picture
- for drawing. Note: this happens implicitly the first time the picture
- is drawn.
- */
- void endRecording();
-
-#ifndef SK_SUPPORT_LEGACY_PICTURE_CAN_RECORD
-public:
-#endif
-
/** Replays the drawing commands on the specified canvas. This internally
calls endRecording() if that has not already been called.
@param canvas the canvas receiving the drawing commands.
@@ -353,14 +294,6 @@ protected:
// playback is unchanged.
SkPicture(SkPicturePlayback*, int width, int height);
-#ifdef SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES
- // For testing. Derived classes may instantiate an alternate
- // SkBBoxHierarchy implementation
- virtual SkBBoxHierarchy* createBBoxHierarchy() const;
-#endif
-
- SkCanvas* beginRecording(int width, int height, SkBBHFactory* factory, uint32_t recordFlags);
-
private:
friend class SkPictureRecord;
friend class SkPictureTester; // for unit testing
@@ -486,6 +419,31 @@ private:
friend class GrGatherDevice;
friend class SkDebugCanvas;
+ // TODO: beginRecording, getRecordingCanvas & endRecording can now be
+ // be moved out of SkPicture (and, presumably, be directly implemented
+ // in SkPictureRecorder)
+
+ /** Returns the canvas that records the drawing commands.
+ @param width the base width for the picture, as if the recording
+ canvas' bitmap had this width.
+ @param height the base width for the picture, as if the recording
+ canvas' bitmap had this height.
+ @param factory if non-NULL, the factory used to the BBH for the recorded picture
+ @param recordFlags optional flags that control recording.
+ @return the picture canvas.
+ */
+ SkCanvas* beginRecording(int width, int height, SkBBHFactory* factory, uint32_t recordFlags);
+ /** Returns the recording canvas if one is active, or NULL if recording is
+ not active. This does not alter the refcnt on the canvas (if present).
+ */
+ SkCanvas* getRecordingCanvas() const;
+ /** Signal that the caller is done recording. This invalidates the canvas
+ returned by beginRecording/getRecordingCanvas, and prepares the picture
+ for drawing. Note: this happens implicitly the first time the picture
+ is drawn.
+ */
+ void endRecording();
+
typedef SkRefCnt INHERITED;
};
@@ -507,23 +465,4 @@ public:
virtual bool abortDrawing() = 0;
};
-#ifdef SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES
-
-class SkPictureFactory : public SkRefCnt {
-public:
- /**
- * Allocate a new SkPicture. Return NULL on failure.
- */
- virtual SkPicture* create(int width, int height) = 0;
-
-private:
- typedef SkRefCnt INHERITED;
-};
-
-#endif
-
-#ifdef SK_SUPPORT_LEGACY_PICTURE_HEADERS
-#include "SkPictureRecorder.h"
-#endif
-
#endif
diff --git a/include/core/SkPictureRecorder.h b/include/core/SkPictureRecorder.h
index d619561dd2..b496aee28e 100644
--- a/include/core/SkPictureRecorder.h
+++ b/include/core/SkPictureRecorder.h
@@ -16,35 +16,6 @@ class SkCanvas;
class SK_API SkPictureRecorder : SkNoncopyable {
public:
-#ifdef SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES
-
- SkPictureRecorder(SkPictureFactory* factory = NULL) {
- fFactory.reset(factory);
- if (NULL != fFactory.get()) {
- fFactory.get()->ref();
- }
- }
-
- /** Returns the canvas that records the drawing commands.
- @param width the base width for the picture, as if the recording
- canvas' bitmap had this width.
- @param height the base width for the picture, as if the recording
- canvas' bitmap had this height.
- @param recordFlags optional flags that control recording.
- @return the canvas.
- */
- SkCanvas* beginRecording(int width, int height, uint32_t recordFlags = 0) {
- if (NULL != fFactory) {
- fPicture.reset(fFactory->create(width, height));
- recordFlags |= SkPicture::kOptimizeForClippedPlayback_RecordingFlag;
- } else {
- fPicture.reset(SkNEW(SkPicture));
- }
-
- return fPicture->beginRecording(width, height, recordFlags);
- }
-#endif
-
/** Returns the canvas that records the drawing commands.
@param width the base width for the picture, as if the recording
canvas' bitmap had this width.
@@ -95,10 +66,6 @@ public:
}
private:
-#ifdef SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES
- SkAutoTUnref<SkPictureFactory> fFactory;
-#endif
-
#ifdef SK_BUILD_FOR_ANDROID
/** Replay the current (partially recorded) operation stream into
canvas. This call doesn't close the current recording.
diff --git a/include/core/SkRTreePicture.h b/include/core/SkRTreePicture.h
deleted file mode 100644
index 8e8a2aae47..0000000000
--- a/include/core/SkRTreePicture.h
+++ /dev/null
@@ -1,43 +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 SkRTreePicture_DEFINED
-#define SkRTreePicture_DEFINED
-
-#ifdef SK_SUPPORT_LEGACY_PICTURE_HEADERS
-#include "SkBBHFactory.h"
-#endif
-
-#ifdef SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES
-
-#include "SkPicture.h"
-
-/**
- * Subclass of SkPicture that creates an RTree acceleration structure.
- */
-class SkRTreePicture : public SkPicture {
-public:
- virtual SkBBoxHierarchy* createBBoxHierarchy() const SK_OVERRIDE;
-
-private:
- typedef SkPicture INHERITED;
-};
-
-class SkRTreePictureFactory : public SkPictureFactory {
-public:
- SkRTreePictureFactory() {}
-
- virtual SkPicture* create(int width, int height) SK_OVERRIDE {
- return SkNEW(SkRTreePicture);
- }
-
-private:
- typedef SkPictureFactory INHERITED;
-};
-#endif
-
-#endif
diff --git a/include/core/SkTileGridPicture.h b/include/core/SkTileGridPicture.h
deleted file mode 100644
index 0196940919..0000000000
--- a/include/core/SkTileGridPicture.h
+++ /dev/null
@@ -1,64 +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.
- */
-
-#ifndef SkTileGridPicture_DEFINED
-#define SkTileGridPicture_DEFINED
-
-#ifdef SK_SUPPORT_LEGACY_PICTURE_HEADERS
-#include "SkBBHFactory.h"
-#endif
-
-#ifdef SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES
-
-#include "SkPicture.h"
-#include "SkPoint.h"
-#include "SkSize.h"
-
-/**
- * Subclass of SkPicture that creates an SkTileGrid. The tile grid has lower recording
- * and playback costs then rTree, but is less effective at eliminating extraneous
- * primitives for arbitrary query rectangles. It is most effective for
- * tiled playback when the tile structure is known at record time.
- */
-class SK_API SkTileGridPicture : public SkPicture {
-public:
- typedef SkTileGridFactory::TileGridInfo TileGridInfo;
-
- /**
- * Constructor
- * @param width recording canvas width in device pixels
- * @param height recording canvas height in device pixels
- * @param info description of the tiling layout
- */
- SkTileGridPicture(int width, int height, const SkTileGridFactory::TileGridInfo& info);
-
- virtual SkBBoxHierarchy* createBBoxHierarchy() const SK_OVERRIDE;
-
-private:
- int fXTileCount, fYTileCount;
- SkTileGridFactory::TileGridInfo fInfo;
-
- typedef SkPicture INHERITED;
-};
-
-class SkTileGridPictureFactory : public SkPictureFactory {
-public:
- SkTileGridPictureFactory(const SkTileGridFactory::TileGridInfo& info) : fInfo(info) { }
-
- virtual SkPicture* create(int width, int height) SK_OVERRIDE {
- return SkNEW_ARGS(SkTileGridPicture, (width, height, fInfo));
- }
-
-protected:
- SkTileGridFactory::TileGridInfo fInfo;
-
-private:
- typedef SkPictureFactory INHERITED;
-};
-#endif
-
-#endif