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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 return offset; | 115 return offset; |
116 } | 116 } |
117 | 117 |
118 void addInt(int value) { | 118 void addInt(int value) { |
119 fWriter.writeInt(value); | 119 fWriter.writeInt(value); |
120 } | 120 } |
121 void addScalar(SkScalar scalar) { | 121 void addScalar(SkScalar scalar) { |
122 fWriter.writeScalar(scalar); | 122 fWriter.writeScalar(scalar); |
123 } | 123 } |
124 | 124 |
125 void addBitmap(const SkBitmap& bitmap); | |
126 void addImage(const SkImage*); | 125 void addImage(const SkImage*); |
127 void addMatrix(const SkMatrix& matrix); | 126 void addMatrix(const SkMatrix& matrix); |
128 void addPaint(const SkPaint& paint) { this->addPaintPtr(&paint); } | 127 void addPaint(const SkPaint& paint) { this->addPaintPtr(&paint); } |
129 void addPaintPtr(const SkPaint* paint); | 128 void addPaintPtr(const SkPaint* paint); |
130 void addPatch(const SkPoint cubics[12]); | 129 void addPatch(const SkPoint cubics[12]); |
131 void addPath(const SkPath& path); | 130 void addPath(const SkPath& path); |
132 void addPicture(const SkPicture* picture); | 131 void addPicture(const SkPicture* picture); |
133 void addDrawable(SkDrawable* picture); | 132 void addDrawable(SkDrawable* picture); |
134 void addPoint(const SkPoint& point); | 133 void addPoint(const SkPoint& point); |
135 void addPoints(const SkPoint pts[], int count); | 134 void addPoints(const SkPoint pts[], int count); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 const SkPaint& paint) override; | 182 const SkPaint& paint) override; |
184 void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[], const Sk
Color[], int, | 183 void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[], const Sk
Color[], int, |
185 SkXfermode::Mode, const SkRect*, const SkPaint*) override; | 184 SkXfermode::Mode, const SkRect*, const SkPaint*) override; |
186 | 185 |
187 void onDrawPaint(const SkPaint&) override; | 186 void onDrawPaint(const SkPaint&) override; |
188 void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPain
t&) override; | 187 void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPain
t&) override; |
189 void onDrawRect(const SkRect&, const SkPaint&) override; | 188 void onDrawRect(const SkRect&, const SkPaint&) override; |
190 void onDrawOval(const SkRect&, const SkPaint&) override; | 189 void onDrawOval(const SkRect&, const SkPaint&) override; |
191 void onDrawRRect(const SkRRect&, const SkPaint&) override; | 190 void onDrawRRect(const SkRRect&, const SkPaint&) override; |
192 void onDrawPath(const SkPath&, const SkPaint&) override; | 191 void onDrawPath(const SkPath&, const SkPaint&) override; |
193 void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPain
t*) override; | |
194 void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst,
const SkPaint*, | |
195 SrcRectConstraint) override; | |
196 void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*
) override; | 192 void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*
) override; |
197 void onDrawImageLattice(const SkImage*, const SkCanvas::Lattice& lattice, co
nst SkRect& dst, | 193 void onDrawImageLattice(const SkImage*, const SkCanvas::Lattice& lattice, co
nst SkRect& dst, |
198 const SkPaint*) override; | 194 const SkPaint*) override; |
199 void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst, | 195 void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst, |
200 const SkPaint*, SrcRectConstraint) override; | 196 const SkPaint*, SrcRectConstraint) override; |
201 void onDrawImageNine(const SkImage*, const SkIRect& center, const SkRect& ds
t, | 197 void onDrawImageNine(const SkImage*, const SkIRect& center, const SkRect& ds
t, |
202 const SkPaint*) override; | 198 const SkPaint*) override; |
203 void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect&
dst, | |
204 const SkPaint*) override; | |
205 void onDrawVertices(VertexMode vmode, int vertexCount, | 199 void onDrawVertices(VertexMode vmode, int vertexCount, |
206 const SkPoint vertices[], const SkPoint texs[], | 200 const SkPoint vertices[], const SkPoint texs[], |
207 const SkColor colors[], SkXfermode* xmode, | 201 const SkColor colors[], SkXfermode* xmode, |
208 const uint16_t indices[], int indexCount, | 202 const uint16_t indices[], int indexCount, |
209 const SkPaint&) override; | 203 const SkPaint&) override; |
210 | 204 |
211 void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) override; | 205 void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) override; |
212 void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) override; | 206 void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) override; |
213 void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) override; | 207 void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) override; |
214 void onClipRegion(const SkRegion&, SkRegion::Op) override; | 208 void onClipRegion(const SkRegion&, SkRegion::Op) override; |
215 | 209 |
216 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) overri
de; | 210 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) overri
de; |
217 | 211 |
| 212 // NEVER CALL -- SkRecord should have already turned these into image draws |
| 213 void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPain
t*) override { |
| 214 sk_throw(); |
| 215 } |
| 216 void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst,
const SkPaint*, |
| 217 SrcRectConstraint) override { |
| 218 sk_throw(); |
| 219 } |
| 220 void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect&
dst, |
| 221 const SkPaint*) override { |
| 222 sk_throw(); |
| 223 } |
| 224 |
| 225 |
218 #ifdef SK_EXPERIMENTAL_SHADOWING | 226 #ifdef SK_EXPERIMENTAL_SHADOWING |
219 void onDrawShadowedPicture(const SkPicture*, | 227 void onDrawShadowedPicture(const SkPicture*, |
220 const SkMatrix*, | 228 const SkMatrix*, |
221 const SkPaint*) override; | 229 const SkPaint*) override; |
222 #else | 230 #else |
223 void onDrawShadowedPicture(const SkPicture*, | 231 void onDrawShadowedPicture(const SkPicture*, |
224 const SkMatrix*, | 232 const SkMatrix*, |
225 const SkPaint*); | 233 const SkPaint*); |
226 #endif | 234 #endif |
227 | 235 |
(...skipping 12 matching lines...) Expand all Loading... |
240 size_t recordClipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA); | 248 size_t recordClipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA); |
241 size_t recordClipPath(int pathID, SkRegion::Op op, bool doAA); | 249 size_t recordClipPath(int pathID, SkRegion::Op op, bool doAA); |
242 size_t recordClipRegion(const SkRegion& region, SkRegion::Op op); | 250 size_t recordClipRegion(const SkRegion& region, SkRegion::Op op); |
243 void recordSave(); | 251 void recordSave(); |
244 void recordSaveLayer(const SaveLayerRec&); | 252 void recordSaveLayer(const SaveLayerRec&); |
245 void recordRestore(bool fillInSkips = true); | 253 void recordRestore(bool fillInSkips = true); |
246 | 254 |
247 private: | 255 private: |
248 SkPictureContentInfo fContentInfo; | 256 SkPictureContentInfo fContentInfo; |
249 | 257 |
250 SkTArray<SkBitmap> fBitmaps; | 258 // SkTArray<SkBitmap> fBitmaps; |
251 SkTArray<SkPaint> fPaints; | 259 SkTArray<SkPaint> fPaints; |
252 | 260 |
253 struct PathHash { | 261 struct PathHash { |
254 uint32_t operator()(const SkPath& p) { return p.getGenerationID(); } | 262 uint32_t operator()(const SkPath& p) { return p.getGenerationID(); } |
255 }; | 263 }; |
256 SkTHashMap<SkPath, int, PathHash> fPaths; | 264 SkTHashMap<SkPath, int, PathHash> fPaths; |
257 | 265 |
258 SkWriter32 fWriter; | 266 SkWriter32 fWriter; |
259 | 267 |
260 // we ref each item in these arrays | 268 // we ref each item in these arrays |
261 SkTDArray<const SkImage*> fImageRefs; | 269 SkTDArray<const SkImage*> fImageRefs; |
262 SkTDArray<const SkPicture*> fPictureRefs; | 270 SkTDArray<const SkPicture*> fPictureRefs; |
263 SkTDArray<SkDrawable*> fDrawableRefs; | 271 SkTDArray<SkDrawable*> fDrawableRefs; |
264 SkTDArray<const SkTextBlob*> fTextBlobRefs; | 272 SkTDArray<const SkTextBlob*> fTextBlobRefs; |
265 | 273 |
266 uint32_t fRecordFlags; | 274 uint32_t fRecordFlags; |
267 int fInitialSaveCount; | 275 int fInitialSaveCount; |
268 | 276 |
269 friend class SkPictureData; // for SkPictureData's SkPictureRecord-based c
onstructor | 277 friend class SkPictureData; // for SkPictureData's SkPictureRecord-based c
onstructor |
270 | 278 |
271 typedef SkCanvas INHERITED; | 279 typedef SkCanvas INHERITED; |
272 }; | 280 }; |
273 | 281 |
274 #endif | 282 #endif |
OLD | NEW |