| 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. If an SkPixelSerializer is set, |
| 91 * SkBitmapHeap will set the function to NULL in release mode and crash in d
ebug. | 92 * setting an SkBitmapHeap will set the SkPixelSerializer to NULL in release |
| 93 * and crash in debug. |
| 92 */ | 94 */ |
| 93 void setBitmapHeap(SkBitmapHeap*); | 95 void setBitmapHeap(SkBitmapHeap*); |
| 94 | 96 |
| 95 /** | 97 /** |
| 96 * Provide a function to encode an SkBitmap to an SkData. writeBitmap will a
ttempt to use | 98 * Set an SkPixelSerializer to store an encoded representation of pixels, |
| 97 * bitmapEncoder to store the SkBitmap. If the reader does not provide a fun
ction to decode, it | 99 * e.g. SkBitmaps. |
| 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 * | 100 * |
| 101 * Incompatible with the SkBitmapHeap. If an encoder is set fBitmapHeap will
be set to NULL in | 101 * Calls ref() on the serializer. |
| 102 * release and crash in debug. | 102 * |
| 103 * TODO: Encode SkImage pixels as well. |
| 104 * |
| 105 * Incompatible with the SkBitmapHeap. If an encoder is set fBitmapHeap will |
| 106 * be set to NULL in release and crash in debug. |
| 103 */ | 107 */ |
| 104 void setBitmapEncoder(SkPicture::EncodeBitmap bitmapEncoder); | 108 void setPixelSerializer(SkPixelSerializer*); |
| 105 | 109 |
| 106 private: | 110 private: |
| 107 bool isValidating() const { return SkToBool(fFlags & kValidation_Flag); } | 111 bool isValidating() const { return SkToBool(fFlags & kValidation_Flag); } |
| 108 | 112 |
| 109 const uint32_t fFlags; | 113 const uint32_t fFlags; |
| 110 SkFactorySet* fFactorySet; | 114 SkFactorySet* fFactorySet; |
| 111 SkNamedFactorySet* fNamedFactorySet; | 115 SkNamedFactorySet* fNamedFactorySet; |
| 112 SkWriter32 fWriter; | 116 SkWriter32 fWriter; |
| 113 | 117 |
| 114 SkBitmapHeap* fBitmapHeap; | 118 SkBitmapHeap* fBitmapHeap; |
| 115 SkRefCntSet* fTFSet; | 119 SkRefCntSet* fTFSet; |
| 116 | 120 |
| 117 SkPicture::EncodeBitmap fBitmapEncoder; | 121 SkAutoTUnref<SkPixelSerializer> fPixelSerializer; |
| 118 }; | 122 }; |
| 119 | 123 |
| 120 #endif // SkWriteBuffer_DEFINED | 124 #endif // SkWriteBuffer_DEFINED |
| OLD | NEW |