| 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 const uint16_t indices[], int indexCount, | 202 const uint16_t indices[], int indexCount, |
| 203 const SkPaint&) override; | 203 const SkPaint&) override; |
| 204 | 204 |
| 205 void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) override; | 205 void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) override; |
| 206 void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) override; | 206 void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) override; |
| 207 void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) override; | 207 void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) override; |
| 208 void onClipRegion(const SkRegion&, SkRegion::Op) override; | 208 void onClipRegion(const SkRegion&, SkRegion::Op) override; |
| 209 | 209 |
| 210 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) overri
de; | 210 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) overri
de; |
| 211 | 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 | |
| 226 #ifdef SK_EXPERIMENTAL_SHADOWING | 212 #ifdef SK_EXPERIMENTAL_SHADOWING |
| 227 void onDrawShadowedPicture(const SkPicture*, | 213 void onDrawShadowedPicture(const SkPicture*, |
| 228 const SkMatrix*, | 214 const SkMatrix*, |
| 229 const SkPaint*) override; | 215 const SkPaint*) override; |
| 230 #else | 216 #else |
| 231 void onDrawShadowedPicture(const SkPicture*, | 217 void onDrawShadowedPicture(const SkPicture*, |
| 232 const SkMatrix*, | 218 const SkMatrix*, |
| 233 const SkPaint*); | 219 const SkPaint*); |
| 234 #endif | 220 #endif |
| 235 | 221 |
| 236 void onDrawDrawable(SkDrawable*, const SkMatrix*) override; | 222 void onDrawDrawable(SkDrawable*, const SkMatrix*) override; |
| 237 void onDrawAnnotation(const SkRect&, const char[], SkData*) override; | 223 void onDrawAnnotation(const SkRect&, const char[], SkData*) override; |
| 238 | 224 |
| 239 int addPathToHeap(const SkPath& path); // does not write to ops stream | 225 int addPathToHeap(const SkPath& path); // does not write to ops stream |
| 240 | 226 |
| 241 // These entry points allow the writing of matrices, clips, saves & | 227 // These entry points allow the writing of matrices, clips, saves & |
| 242 // restores to be deferred (e.g., if the MC state is being collapsed and | 228 // restores to be deferred (e.g., if the MC state is being collapsed and |
| 243 // only written out as needed). | 229 // only written out as needed). |
| 244 void recordConcat(const SkMatrix& matrix); | 230 void recordConcat(const SkMatrix& matrix); |
| 245 void recordTranslate(const SkMatrix& matrix); | 231 void recordTranslate(const SkMatrix& matrix); |
| 246 void recordScale(const SkMatrix& matrix); | 232 void recordScale(const SkMatrix& matrix); |
| 247 size_t recordClipRect(const SkRect& rect, SkRegion::Op op, bool doAA); | 233 size_t recordClipRect(const SkRect& rect, SkRegion::Op op, bool doAA); |
| 248 size_t recordClipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA); | 234 size_t recordClipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA); |
| 249 size_t recordClipPath(int pathID, SkRegion::Op op, bool doAA); | 235 size_t recordClipPath(int pathID, SkRegion::Op op, bool doAA); |
| 250 size_t recordClipRegion(const SkRegion& region, SkRegion::Op op); | 236 size_t recordClipRegion(const SkRegion& region, SkRegion::Op op); |
| 251 void recordSave(); | 237 void recordSave(); |
| 252 void recordSaveLayer(const SaveLayerRec&); | 238 void recordSaveLayer(const SaveLayerRec&); |
| 253 void recordRestore(bool fillInSkips = true); | 239 void recordRestore(bool fillInSkips = true); |
| 254 | 240 |
| 241 // SHOULD NEVER BE CALLED |
| 242 void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPain
t*) override { |
| 243 sk_throw(); |
| 244 } |
| 245 void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst,
const SkPaint*, |
| 246 SrcRectConstraint) override { |
| 247 sk_throw(); |
| 248 } |
| 249 void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect&
dst, |
| 250 const SkPaint*) override { |
| 251 sk_throw(); |
| 252 } |
| 253 |
| 255 private: | 254 private: |
| 256 SkPictureContentInfo fContentInfo; | 255 SkPictureContentInfo fContentInfo; |
| 257 | 256 |
| 258 // SkTArray<SkBitmap> fBitmaps; | |
| 259 SkTArray<SkPaint> fPaints; | 257 SkTArray<SkPaint> fPaints; |
| 260 | 258 |
| 261 struct PathHash { | 259 struct PathHash { |
| 262 uint32_t operator()(const SkPath& p) { return p.getGenerationID(); } | 260 uint32_t operator()(const SkPath& p) { return p.getGenerationID(); } |
| 263 }; | 261 }; |
| 264 SkTHashMap<SkPath, int, PathHash> fPaths; | 262 SkTHashMap<SkPath, int, PathHash> fPaths; |
| 265 | 263 |
| 266 SkWriter32 fWriter; | 264 SkWriter32 fWriter; |
| 267 | 265 |
| 268 // we ref each item in these arrays | 266 // we ref each item in these arrays |
| 269 SkTDArray<const SkImage*> fImageRefs; | 267 SkTDArray<const SkImage*> fImageRefs; |
| 270 SkTDArray<const SkPicture*> fPictureRefs; | 268 SkTDArray<const SkPicture*> fPictureRefs; |
| 271 SkTDArray<SkDrawable*> fDrawableRefs; | 269 SkTDArray<SkDrawable*> fDrawableRefs; |
| 272 SkTDArray<const SkTextBlob*> fTextBlobRefs; | 270 SkTDArray<const SkTextBlob*> fTextBlobRefs; |
| 273 | 271 |
| 274 uint32_t fRecordFlags; | 272 uint32_t fRecordFlags; |
| 275 int fInitialSaveCount; | 273 int fInitialSaveCount; |
| 276 | 274 |
| 277 friend class SkPictureData; // for SkPictureData's SkPictureRecord-based c
onstructor | 275 friend class SkPictureData; // for SkPictureData's SkPictureRecord-based c
onstructor |
| 278 | 276 |
| 279 typedef SkCanvas INHERITED; | 277 typedef SkCanvas INHERITED; |
| 280 }; | 278 }; |
| 281 | 279 |
| 282 #endif | 280 #endif |
| OLD | NEW |