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 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 void writeColorArray(const SkColor* color, uint32_t count); | 66 void writeColorArray(const SkColor* color, uint32_t count); |
67 void writePoint(const SkPoint& point); | 67 void writePoint(const SkPoint& point); |
68 void writePointArray(const SkPoint* point, uint32_t count); | 68 void writePointArray(const SkPoint* point, uint32_t count); |
69 void writeMatrix(const SkMatrix& matrix); | 69 void writeMatrix(const SkMatrix& matrix); |
70 void writeIRect(const SkIRect& rect); | 70 void writeIRect(const SkIRect& rect); |
71 void writeRect(const SkRect& rect); | 71 void writeRect(const SkRect& rect); |
72 void writeRegion(const SkRegion& region); | 72 void writeRegion(const SkRegion& region); |
73 void writePath(const SkPath& path); | 73 void writePath(const SkPath& path); |
74 size_t writeStream(SkStream* stream, size_t length); | 74 size_t writeStream(SkStream* stream, size_t length); |
75 void writeBitmap(const SkBitmap& bitmap); | 75 void writeBitmap(const SkBitmap& bitmap); |
| 76 void writeImage(const SkImage*); |
76 void writeTypeface(SkTypeface* typeface); | 77 void writeTypeface(SkTypeface* typeface); |
77 void writePaint(const SkPaint& paint) { paint.flatten(*this); } | 78 void writePaint(const SkPaint& paint) { paint.flatten(*this); } |
78 | 79 |
79 bool writeToStream(SkWStream*); | 80 bool writeToStream(SkWStream*); |
80 void writeToMemory(void* dst) { fWriter.flatten(dst); } | 81 void writeToMemory(void* dst) { fWriter.flatten(dst); } |
81 | 82 |
82 SkFactorySet* setFactoryRecorder(SkFactorySet*); | 83 SkFactorySet* setFactoryRecorder(SkFactorySet*); |
83 SkNamedFactorySet* setNamedFactoryRecorder(SkNamedFactorySet*); | 84 SkNamedFactorySet* setNamedFactoryRecorder(SkNamedFactorySet*); |
84 | 85 |
85 SkRefCntSet* getTypefaceRecorder() const { return fTFSet; } | 86 SkRefCntSet* getTypefaceRecorder() const { return fTFSet; } |
(...skipping 13 matching lines...) Expand all Loading... |
99 * e.g. SkBitmaps. | 100 * e.g. SkBitmaps. |
100 * | 101 * |
101 * Calls ref() on the serializer. | 102 * Calls ref() on the serializer. |
102 * | 103 * |
103 * TODO: Encode SkImage pixels as well. | 104 * TODO: Encode SkImage pixels as well. |
104 * | 105 * |
105 * Incompatible with the SkBitmapHeap. If an encoder is set fBitmapHeap will | 106 * Incompatible with the SkBitmapHeap. If an encoder is set fBitmapHeap will |
106 * be set to NULL in release and crash in debug. | 107 * be set to NULL in release and crash in debug. |
107 */ | 108 */ |
108 void setPixelSerializer(SkPixelSerializer*); | 109 void setPixelSerializer(SkPixelSerializer*); |
| 110 SkPixelSerializer* getPixelSerializer() const { return fPixelSerializer; } |
109 | 111 |
110 private: | 112 private: |
111 bool isValidating() const { return SkToBool(fFlags & kValidation_Flag); } | 113 bool isValidating() const { return SkToBool(fFlags & kValidation_Flag); } |
112 | 114 |
113 const uint32_t fFlags; | 115 const uint32_t fFlags; |
114 SkFactorySet* fFactorySet; | 116 SkFactorySet* fFactorySet; |
115 SkNamedFactorySet* fNamedFactorySet; | 117 SkNamedFactorySet* fNamedFactorySet; |
116 SkWriter32 fWriter; | 118 SkWriter32 fWriter; |
117 | 119 |
118 SkBitmapHeap* fBitmapHeap; | 120 SkBitmapHeap* fBitmapHeap; |
119 SkRefCntSet* fTFSet; | 121 SkRefCntSet* fTFSet; |
120 | 122 |
121 SkAutoTUnref<SkPixelSerializer> fPixelSerializer; | 123 SkAutoTUnref<SkPixelSerializer> fPixelSerializer; |
122 }; | 124 }; |
123 | 125 |
124 #endif // SkWriteBuffer_DEFINED | 126 #endif // SkWriteBuffer_DEFINED |
OLD | NEW |