SkPicturePriv.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. #ifndef SkPicturePriv_DEFINED
  8. #define SkPicturePriv_DEFINED
  9. #include "include/core/SkPicture.h"
  10. class SkReadBuffer;
  11. class SkWriteBuffer;
  12. class SkPicturePriv {
  13. public:
  14. /**
  15. * Recreate a picture that was serialized into a buffer. If the creation requires bitmap
  16. * decoding, the decoder must be set on the SkReadBuffer parameter by calling
  17. * SkReadBuffer::setBitmapDecoder() before calling SkPicture::MakeFromBuffer().
  18. * @param buffer Serialized picture data.
  19. * @return A new SkPicture representing the serialized data, or NULL if the buffer is
  20. * invalid.
  21. */
  22. static sk_sp<SkPicture> MakeFromBuffer(SkReadBuffer& buffer);
  23. /**
  24. * Serialize to a buffer.
  25. */
  26. static void Flatten(const sk_sp<const SkPicture> , SkWriteBuffer& buffer);
  27. // Returns NULL if this is not an SkBigPicture.
  28. static const SkBigPicture* AsSkBigPicture(const sk_sp<const SkPicture> picture) {
  29. return picture->asSkBigPicture();
  30. }
  31. };
  32. #endif