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 void beginCommentGroup(const char* description) SK_OVERRIDE; | 32 void beginCommentGroup(const char* description) override; |
33 void addComment(const char* kywd, const char* value) SK_OVERRIDE; | 33 void addComment(const char* kywd, const char* value) override; |
34 void endCommentGroup() SK_OVERRIDE; | 34 void endCommentGroup() 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 SkSurface* onNewSurface(const SkImageInfo&, const SkSurfaceProps&) SK_OVERRI
DE; | 149 SkSurface* onNewSurface(const SkImageInfo&, const SkSurfaceProps&) override; |
150 const void* onPeekPixels(SkImageInfo*, size_t*) SK_OVERRIDE { | 150 const void* onPeekPixels(SkImageInfo*, size_t*) override { |
151 return NULL; | 151 return NULL; |
152 } | 152 } |
153 | 153 |
154 void willSave() SK_OVERRIDE; | 154 void willSave() override; |
155 SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SaveFlags) SK
_OVERRIDE; | 155 SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SaveFlags) ov
erride; |
156 void willRestore() SK_OVERRIDE; | 156 void willRestore() override; |
157 | 157 |
158 void didConcat(const SkMatrix&) SK_OVERRIDE; | 158 void didConcat(const SkMatrix&) override; |
159 void didSetMatrix(const SkMatrix&) SK_OVERRIDE; | 159 void didSetMatrix(const SkMatrix&) override; |
160 | 160 |
161 void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRID
E; | 161 void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) override; |
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&) 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&) 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&) 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&) overri
de; |
171 virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, | 171 virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, |
172 const SkPaint& paint) SK_OVERRIDE; | 172 const SkPaint& paint) override; |
173 | 173 |
174 virtual void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4], | 174 virtual void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4], |
175 const SkPoint texCoords[4], SkXfermode* xmode, | 175 const SkPoint texCoords[4], SkXfermode* xmode, |
176 const SkPaint& paint) SK_OVERRIDE; | 176 const SkPaint& paint) override; |
177 | 177 |
178 void onDrawPaint(const SkPaint&) SK_OVERRIDE; | 178 void onDrawPaint(const SkPaint&) override; |
179 void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPain
t&) SK_OVERRIDE; | 179 void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPain
t&) override; |
180 void onDrawRect(const SkRect&, const SkPaint&) SK_OVERRIDE; | 180 void onDrawRect(const SkRect&, const SkPaint&) override; |
181 void onDrawOval(const SkRect&, const SkPaint&) SK_OVERRIDE; | 181 void onDrawOval(const SkRect&, const SkPaint&) override; |
182 void onDrawRRect(const SkRRect&, const SkPaint&) SK_OVERRIDE; | 182 void onDrawRRect(const SkRRect&, const SkPaint&) override; |
183 void onDrawPath(const SkPath&, const SkPaint&) SK_OVERRIDE; | 183 void onDrawPath(const SkPath&, const SkPaint&) override; |
184 void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPain
t*) SK_OVERRIDE; | 184 void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPain
t*) override; |
185 void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst,
const SkPaint*, | 185 void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst,
const SkPaint*, |
186 DrawBitmapRectFlags flags) SK_OVERRIDE; | 186 DrawBitmapRectFlags flags) override; |
187 #if 0 | 187 #if 0 |
188 // rely on conversion to bitmap (for now) | 188 // rely on conversion to bitmap (for now) |
189 void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*
) SK_OVERRIDE; | 189 void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*
) override; |
190 void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst, | 190 void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst, |
191 const SkPaint*) SK_OVERRIDE; | 191 const SkPaint*) override; |
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*) 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*) overri
de; |
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&) override; |
201 | 201 |
202 void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; | 202 void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) override; |
203 void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; | 203 void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) override; |
204 void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; | 204 void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) override; |
205 void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE; | 205 void onClipRegion(const SkRegion&, SkRegion::Op) override; |
206 | 206 |
207 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) SK_OVE
RRIDE; | 207 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) overri
de; |
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 |