aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkPicturePlayback.h
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-04-23 22:35:42 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-04-23 22:35:42 +0000
commit8f831f262f5e57665587cb3033860eea39fe1621 (patch)
tree537c4d24071bd6974406f94eb02decf922821bea /src/core/SkPicturePlayback.h
parentdcbc3605670d60e0d834eecebc5eb0c40182007c (diff)
First step in pulling SkPicturePlayback & SkPictureRecord out of SkPicture
This CL begins the process of making SkPicturePlayback & SkPictureRecord independent of SkPicture. It just moves the PathHeap into SkPicture to get a feel for where all this is going to lead. Some items of note: SkTimedPicture (debugger/QT) should wind up being just an SkPicturePlayback-derived object. All the flattening & unflattening should migrate out of SkPicturePlayback and into SkPicture. SkPicture::initForPlayback should eventually become something just SkPictureRecorder::endRecording calls. SkPicture is passed into SkPicturePlayback's & SkPictureRecord's constructors. SkPicturePlayback only holds onto a "const SkPicture*". The SkPicturePlayback:: CreateFromStream & CreateFromBuffer methods pass a non-const SkPicture* down the call stack. BUG=skia:2315 R=reed@google.com Author: robertphillips@google.com Review URL: https://codereview.chromium.org/249453002 git-svn-id: http://skia.googlecode.com/svn/trunk@14341 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkPicturePlayback.h')
-rw-r--r--src/core/SkPicturePlayback.h33
1 files changed, 22 insertions, 11 deletions
diff --git a/src/core/SkPicturePlayback.h b/src/core/SkPicturePlayback.h
index cae8841f3f..8df42785a2 100644
--- a/src/core/SkPicturePlayback.h
+++ b/src/core/SkPicturePlayback.h
@@ -75,12 +75,17 @@ struct SkPictCopyInfo {
class SkPicturePlayback {
public:
- SkPicturePlayback(const SkPicturePlayback& src, SkPictCopyInfo* deepCopyInfo = NULL);
- SkPicturePlayback(const SkPictureRecord& record, const SkPictInfo&, bool deepCopy = false);
- static SkPicturePlayback* CreateFromStream(SkStream*,
+ SkPicturePlayback(const SkPicture* picture, const SkPicturePlayback& src,
+ SkPictCopyInfo* deepCopyInfo = NULL);
+ SkPicturePlayback(const SkPicture* picture, const SkPictureRecord& record, const SkPictInfo&,
+ bool deepCopy = false);
+ static SkPicturePlayback* CreateFromStream(SkPicture* picture,
+ SkStream*,
const SkPictInfo&,
SkPicture::InstallPixelRefProc);
- static SkPicturePlayback* CreateFromBuffer(SkReadBuffer&, const SkPictInfo&);
+ static SkPicturePlayback* CreateFromBuffer(SkPicture* picture,
+ SkReadBuffer&,
+ const SkPictInfo&);
virtual ~SkPicturePlayback();
@@ -105,10 +110,10 @@ public:
void resetOpID() { fCurOffset = 0; }
protected:
- explicit SkPicturePlayback(const SkPictInfo& info);
+ explicit SkPicturePlayback(const SkPicture* picture, const SkPictInfo& info);
- bool parseStream(SkStream*, SkPicture::InstallPixelRefProc);
- bool parseBuffer(SkReadBuffer& buffer);
+ bool parseStream(SkPicture* picture, SkStream*, SkPicture::InstallPixelRefProc);
+ bool parseBuffer(SkPicture* picture, SkReadBuffer& buffer);
#ifdef SK_DEVELOPER
virtual bool preDraw(int opIndex, int type);
virtual void postDraw(int opIndex);
@@ -139,7 +144,7 @@ private:
}
const SkPath& getPath(SkReader32& reader) {
- return (*fPathHeap)[reader.readInt() - 1];
+ return fPicture->getPath(reader.readInt() - 1);
}
SkPicture& getPicture(SkReader32& reader) {
@@ -215,17 +220,20 @@ public:
#endif
private: // these help us with reading/writing
- bool parseStreamTag(SkStream*, uint32_t tag, uint32_t size, SkPicture::InstallPixelRefProc);
- bool parseBufferTag(SkReadBuffer&, uint32_t tag, uint32_t size);
+ bool parseStreamTag(SkPicture* picture, SkStream*, uint32_t tag, uint32_t size,
+ SkPicture::InstallPixelRefProc);
+ bool parseBufferTag(SkPicture* picture, SkReadBuffer&, uint32_t tag, uint32_t size);
void flattenToBuffer(SkWriteBuffer&) const;
private:
+ // The picture that owns this SkPicturePlayback object
+ const SkPicture* fPicture;
+
// Only used by getBitmap() if the passed in index is SkBitmapHeap::INVALID_SLOT. This empty
// bitmap allows playback to draw nothing and move on.
SkBitmap fBadBitmap;
SkAutoTUnref<SkBitmapHeap> fBitmapHeap;
- SkAutoTUnref<SkPathHeap> fPathHeap;
SkTRefArray<SkBitmap>* fBitmaps;
SkTRefArray<SkPaint>* fPaints;
@@ -269,6 +277,9 @@ private:
const SkPictInfo fInfo;
+ static void WriteFactories(SkWStream* stream, const SkFactorySet& rec);
+ static void WriteTypefaces(SkWStream* stream, const SkRefCntSet& rec);
+
#ifdef SK_BUILD_FOR_ANDROID
SkMutex fDrawMutex;
bool fAbortCurrentPlayback;