OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkPictureRecord_DEFINED | 8 #ifndef SkPictureRecord_DEFINED |
9 #define SkPictureRecord_DEFINED | 9 #define SkPictureRecord_DEFINED |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 small = (combined >> 24) & 0xFF; \ | 22 small = (combined >> 24) & 0xFF; \ |
23 large = combined & MASK_24; | 23 large = combined & MASK_24; |
24 #define PACK_8_24(small, large) ((small << 24) | large) | 24 #define PACK_8_24(small, large) ((small << 24) | large) |
25 | 25 |
26 | 26 |
27 class SkPictureRecord : public SkCanvas { | 27 class SkPictureRecord : public SkCanvas { |
28 public: | 28 public: |
29 SkPictureRecord(const SkISize& dimensions, uint32_t recordFlags); | 29 SkPictureRecord(const SkISize& dimensions, uint32_t recordFlags); |
30 virtual ~SkPictureRecord(); | 30 virtual ~SkPictureRecord(); |
31 | 31 |
32 virtual void beginCommentGroup(const char* description) SK_OVERRIDE; | 32 void beginCommentGroup(const char* description) SK_OVERRIDE; |
33 virtual void addComment(const char* kywd, const char* value) SK_OVERRIDE; | 33 void addComment(const char* kywd, const char* value) SK_OVERRIDE; |
34 virtual void endCommentGroup() SK_OVERRIDE; | 34 void endCommentGroup() SK_OVERRIDE; |
35 | 35 |
36 const SkTDArray<const SkPicture* >& getPictureRefs() const { | 36 const SkTDArray<const SkPicture* >& getPictureRefs() const { |
37 return fPictureRefs; | 37 return fPictureRefs; |
38 } | 38 } |
39 | 39 |
40 const SkTDArray<const SkTextBlob* >& getTextBlobRefs() const { | 40 const SkTDArray<const SkTextBlob* >& getTextBlobRefs() const { |
41 return fTextBlobRefs; | 41 return fTextBlobRefs; |
42 } | 42 } |
43 | 43 |
44 SkData* opData(bool deepCopy) const { | 44 SkData* opData(bool deepCopy) const { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 void addText(const void* text, size_t byteLength); | 139 void addText(const void* text, size_t byteLength); |
140 void addTextBlob(const SkTextBlob* blob); | 140 void addTextBlob(const SkTextBlob* blob); |
141 | 141 |
142 int find(const SkBitmap& bitmap); | 142 int find(const SkBitmap& bitmap); |
143 | 143 |
144 protected: | 144 protected: |
145 void validate(size_t initialOffset, size_t size) const { | 145 void validate(size_t initialOffset, size_t size) const { |
146 SkASSERT(fWriter.bytesWritten() == initialOffset + size); | 146 SkASSERT(fWriter.bytesWritten() == initialOffset + size); |
147 } | 147 } |
148 | 148 |
149 virtual SkSurface* onNewSurface(const SkImageInfo&, const SkSurfaceProps&) S
K_OVERRIDE; | 149 SkSurface* onNewSurface(const SkImageInfo&, const SkSurfaceProps&) SK_OVERRI
DE; |
150 const void* onPeekPixels(SkImageInfo*, size_t*) SK_OVERRIDE { | 150 const void* onPeekPixels(SkImageInfo*, size_t*) SK_OVERRIDE { |
151 return NULL; | 151 return NULL; |
152 } | 152 } |
153 | 153 |
154 virtual void willSave() SK_OVERRIDE; | 154 void willSave() SK_OVERRIDE; |
155 virtual SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SaveF
lags) SK_OVERRIDE; | 155 SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SaveFlags) SK
_OVERRIDE; |
156 virtual void willRestore() SK_OVERRIDE; | 156 void willRestore() SK_OVERRIDE; |
157 | 157 |
158 virtual void didConcat(const SkMatrix&) SK_OVERRIDE; | 158 void didConcat(const SkMatrix&) SK_OVERRIDE; |
159 virtual void didSetMatrix(const SkMatrix&) SK_OVERRIDE; | 159 void didSetMatrix(const SkMatrix&) SK_OVERRIDE; |
160 | 160 |
161 virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK
_OVERRIDE; | 161 void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRID
E; |
162 | 162 |
163 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, SkS
calar y, | 163 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, SkS
calar y, |
164 const SkPaint&) SK_OVERRIDE; | 164 const SkPaint&) SK_OVERRIDE; |
165 virtual void onDrawPosText(const void* text, size_t byteLength, const SkPoin
t pos[], | 165 virtual void onDrawPosText(const void* text, size_t byteLength, const SkPoin
t pos[], |
166 const SkPaint&) SK_OVERRIDE; | 166 const SkPaint&) SK_OVERRIDE; |
167 virtual void onDrawPosTextH(const void* text, size_t byteLength, const SkSca
lar xpos[], | 167 virtual void onDrawPosTextH(const void* text, size_t byteLength, const SkSca
lar xpos[], |
168 SkScalar constY, const SkPaint&) SK_OVERRIDE; | 168 SkScalar constY, const SkPaint&) SK_OVERRIDE; |
169 virtual void onDrawTextOnPath(const void* text, size_t byteLength, const SkP
ath& path, | 169 virtual void onDrawTextOnPath(const void* text, size_t byteLength, const SkP
ath& path, |
170 const SkMatrix* matrix, const SkPaint&) SK_OVE
RRIDE; | 170 const SkMatrix* matrix, const SkPaint&) SK_OVE
RRIDE; |
171 virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, | 171 virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, |
(...skipping 20 matching lines...) Expand all Loading... |
192 #endif | 192 #endif |
193 void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect&
dst, | 193 void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect&
dst, |
194 const SkPaint*) SK_OVERRIDE; | 194 const SkPaint*) SK_OVERRIDE; |
195 void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*) SK_OVE
RRIDE; | 195 void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*) SK_OVE
RRIDE; |
196 void onDrawVertices(VertexMode vmode, int vertexCount, | 196 void onDrawVertices(VertexMode vmode, int vertexCount, |
197 const SkPoint vertices[], const SkPoint texs[], | 197 const SkPoint vertices[], const SkPoint texs[], |
198 const SkColor colors[], SkXfermode* xmode, | 198 const SkColor colors[], SkXfermode* xmode, |
199 const uint16_t indices[], int indexCount, | 199 const uint16_t indices[], int indexCount, |
200 const SkPaint&) SK_OVERRIDE; | 200 const SkPaint&) SK_OVERRIDE; |
201 | 201 |
202 virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERR
IDE; | 202 void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; |
203 virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVE
RRIDE; | 203 void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; |
204 virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERR
IDE; | 204 void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; |
205 virtual void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE; | 205 void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE; |
206 | 206 |
207 virtual void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*
) SK_OVERRIDE; | 207 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) SK_OVE
RRIDE; |
208 | 208 |
209 int addPathToHeap(const SkPath& path); // does not write to ops stream | 209 int addPathToHeap(const SkPath& path); // does not write to ops stream |
210 | 210 |
211 // These entry points allow the writing of matrices, clips, saves & | 211 // These entry points allow the writing of matrices, clips, saves & |
212 // restores to be deferred (e.g., if the MC state is being collapsed and | 212 // restores to be deferred (e.g., if the MC state is being collapsed and |
213 // only written out as needed). | 213 // only written out as needed). |
214 void recordConcat(const SkMatrix& matrix); | 214 void recordConcat(const SkMatrix& matrix); |
215 void recordTranslate(const SkMatrix& matrix); | 215 void recordTranslate(const SkMatrix& matrix); |
216 void recordScale(const SkMatrix& matrix); | 216 void recordScale(const SkMatrix& matrix); |
217 size_t recordClipRect(const SkRect& rect, SkRegion::Op op, bool doAA); | 217 size_t recordClipRect(const SkRect& rect, SkRegion::Op op, bool doAA); |
(...skipping 19 matching lines...) Expand all Loading... |
237 | 237 |
238 uint32_t fRecordFlags; | 238 uint32_t fRecordFlags; |
239 int fInitialSaveCount; | 239 int fInitialSaveCount; |
240 | 240 |
241 friend class SkPictureData; // for SkPictureData's SkPictureRecord-based c
onstructor | 241 friend class SkPictureData; // for SkPictureData's SkPictureRecord-based c
onstructor |
242 | 242 |
243 typedef SkCanvas INHERITED; | 243 typedef SkCanvas INHERITED; |
244 }; | 244 }; |
245 | 245 |
246 #endif | 246 #endif |
OLD | NEW |