• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2018 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #ifndef SkPicturePriv_DEFINED
9 #define SkPicturePriv_DEFINED
10 
11 #include "SkPicture.h"
12 
13 class SkReadBuffer;
14 class SkWriteBuffer;
15 
16 class SkPicturePriv {
17 public:
18     /**
19      *  Recreate a picture that was serialized into a buffer. If the creation requires bitmap
20      *  decoding, the decoder must be set on the SkReadBuffer parameter by calling
21      *  SkReadBuffer::setBitmapDecoder() before calling SkPicture::MakeFromBuffer().
22      *  @param buffer Serialized picture data.
23      *  @return A new SkPicture representing the serialized data, or NULL if the buffer is
24      *          invalid.
25      */
26     static sk_sp<SkPicture> MakeFromBuffer(SkReadBuffer& buffer);
27 
28     /**
29      *  Serialize to a buffer.
30      */
31     static void Flatten(const sk_sp<const SkPicture> , SkWriteBuffer& buffer);
32 
33     // Returns NULL if this is not an SkBigPicture.
AsSkBigPicture(const sk_sp<const SkPicture> picture)34     static const SkBigPicture* AsSkBigPicture(const sk_sp<const SkPicture> picture) {
35         return picture->asSkBigPicture();
36     }
37 };
38 
39 #endif
40