OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #ifndef SkWriteBuffer_DEFINED | 9 #ifndef SkWriteBuffer_DEFINED |
10 #define SkWriteBuffer_DEFINED | 10 #define SkWriteBuffer_DEFINED |
11 | 11 |
12 #include "SkData.h" | 12 #include "SkData.h" |
13 #include "SkPath.h" | 13 #include "SkPath.h" |
14 #include "SkPicture.h" | 14 #include "SkPicture.h" |
| 15 #include "SkPixelSerializer.h" |
15 #include "SkRefCnt.h" | 16 #include "SkRefCnt.h" |
16 #include "SkWriter32.h" | 17 #include "SkWriter32.h" |
17 | 18 |
18 class SkBitmap; | 19 class SkBitmap; |
19 class SkBitmapHeap; | 20 class SkBitmapHeap; |
20 class SkFactorySet; | 21 class SkFactorySet; |
21 class SkFlattenable; | 22 class SkFlattenable; |
22 class SkNamedFactorySet; | 23 class SkNamedFactorySet; |
23 class SkRefCntSet; | 24 class SkRefCntSet; |
24 | 25 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 | 81 |
81 SkFactorySet* setFactoryRecorder(SkFactorySet*); | 82 SkFactorySet* setFactoryRecorder(SkFactorySet*); |
82 SkNamedFactorySet* setNamedFactoryRecorder(SkNamedFactorySet*); | 83 SkNamedFactorySet* setNamedFactoryRecorder(SkNamedFactorySet*); |
83 | 84 |
84 SkRefCntSet* getTypefaceRecorder() const { return fTFSet; } | 85 SkRefCntSet* getTypefaceRecorder() const { return fTFSet; } |
85 SkRefCntSet* setTypefaceRecorder(SkRefCntSet*); | 86 SkRefCntSet* setTypefaceRecorder(SkRefCntSet*); |
86 | 87 |
87 /** | 88 /** |
88 * Set an SkBitmapHeap to store bitmaps rather than flattening. | 89 * Set an SkBitmapHeap to store bitmaps rather than flattening. |
89 * | 90 * |
90 * Incompatible with an EncodeBitmap function. If an EncodeBitmap function i
s set, setting an | 91 * Incompatible with an SkPixelSerializer. |
91 * SkBitmapHeap will set the function to NULL in release mode and crash in d
ebug. | |
92 */ | 92 */ |
93 void setBitmapHeap(SkBitmapHeap*); | 93 void setBitmapHeap(SkBitmapHeap*); |
94 | 94 |
95 /** | 95 /** |
96 * Provide a function to encode an SkBitmap to an SkData. writeBitmap will a
ttempt to use | |
97 * bitmapEncoder to store the SkBitmap. If the reader does not provide a fun
ction to decode, it | |
98 * will not be able to restore SkBitmaps, but will still be able to read the
rest of the stream. | |
99 * bitmapEncoder will never be called with a NULL pixelRefOffset. | |
100 * | |
101 * Incompatible with the SkBitmapHeap. If an encoder is set fBitmapHeap will
be set to NULL in | 96 * Incompatible with the SkBitmapHeap. If an encoder is set fBitmapHeap will
be set to NULL in |
102 * release and crash in debug. | 97 * release and crash in debug. |
103 */ | 98 */ |
104 void setBitmapEncoder(SkPicture::EncodeBitmap bitmapEncoder); | 99 void setPixelSerializer(SkPixelSerializer*); |
105 | 100 |
106 private: | 101 private: |
107 bool isValidating() const { return SkToBool(fFlags & kValidation_Flag); } | 102 bool isValidating() const { return SkToBool(fFlags & kValidation_Flag); } |
108 | 103 |
109 const uint32_t fFlags; | 104 const uint32_t fFlags; |
110 SkFactorySet* fFactorySet; | 105 SkFactorySet* fFactorySet; |
111 SkNamedFactorySet* fNamedFactorySet; | 106 SkNamedFactorySet* fNamedFactorySet; |
112 SkWriter32 fWriter; | 107 SkWriter32 fWriter; |
113 | 108 |
114 SkBitmapHeap* fBitmapHeap; | 109 SkBitmapHeap* fBitmapHeap; |
115 SkRefCntSet* fTFSet; | 110 SkRefCntSet* fTFSet; |
116 | 111 |
117 SkPicture::EncodeBitmap fBitmapEncoder; | 112 SkAutoTUnref<SkPixelSerializer> fPixelSerializer; |
118 }; | 113 }; |
119 | 114 |
120 #endif // SkWriteBuffer_DEFINED | 115 #endif // SkWriteBuffer_DEFINED |
OLD | NEW |