aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-02-07 12:20:04 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-02-07 12:20:04 +0000
commit5e0995e4b36178e1e4465a9f50114ed39f038c27 (patch)
tree498383bc4eb8d52e5debb865ff4751c506beb768 /include
parent7713c38dc0182c8f6a685dace5101c49301de00d (diff)
Revert of Revert "Serialization of SkPictureImageFilter" (https://codereview.chromium.org/153583007/)
Reason for revert: New SKPs with version20 are in Google Storage due to http://108.170.219.160:10117/builders/Housekeeper-Nightly-RecreateSKPs/builds/22 Original issue's description: > Revert "Serialization of SkPictureImageFilter" > > This reverts commit 227321b30106e57942929eb96fa5bc22544f6c9e. > > Revert "Sanitizing source files in Housekeeper-Nightly" > > This reverts commit baf28584b7636c01355f8d8d972e06aa7fb66d77. > > TBR=robertphillips@google.com,sugoi@google.com > > Committed: https://code.google.com/p/skia/source/detail?r=13356 R=robertphillips@google.com, sugoi@google.com, fmalita@google.com, fmalita@chromium.org TBR=fmalita@chromium.org, fmalita@google.com, robertphillips@google.com, sugoi@google.com NOTREECHECKS=true NOTRY=true Author: rmistry@google.com Review URL: https://codereview.chromium.org/143163005 git-svn-id: http://skia.googlecode.com/svn/trunk@13357 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r--include/core/SkImage.h2
-rw-r--r--include/core/SkPicture.h21
-rw-r--r--include/effects/SkColorMatrix.h2
-rw-r--r--include/effects/SkPictureImageFilter.h8
4 files changed, 29 insertions, 4 deletions
diff --git a/include/core/SkImage.h b/include/core/SkImage.h
index 2353655781..c9f9396166 100644
--- a/include/core/SkImage.h
+++ b/include/core/SkImage.h
@@ -85,7 +85,7 @@ public:
* ignored.
*/
const void* peekPixels(SkImageInfo* info, size_t* rowBytes) const;
-
+
/**
* Encode the image's pixels and return the result as a new SkData, which
* the caller must manage (i.e. call unref() when they are done).
diff --git a/include/core/SkPicture.h b/include/core/SkPicture.h
index 82d6835dbd..a717153dbe 100644
--- a/include/core/SkPicture.h
+++ b/include/core/SkPicture.h
@@ -68,6 +68,16 @@ public:
static SkPicture* CreateFromStream(SkStream*,
InstallPixelRefProc proc = &SkImageDecoder::DecodeMemory);
+ /**
+ * Recreate a picture that was serialized into a buffer. If the creation requires bitmap
+ * decoding, the decoder must be set on the SkReadBuffer parameter by calling
+ * SkReadBuffer::setBitmapDecoder() before calling SkPicture::CreateFromBuffer().
+ * @param SkReadBuffer Serialized picture data.
+ * @return A new SkPicture representing the serialized data, or NULL if the buffer is
+ * invalid.
+ */
+ static SkPicture* CreateFromBuffer(SkReadBuffer&);
+
virtual ~SkPicture();
/**
@@ -187,6 +197,11 @@ public:
void serialize(SkWStream*, EncodeBitmap encoder = NULL) const;
/**
+ * Serialize to a buffer.
+ */
+ void flatten(SkWriteBuffer&) const;
+
+ /**
* Returns true if any bitmaps may be produced when this SkPicture
* is replayed.
* Returns false if called while still recording.
@@ -223,7 +238,8 @@ protected:
// V17: SkPixelRef now writes SkImageInfo
// V18: SkBitmap now records x,y for its pixelref origin, instead of offset.
// V19: encode matrices and regions into the ops stream
- static const uint32_t PICTURE_VERSION = 19;
+ // V20: added bool to SkPictureImageFilter's serialization (to allow SkPicture serialization)
+ static const uint32_t PICTURE_VERSION = 20;
// fPlayback, fRecord, fWidth & fHeight are protected to allow derived classes to
// install their own SkPicturePlayback-derived players,SkPictureRecord-derived
@@ -245,7 +261,10 @@ protected:
// will be ready to be parsed to create an SkPicturePlayback.
// If false is returned, SkPictInfo is unmodified.
static bool StreamIsSKP(SkStream*, SkPictInfo*);
+ static bool BufferIsSKP(SkReadBuffer&, SkPictInfo*);
private:
+ void createHeader(void* header) const;
+
friend class SkFlatPicture;
friend class SkPicturePlayback;
diff --git a/include/effects/SkColorMatrix.h b/include/effects/SkColorMatrix.h
index 8ff45f9277..c598a1210e 100644
--- a/include/effects/SkColorMatrix.h
+++ b/include/effects/SkColorMatrix.h
@@ -19,7 +19,7 @@ public:
kG_Scale = 6,
kB_Scale = 12,
kA_Scale = 18,
-
+
kR_Trans = 4,
kG_Trans = 9,
kB_Trans = 14,
diff --git a/include/effects/SkPictureImageFilter.h b/include/effects/SkPictureImageFilter.h
index eeaf1d2e46..a10d23eebb 100644
--- a/include/effects/SkPictureImageFilter.h
+++ b/include/effects/SkPictureImageFilter.h
@@ -28,7 +28,13 @@ public:
protected:
virtual ~SkPictureImageFilter();
- explicit SkPictureImageFilter(SkReadBuffer& buffer);
+ /* Constructs an SkPictureImageFilter object from an SkReadBuffer.
+ * Note: If the SkPictureImageFilter object construction requires bitmap
+ * decoding, the decoder must be set on the SkReadBuffer parameter by calling
+ * SkReadBuffer::setBitmapDecoder() before calling this constructor.
+ * @param SkReadBuffer Serialized picture data.
+ */
+ explicit SkPictureImageFilter(SkReadBuffer&);
virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;