Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Unified Diff: src/core/SkPictureData.h

Issue 1837913003: Add support for serializing/deserializing of SkDrawable (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add ability to specify custom flattenable factories on SkReadBuffer Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/core/SkPictureData.h
diff --git a/src/core/SkPictureData.h b/src/core/SkPictureData.h
index 3acaf579bc8e5200fda3a99ece271783faea2b8d..d51a7a10b254f46d67fe8b1db065bb4f8bac182d 100644
--- a/src/core/SkPictureData.h
+++ b/src/core/SkPictureData.h
@@ -9,6 +9,7 @@
#define SkPictureData_DEFINED
#include "SkBitmap.h"
+#include "SkDrawable.h"
#include "SkPicture.h"
#include "SkPictureContentInfo.h"
#include "SkPictureFlat.h"
@@ -43,6 +44,7 @@ struct SkPictInfo {
#define SK_PICT_FACTORY_TAG SkSetFourByteTag('f', 'a', 'c', 't')
#define SK_PICT_TYPEFACE_TAG SkSetFourByteTag('t', 'p', 'f', 'c')
#define SK_PICT_PICTURE_TAG SkSetFourByteTag('p', 'c', 't', 'r')
+#define SK_PICT_DRAWABLE_TAG SkSetFourByteTag('d', 'r', 'a', 'w')
// This tag specifies the size of the ReadBuffer, needed for the following tags
#define SK_PICT_BUFFER_SIZE_TAG SkSetFourByteTag('a', 'r', 'a', 'y')
@@ -108,6 +110,12 @@ public:
return fPictureRefs[index - 1];
}
+ SkDrawable* getDrawable(SkReader32* reader) const {
+ int index = reader->readInt();
+ SkASSERT(index > 0 && index <= fDrawableCount);
+ return fDrawableRefs[index - 1];
+ }
+
const SkPaint* getPaint(SkReader32* reader) const {
int index = reader->readInt();
if (index == 0) {
@@ -162,6 +170,8 @@ private:
const SkPicture** fPictureRefs;
int fPictureCount;
+ SkDrawable** fDrawableRefs;
+ int fDrawableCount;
const SkTextBlob** fTextBlobRefs;
int fTextBlobCount;
const SkImage** fImageRefs;

Powered by Google App Engine
This is Rietveld 408576698