| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 const SkPaint*) SK_OVERRIDE; | 48 const SkPaint*) SK_OVERRIDE; |
| 49 virtual void drawBitmapRectToRect(const SkBitmap&, const SkRect* src, | 49 virtual void drawBitmapRectToRect(const SkBitmap&, const SkRect* src, |
| 50 const SkRect& dst, const SkPaint* paint, | 50 const SkRect& dst, const SkPaint* paint, |
| 51 DrawBitmapRectFlags flags) SK_OVERRIDE; | 51 DrawBitmapRectFlags flags) SK_OVERRIDE; |
| 52 virtual void drawBitmapMatrix(const SkBitmap&, const SkMatrix&, | 52 virtual void drawBitmapMatrix(const SkBitmap&, const SkMatrix&, |
| 53 const SkPaint*) SK_OVERRIDE; | 53 const SkPaint*) SK_OVERRIDE; |
| 54 virtual void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, | 54 virtual void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, |
| 55 const SkRect& dst, const SkPaint*) SK_OVERRIDE; | 55 const SkRect& dst, const SkPaint*) SK_OVERRIDE; |
| 56 virtual void drawSprite(const SkBitmap&, int left, int top, | 56 virtual void drawSprite(const SkBitmap&, int left, int top, |
| 57 const SkPaint*) SK_OVERRIDE; | 57 const SkPaint*) SK_OVERRIDE; |
| 58 virtual void drawPicture(SkPicture& picture) SK_OVERRIDE; | |
| 59 virtual void drawVertices(VertexMode, int vertexCount, | 58 virtual void drawVertices(VertexMode, int vertexCount, |
| 60 const SkPoint vertices[], const SkPoint texs[], | 59 const SkPoint vertices[], const SkPoint texs[], |
| 61 const SkColor colors[], SkXfermode*, | 60 const SkColor colors[], SkXfermode*, |
| 62 const uint16_t indices[], int indexCount, | 61 const uint16_t indices[], int indexCount, |
| 63 const SkPaint&) SK_OVERRIDE; | 62 const SkPaint&) SK_OVERRIDE; |
| 64 virtual void drawData(const void*, size_t) SK_OVERRIDE; | 63 virtual void drawData(const void*, size_t) SK_OVERRIDE; |
| 65 virtual void beginCommentGroup(const char* description) SK_OVERRIDE; | 64 virtual void beginCommentGroup(const char* description) SK_OVERRIDE; |
| 66 virtual void addComment(const char* kywd, const char* value) SK_OVERRIDE; | 65 virtual void addComment(const char* kywd, const char* value) SK_OVERRIDE; |
| 67 virtual void endCommentGroup() SK_OVERRIDE; | 66 virtual void endCommentGroup() SK_OVERRIDE; |
| 68 virtual bool isDrawingToLayer() const SK_OVERRIDE; | 67 virtual bool isDrawingToLayer() const SK_OVERRIDE; |
| 69 | 68 |
| 70 void addFontMetricsTopBottom(const SkPaint& paint, const SkFlatData&, | 69 void addFontMetricsTopBottom(const SkPaint& paint, const SkFlatData&, |
| 71 SkScalar minY, SkScalar maxY); | 70 SkScalar minY, SkScalar maxY); |
| 72 | 71 |
| 73 const SkTDArray<SkPicture* >& getPictureRefs() const { | 72 const SkTDArray<const SkPicture* >& getPictureRefs() const { |
| 74 return fPictureRefs; | 73 return fPictureRefs; |
| 75 } | 74 } |
| 76 | 75 |
| 77 void setFlags(uint32_t recordFlags) { | 76 void setFlags(uint32_t recordFlags) { |
| 78 fRecordFlags = recordFlags; | 77 fRecordFlags = recordFlags; |
| 79 } | 78 } |
| 80 | 79 |
| 81 const SkWriter32& writeStream() const { | 80 const SkWriter32& writeStream() const { |
| 82 return fWriter; | 81 return fWriter; |
| 83 } | 82 } |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 fWriter.writeScalar(scalar); | 148 fWriter.writeScalar(scalar); |
| 150 } | 149 } |
| 151 | 150 |
| 152 // The command at 'offset' in the skp uses the specified bitmap | 151 // The command at 'offset' in the skp uses the specified bitmap |
| 153 int addBitmap(const SkBitmap& bitmap); | 152 int addBitmap(const SkBitmap& bitmap); |
| 154 void addMatrix(const SkMatrix& matrix); | 153 void addMatrix(const SkMatrix& matrix); |
| 155 const SkFlatData* addPaint(const SkPaint& paint) { return this->addPaintPtr(
&paint); } | 154 const SkFlatData* addPaint(const SkPaint& paint) { return this->addPaintPtr(
&paint); } |
| 156 const SkFlatData* addPaintPtr(const SkPaint* paint); | 155 const SkFlatData* addPaintPtr(const SkPaint* paint); |
| 157 void addFlatPaint(const SkFlatData* flatPaint); | 156 void addFlatPaint(const SkFlatData* flatPaint); |
| 158 void addPath(const SkPath& path); | 157 void addPath(const SkPath& path); |
| 159 void addPicture(SkPicture& picture); | 158 void addPicture(const SkPicture* picture); |
| 160 void addPoint(const SkPoint& point); | 159 void addPoint(const SkPoint& point); |
| 161 void addPoints(const SkPoint pts[], int count); | 160 void addPoints(const SkPoint pts[], int count); |
| 162 void addRect(const SkRect& rect); | 161 void addRect(const SkRect& rect); |
| 163 void addRectPtr(const SkRect* rect); | 162 void addRectPtr(const SkRect* rect); |
| 164 void addIRect(const SkIRect& rect); | 163 void addIRect(const SkIRect& rect); |
| 165 void addIRectPtr(const SkIRect* rect); | 164 void addIRectPtr(const SkIRect* rect); |
| 166 void addRRect(const SkRRect&); | 165 void addRRect(const SkRRect&); |
| 167 void addRegion(const SkRegion& region); | 166 void addRegion(const SkRegion& region); |
| 168 void addText(const void* text, size_t byteLength); | 167 void addText(const void* text, size_t byteLength); |
| 169 | 168 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 virtual void onDrawPosTextH(const void* text, size_t byteLength, const SkSca
lar xpos[], | 228 virtual void onDrawPosTextH(const void* text, size_t byteLength, const SkSca
lar xpos[], |
| 230 SkScalar constY, const SkPaint&) SK_OVERRIDE; | 229 SkScalar constY, const SkPaint&) SK_OVERRIDE; |
| 231 virtual void onDrawTextOnPath(const void* text, size_t byteLength, const SkP
ath& path, | 230 virtual void onDrawTextOnPath(const void* text, size_t byteLength, const SkP
ath& path, |
| 232 const SkMatrix* matrix, const SkPaint&) SK_OVE
RRIDE; | 231 const SkMatrix* matrix, const SkPaint&) SK_OVE
RRIDE; |
| 233 | 232 |
| 234 virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERR
IDE; | 233 virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERR
IDE; |
| 235 virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVE
RRIDE; | 234 virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVE
RRIDE; |
| 236 virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERR
IDE; | 235 virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERR
IDE; |
| 237 virtual void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE; | 236 virtual void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE; |
| 238 | 237 |
| 238 virtual void onDrawPicture(const SkPicture* picture) SK_OVERRIDE; |
| 239 |
| 239 // Return fontmetrics.fTop,fBottom in topbot[0,1], after they have been | 240 // Return fontmetrics.fTop,fBottom in topbot[0,1], after they have been |
| 240 // tweaked by paint.computeFastBounds(). | 241 // tweaked by paint.computeFastBounds(). |
| 241 static void ComputeFontMetricsTopBottom(const SkPaint& paint, SkScalar topbo
t[2]); | 242 static void ComputeFontMetricsTopBottom(const SkPaint& paint, SkScalar topbo
t[2]); |
| 242 | 243 |
| 243 // Make sure that flat has fTopBot written. | 244 // Make sure that flat has fTopBot written. |
| 244 static void WriteTopBot(const SkPaint& paint, const SkFlatData& flat) { | 245 static void WriteTopBot(const SkPaint& paint, const SkFlatData& flat) { |
| 245 if (!flat.isTopBotWritten()) { | 246 if (!flat.isTopBotWritten()) { |
| 246 ComputeFontMetricsTopBottom(paint, flat.writableTopBot()); | 247 ComputeFontMetricsTopBottom(paint, flat.writableTopBot()); |
| 247 SkASSERT(flat.isTopBotWritten()); | 248 SkASSERT(flat.isTopBotWritten()); |
| 248 } | 249 } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 friend class MatrixClipState; // for access to *Impl methods | 289 friend class MatrixClipState; // for access to *Impl methods |
| 289 friend class SkMatrixClipStateMgr; // for access to *Impl methods | 290 friend class SkMatrixClipStateMgr; // for access to *Impl methods |
| 290 | 291 |
| 291 SkChunkFlatController fFlattenableHeap; | 292 SkChunkFlatController fFlattenableHeap; |
| 292 | 293 |
| 293 SkPaintDictionary fPaints; | 294 SkPaintDictionary fPaints; |
| 294 | 295 |
| 295 SkWriter32 fWriter; | 296 SkWriter32 fWriter; |
| 296 | 297 |
| 297 // we ref each item in these arrays | 298 // we ref each item in these arrays |
| 298 SkTDArray<SkPicture*> fPictureRefs; | 299 SkTDArray<const SkPicture*> fPictureRefs; |
| 299 | 300 |
| 300 uint32_t fRecordFlags; | 301 uint32_t fRecordFlags; |
| 301 bool fOptsEnabled; | 302 bool fOptsEnabled; |
| 302 int fInitialSaveCount; | 303 int fInitialSaveCount; |
| 303 | 304 |
| 304 friend class SkPicturePlayback; | 305 friend class SkPicturePlayback; |
| 305 friend class SkPictureTester; // for unit testing | 306 friend class SkPictureTester; // for unit testing |
| 306 | 307 |
| 307 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE | 308 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
| 308 SkMatrixClipStateMgr fMCMgr; | 309 SkMatrixClipStateMgr fMCMgr; |
| 309 #endif | 310 #endif |
| 310 | 311 |
| 311 typedef SkCanvas INHERITED; | 312 typedef SkCanvas INHERITED; |
| 312 }; | 313 }; |
| 313 | 314 |
| 314 #endif | 315 #endif |
| OLD | NEW |