aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkRecordedDrawable.h
diff options
context:
space:
mode:
authorGravatar msarett <msarett@google.com>2016-04-27 09:03:17 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-04-27 09:03:17 -0700
commitd636950e8ecba89c0021ce4e76037c67aa6ee2cd (patch)
tree514b71dbcd0d6486b2f019ec60f106aff01c3a71 /src/core/SkRecordedDrawable.h
parentf62b2354b376ef56028fde357e8a081436955581 (diff)
Enable flattening of SkRecordedDrawable
Diffstat (limited to 'src/core/SkRecordedDrawable.h')
-rw-r--r--src/core/SkRecordedDrawable.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/core/SkRecordedDrawable.h b/src/core/SkRecordedDrawable.h
new file mode 100644
index 0000000000..e9973b4b81
--- /dev/null
+++ b/src/core/SkRecordedDrawable.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2016 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "SkBBoxHierarchy.h"
+#include "SkDrawable.h"
+#include "SkRecord.h"
+#include "SkRecorder.h"
+
+class SkRecordedDrawable : public SkDrawable {
+public:
+ SkRecordedDrawable(SkRecord* record, SkBBoxHierarchy* bbh, SkDrawableList* drawableList,
+ const SkRect& bounds, bool doSaveLayerInfo)
+ : fRecord(SkRef(record))
+ , fBBH(SkSafeRef(bbh))
+ , fDrawableList(drawableList) // we take ownership
+ , fBounds(bounds)
+ , fDoSaveLayerInfo(doSaveLayerInfo)
+ {}
+
+ void flatten(SkWriteBuffer& buffer) const override;
+
+ static sk_sp<SkFlattenable> CreateProc(SkReadBuffer& buffer);
+
+ Factory getFactory() const override { return CreateProc; }
+
+protected:
+ SkRect onGetBounds() override { return fBounds; }
+
+ void onDraw(SkCanvas* canvas) override;
+
+ SkPicture* onNewPictureSnapshot() override;
+
+private:
+ SkAutoTUnref<SkRecord> fRecord;
+ SkAutoTUnref<SkBBoxHierarchy> fBBH;
+ SkAutoTDelete<SkDrawableList> fDrawableList;
+ const SkRect fBounds;
+ const bool fDoSaveLayerInfo;
+};