• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 /*
3  * Copyright 2012 Google Inc.
4  *
5  * Use of this source code is governed by a BSD-style license that can be
6  * found in the LICENSE file.
7  */
8 
9 #ifndef SkSerializationHelpers_DEFINED
10 #define SkSerializationHelpers_DEFINED
11 
12 class SkBitmap;
13 class SkStream;
14 class SkWStream;
15 
16 namespace SkSerializationHelpers {
17     /**
18      *  Function to encode an SkBitmap to an SkWStream. A function with this signature can be passed
19      *  to SkPicture::serialize() and SkOrderedWriteBuffer. The function should return true if it
20      *  succeeds. Otherwise it should return false so that SkOrderedWriteBuffer can switch to
21      *  another method of storing SkBitmaps.
22      */
23     typedef bool (*EncodeBitmap)(SkWStream*, const SkBitmap&);
24 
25     /**
26      *  Function to decode an SkBitmap from an SkStream. A function with this signature can be
27      *  passed to the SkStream constructor for SkPicture and SkOrderedReadBuffer to decode SkBitmaps
28      *  which were previously encoded. The function should return true if it succeeds. Otherwise it
29      *  should return false so that SkOrderedReadBuffer can skip the data and provide a dummy
30      *  SkBitmap.
31      */
32     typedef bool (*DecodeBitmap)(SkStream*, SkBitmap*);
33 }
34 
35 #endif // SkSerializationHelpers_DEFINED
36