epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 1 | |
| 2 | /* |
| 3 | * Copyright 2011 Google Inc. |
| 4 | * |
| 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
| 7 | */ |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 8 | #ifndef SkPictureRecord_DEFINED |
| 9 | #define SkPictureRecord_DEFINED |
| 10 | |
| 11 | #include "SkCanvas.h" |
| 12 | #include "SkFlattenable.h" |
| 13 | #include "SkPathHeap.h" |
| 14 | #include "SkPicture.h" |
| 15 | #include "SkPictureFlat.h" |
| 16 | #include "SkTemplates.h" |
| 17 | #include "SkWriter32.h" |
| 18 | |
rileya@google.com | 9f5898d | 2012-09-11 20:21:44 +0000 | [diff] [blame] | 19 | class SkPictureStateTree; |
| 20 | class SkBBoxHierarchy; |
| 21 | |
robertphillips@google.com | 2ca1aaa | 2013-02-15 13:47:37 +0000 | [diff] [blame] | 22 | // These macros help with packing and unpacking a single byte value and |
| 23 | // a 3 byte value into/out of a uint32_t |
| 24 | #define MASK_24 0x00FFFFFF |
| 25 | #define UNPACK_8_24(combined, small, large) \ |
| 26 | small = (combined >> 24) & 0xFF; \ |
| 27 | large = combined & MASK_24; |
| 28 | #define PACK_8_24(small, large) ((small << 24) | large) |
| 29 | |
| 30 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 31 | class SkPictureRecord : public SkCanvas { |
| 32 | public: |
robertphillips@google.com | 1f2f338 | 2013-08-29 11:54:56 +0000 | [diff] [blame] | 33 | SkPictureRecord(uint32_t recordFlags, SkBaseDevice*); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 34 | virtual ~SkPictureRecord(); |
| 35 | |
robertphillips@google.com | 1f2f338 | 2013-08-29 11:54:56 +0000 | [diff] [blame] | 36 | virtual SkBaseDevice* setDevice(SkBaseDevice* device) SK_OVERRIDE; |
junov@chromium.org | 4e6dfa5 | 2012-07-16 14:04:59 +0000 | [diff] [blame] | 37 | |
reed@google.com | 2d4297c | 2011-10-06 13:14:12 +0000 | [diff] [blame] | 38 | virtual int save(SaveFlags) SK_OVERRIDE; |
| 39 | virtual int saveLayer(const SkRect* bounds, const SkPaint*, SaveFlags) SK_OVERRIDE; |
| 40 | virtual void restore() SK_OVERRIDE; |
| 41 | virtual bool translate(SkScalar dx, SkScalar dy) SK_OVERRIDE; |
| 42 | virtual bool scale(SkScalar sx, SkScalar sy) SK_OVERRIDE; |
| 43 | virtual bool rotate(SkScalar degrees) SK_OVERRIDE; |
| 44 | virtual bool skew(SkScalar sx, SkScalar sy) SK_OVERRIDE; |
| 45 | virtual bool concat(const SkMatrix& matrix) SK_OVERRIDE; |
| 46 | virtual void setMatrix(const SkMatrix& matrix) SK_OVERRIDE; |
reed@google.com | 071eef9 | 2011-10-12 11:52:53 +0000 | [diff] [blame] | 47 | virtual bool clipRect(const SkRect&, SkRegion::Op, bool) SK_OVERRIDE; |
reed@google.com | 4ed0fb7 | 2012-12-12 20:48:18 +0000 | [diff] [blame] | 48 | virtual bool clipRRect(const SkRRect&, SkRegion::Op, bool) SK_OVERRIDE; |
reed@google.com | 071eef9 | 2011-10-12 11:52:53 +0000 | [diff] [blame] | 49 | virtual bool clipPath(const SkPath&, SkRegion::Op, bool) SK_OVERRIDE; |
reed@google.com | 2d4297c | 2011-10-06 13:14:12 +0000 | [diff] [blame] | 50 | virtual bool clipRegion(const SkRegion& region, SkRegion::Op op) SK_OVERRIDE; |
| 51 | virtual void clear(SkColor) SK_OVERRIDE; |
| 52 | virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 53 | virtual void drawPoints(PointMode, size_t count, const SkPoint pts[], |
reed@google.com | 2d4297c | 2011-10-06 13:14:12 +0000 | [diff] [blame] | 54 | const SkPaint&) SK_OVERRIDE; |
reed@google.com | 4ed0fb7 | 2012-12-12 20:48:18 +0000 | [diff] [blame] | 55 | virtual void drawOval(const SkRect&, const SkPaint&) SK_OVERRIDE; |
bsalomon@google.com | 7ce564c | 2013-10-22 16:54:15 +0000 | [diff] [blame] | 56 | virtual void drawRect(const SkRect&, const SkPaint&) SK_OVERRIDE; |
reed@google.com | 4ed0fb7 | 2012-12-12 20:48:18 +0000 | [diff] [blame] | 57 | virtual void drawRRect(const SkRRect&, const SkPaint&) SK_OVERRIDE; |
bsalomon@google.com | 7ce564c | 2013-10-22 16:54:15 +0000 | [diff] [blame] | 58 | virtual void drawPath(const SkPath& path, const SkPaint&) SK_OVERRIDE; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 59 | virtual void drawBitmap(const SkBitmap&, SkScalar left, SkScalar top, |
reed@google.com | 2d4297c | 2011-10-06 13:14:12 +0000 | [diff] [blame] | 60 | const SkPaint*) SK_OVERRIDE; |
reed@google.com | 7112173 | 2012-09-18 15:14:33 +0000 | [diff] [blame] | 61 | virtual void drawBitmapRectToRect(const SkBitmap&, const SkRect* src, |
skia.committer@gmail.com | 7475811 | 2013-08-17 07:01:54 +0000 | [diff] [blame] | 62 | const SkRect& dst, const SkPaint* paint, |
commit-bot@chromium.org | eed779d | 2013-08-16 10:24:37 +0000 | [diff] [blame] | 63 | DrawBitmapRectFlags flags) SK_OVERRIDE; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 64 | virtual void drawBitmapMatrix(const SkBitmap&, const SkMatrix&, |
reed@google.com | 2d4297c | 2011-10-06 13:14:12 +0000 | [diff] [blame] | 65 | const SkPaint*) SK_OVERRIDE; |
reed@google.com | f0b5e11 | 2011-09-07 11:57:34 +0000 | [diff] [blame] | 66 | virtual void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, |
reed@google.com | 2d4297c | 2011-10-06 13:14:12 +0000 | [diff] [blame] | 67 | const SkRect& dst, const SkPaint*) SK_OVERRIDE; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 68 | virtual void drawSprite(const SkBitmap&, int left, int top, |
reed@google.com | 2d4297c | 2011-10-06 13:14:12 +0000 | [diff] [blame] | 69 | const SkPaint*) SK_OVERRIDE; |
vandebo@chromium.org | 74b4619 | 2012-01-28 01:45:11 +0000 | [diff] [blame] | 70 | virtual void drawText(const void* text, size_t byteLength, SkScalar x, |
reed@google.com | 2d4297c | 2011-10-06 13:14:12 +0000 | [diff] [blame] | 71 | SkScalar y, const SkPaint&) SK_OVERRIDE; |
vandebo@chromium.org | 74b4619 | 2012-01-28 01:45:11 +0000 | [diff] [blame] | 72 | virtual void drawPosText(const void* text, size_t byteLength, |
reed@google.com | 2d4297c | 2011-10-06 13:14:12 +0000 | [diff] [blame] | 73 | const SkPoint pos[], const SkPaint&) SK_OVERRIDE; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 74 | virtual void drawPosTextH(const void* text, size_t byteLength, |
reed@google.com | 2d4297c | 2011-10-06 13:14:12 +0000 | [diff] [blame] | 75 | const SkScalar xpos[], SkScalar constY, const SkPaint&) SK_OVERRIDE; |
vandebo@chromium.org | 74b4619 | 2012-01-28 01:45:11 +0000 | [diff] [blame] | 76 | virtual void drawTextOnPath(const void* text, size_t byteLength, |
| 77 | const SkPath& path, const SkMatrix* matrix, |
reed@google.com | 2d4297c | 2011-10-06 13:14:12 +0000 | [diff] [blame] | 78 | const SkPaint&) SK_OVERRIDE; |
| 79 | virtual void drawPicture(SkPicture& picture) SK_OVERRIDE; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 80 | virtual void drawVertices(VertexMode, int vertexCount, |
| 81 | const SkPoint vertices[], const SkPoint texs[], |
| 82 | const SkColor colors[], SkXfermode*, |
| 83 | const uint16_t indices[], int indexCount, |
reed@google.com | 2d4297c | 2011-10-06 13:14:12 +0000 | [diff] [blame] | 84 | const SkPaint&) SK_OVERRIDE; |
| 85 | virtual void drawData(const void*, size_t) SK_OVERRIDE; |
robertphillips@google.com | 0a4805e | 2013-05-29 13:24:23 +0000 | [diff] [blame] | 86 | virtual void beginCommentGroup(const char* description) SK_OVERRIDE; |
| 87 | virtual void addComment(const char* kywd, const char* value) SK_OVERRIDE; |
| 88 | virtual void endCommentGroup() SK_OVERRIDE; |
junov@chromium.org | 8f9ecbd | 2012-02-13 21:53:45 +0000 | [diff] [blame] | 89 | virtual bool isDrawingToLayer() const SK_OVERRIDE; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 90 | |
junov@chromium.org | 3f5ecd6 | 2013-01-22 18:01:26 +0000 | [diff] [blame] | 91 | void addFontMetricsTopBottom(const SkPaint& paint, const SkFlatData&, |
reed@google.com | 4595426 | 2012-12-07 17:14:40 +0000 | [diff] [blame] | 92 | SkScalar minY, SkScalar maxY); |
vandebo@chromium.org | 74b4619 | 2012-01-28 01:45:11 +0000 | [diff] [blame] | 93 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 94 | const SkTDArray<SkPicture* >& getPictureRefs() const { |
| 95 | return fPictureRefs; |
| 96 | } |
vandebo@chromium.org | 74b4619 | 2012-01-28 01:45:11 +0000 | [diff] [blame] | 97 | |
junov@chromium.org | 4866cc0 | 2012-06-01 21:23:07 +0000 | [diff] [blame] | 98 | void setFlags(uint32_t recordFlags) { |
| 99 | fRecordFlags = recordFlags; |
| 100 | } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 101 | |
| 102 | const SkWriter32& writeStream() const { |
| 103 | return fWriter; |
| 104 | } |
| 105 | |
reed@google.com | d86e7ab | 2012-09-27 20:31:31 +0000 | [diff] [blame] | 106 | void beginRecording(); |
junov@chromium.org | a6c9e0e | 2012-07-12 17:47:34 +0000 | [diff] [blame] | 107 | void endRecording(); |
reed@google.com | d86e7ab | 2012-09-27 20:31:31 +0000 | [diff] [blame] | 108 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 109 | private: |
commit-bot@chromium.org | 4b32bd5 | 2013-03-15 15:06:03 +0000 | [diff] [blame] | 110 | void handleOptimization(int opt); |
robertphillips@google.com | 5a63f24 | 2014-02-04 20:07:50 +0000 | [diff] [blame] | 111 | int recordRestoreOffsetPlaceholder(SkRegion::Op); |
| 112 | void fillRestoreOffsetPlaceholdersForCurrentStackLevel(uint32_t restoreOffset); |
junov@chromium.org | e3dbedb | 2012-07-09 16:03:55 +0000 | [diff] [blame] | 113 | |
reed@google.com | ffacd3c | 2012-08-30 15:31:23 +0000 | [diff] [blame] | 114 | SkTDArray<int32_t> fRestoreOffsetStack; |
junov@chromium.org | 8f9ecbd | 2012-02-13 21:53:45 +0000 | [diff] [blame] | 115 | int fFirstSavedLayerIndex; |
| 116 | enum { |
| 117 | kNoSavedLayerIndex = -1 |
| 118 | }; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 119 | |
robertphillips@google.com | 2ca1aaa | 2013-02-15 13:47:37 +0000 | [diff] [blame] | 120 | /* |
| 121 | * Write the 'drawType' operation and chunk size to the skp. 'size' |
skia.committer@gmail.com | ce8343d | 2013-02-16 07:01:31 +0000 | [diff] [blame] | 122 | * can potentially be increased if the chunk size needs its own storage |
robertphillips@google.com | 2ca1aaa | 2013-02-15 13:47:37 +0000 | [diff] [blame] | 123 | * location (i.e., it overflows 24 bits). |
| 124 | * Returns the start offset of the chunk. This is the location at which |
| 125 | * the opcode & size are stored. |
skia.committer@gmail.com | ce8343d | 2013-02-16 07:01:31 +0000 | [diff] [blame] | 126 | * TODO: since we are handing the size into here we could call reserve |
robertphillips@google.com | 2ca1aaa | 2013-02-15 13:47:37 +0000 | [diff] [blame] | 127 | * and then return a pointer to the memory storage. This could decrease |
| 128 | * allocation overhead but could lead to more wasted space (the tail |
| 129 | * end of blocks could go unused). Possibly add a second addDraw that |
| 130 | * operates in this manner. |
| 131 | */ |
robertphillips@google.com | 8b16931 | 2013-10-15 17:47:36 +0000 | [diff] [blame] | 132 | size_t addDraw(DrawType drawType, uint32_t* size) { |
reed@google.com | 4469938 | 2013-10-31 17:28:30 +0000 | [diff] [blame] | 133 | size_t offset = fWriter.bytesWritten(); |
robertphillips@google.com | 2ca1aaa | 2013-02-15 13:47:37 +0000 | [diff] [blame] | 134 | |
reed@google.com | 97af1a6 | 2012-08-28 12:19:02 +0000 | [diff] [blame] | 135 | this->predrawNotify(); |
| 136 | |
robertphillips@google.com | 2ca1aaa | 2013-02-15 13:47:37 +0000 | [diff] [blame] | 137 | #ifdef SK_DEBUG_TRACE |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 138 | SkDebugf("add %s\n", DrawTypeToString(drawType)); |
robertphillips@google.com | 2ca1aaa | 2013-02-15 13:47:37 +0000 | [diff] [blame] | 139 | #endif |
| 140 | |
| 141 | SkASSERT(0 != *size); |
| 142 | SkASSERT(((uint8_t) drawType) == drawType); |
| 143 | |
| 144 | if (0 != (*size & ~MASK_24) || *size == MASK_24) { |
| 145 | fWriter.writeInt(PACK_8_24(drawType, MASK_24)); |
| 146 | *size += 1; |
| 147 | fWriter.writeInt(*size); |
| 148 | } else { |
| 149 | fWriter.writeInt(PACK_8_24(drawType, *size)); |
| 150 | } |
| 151 | |
| 152 | return offset; |
vandebo@chromium.org | 74b4619 | 2012-01-28 01:45:11 +0000 | [diff] [blame] | 153 | } |
robertphillips@google.com | 2ca1aaa | 2013-02-15 13:47:37 +0000 | [diff] [blame] | 154 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 155 | void addInt(int value) { |
| 156 | fWriter.writeInt(value); |
| 157 | } |
| 158 | void addScalar(SkScalar scalar) { |
| 159 | fWriter.writeScalar(scalar); |
| 160 | } |
vandebo@chromium.org | 74b4619 | 2012-01-28 01:45:11 +0000 | [diff] [blame] | 161 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 162 | void addBitmap(const SkBitmap& bitmap); |
| 163 | void addMatrix(const SkMatrix& matrix); |
junov@chromium.org | f3b1223 | 2013-01-22 17:50:47 +0000 | [diff] [blame] | 164 | const SkFlatData* addPaint(const SkPaint& paint) { return this->addPaintPtr(&paint); } |
| 165 | const SkFlatData* addPaintPtr(const SkPaint* paint); |
commit-bot@chromium.org | cf7be95 | 2013-08-22 17:19:52 +0000 | [diff] [blame] | 166 | void addFlatPaint(const SkFlatData* flatPaint); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 167 | void addPath(const SkPath& path); |
| 168 | void addPicture(SkPicture& picture); |
| 169 | void addPoint(const SkPoint& point); |
| 170 | void addPoints(const SkPoint pts[], int count); |
| 171 | void addRect(const SkRect& rect); |
| 172 | void addRectPtr(const SkRect* rect); |
reed@google.com | f0b5e11 | 2011-09-07 11:57:34 +0000 | [diff] [blame] | 173 | void addIRect(const SkIRect& rect); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 174 | void addIRectPtr(const SkIRect* rect); |
reed@google.com | 4ed0fb7 | 2012-12-12 20:48:18 +0000 | [diff] [blame] | 175 | void addRRect(const SkRRect&); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 176 | void addRegion(const SkRegion& region); |
| 177 | void addText(const void* text, size_t byteLength); |
| 178 | |
junov@chromium.org | 4866cc0 | 2012-06-01 21:23:07 +0000 | [diff] [blame] | 179 | int find(const SkBitmap& bitmap); |
| 180 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 181 | #ifdef SK_DEBUG_DUMP |
| 182 | public: |
| 183 | void dumpMatrices(); |
| 184 | void dumpPaints(); |
| 185 | #endif |
| 186 | |
| 187 | #ifdef SK_DEBUG_SIZE |
| 188 | public: |
vandebo@chromium.org | 74b4619 | 2012-01-28 01:45:11 +0000 | [diff] [blame] | 189 | size_t size() const; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 190 | int bitmaps(size_t* size) const; |
| 191 | int matrices(size_t* size) const; |
| 192 | int paints(size_t* size) const; |
| 193 | int paths(size_t* size) const; |
| 194 | int regions(size_t* size) const; |
| 195 | size_t streamlen() const; |
vandebo@chromium.org | 74b4619 | 2012-01-28 01:45:11 +0000 | [diff] [blame] | 196 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 197 | size_t fPointBytes, fRectBytes, fTextBytes; |
| 198 | int fPointWrites, fRectWrites, fTextWrites; |
| 199 | #endif |
| 200 | |
| 201 | #ifdef SK_DEBUG_VALIDATE |
| 202 | public: |
robertphillips@google.com | 8b16931 | 2013-10-15 17:47:36 +0000 | [diff] [blame] | 203 | void validate(size_t initialOffset, uint32_t size) const; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 204 | private: |
| 205 | void validateBitmaps() const; |
| 206 | void validateMatrices() const; |
| 207 | void validatePaints() const; |
| 208 | void validatePaths() const; |
| 209 | void validateRegions() const; |
| 210 | #else |
| 211 | public: |
robertphillips@google.com | 8b16931 | 2013-10-15 17:47:36 +0000 | [diff] [blame] | 212 | void validate(size_t initialOffset, uint32_t size) const { |
reed@google.com | 4469938 | 2013-10-31 17:28:30 +0000 | [diff] [blame] | 213 | SkASSERT(fWriter.bytesWritten() == initialOffset + size); |
robertphillips@google.com | 2ca1aaa | 2013-02-15 13:47:37 +0000 | [diff] [blame] | 214 | } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 215 | #endif |
| 216 | |
rileya@google.com | 9f5898d | 2012-09-11 20:21:44 +0000 | [diff] [blame] | 217 | protected: |
commit-bot@chromium.org | cf7be95 | 2013-08-22 17:19:52 +0000 | [diff] [blame] | 218 | // Return fontmetrics.fTop,fBottom in topbot[0,1], after they have been |
| 219 | // tweaked by paint.computeFastBounds(). |
| 220 | static void ComputeFontMetricsTopBottom(const SkPaint& paint, SkScalar topbot[2]); |
| 221 | |
| 222 | // Make sure that flat has fTopBot written. |
| 223 | static void WriteTopBot(const SkPaint& paint, const SkFlatData& flat) { |
| 224 | if (!flat.isTopBotWritten()) { |
| 225 | ComputeFontMetricsTopBottom(paint, flat.writableTopBot()); |
| 226 | SkASSERT(flat.isTopBotWritten()); |
| 227 | } |
| 228 | } |
| 229 | // Will return a cached version when possible. |
| 230 | const SkFlatData* getFlatPaintData(const SkPaint& paint); |
| 231 | /** |
| 232 | * SkBBoxRecord::drawPosTextH gets a flat paint and uses it, |
| 233 | * then it calls this, using the extra parameter, to avoid duplication. |
| 234 | */ |
| 235 | void drawPosTextHImpl(const void* text, size_t byteLength, |
| 236 | const SkScalar xpos[], SkScalar constY, |
| 237 | const SkPaint& paint, const SkFlatData* flatPaintData); |
rileya@google.com | 9f5898d | 2012-09-11 20:21:44 +0000 | [diff] [blame] | 238 | |
robertphillips@google.com | 5a63f24 | 2014-02-04 20:07:50 +0000 | [diff] [blame] | 239 | int addPathToHeap(const SkPath& path); // does not write to ops stream |
| 240 | |
skia.committer@gmail.com | 1dab403 | 2014-02-05 03:01:48 +0000 | [diff] [blame^] | 241 | // These entry points allow the writing of matrices, clips, saves & |
robertphillips@google.com | 5a63f24 | 2014-02-04 20:07:50 +0000 | [diff] [blame] | 242 | // restores to be deferred (e.g., if the MC state is being collapsed and |
| 243 | // only written out as needed). |
| 244 | void recordConcat(const SkMatrix& matrix); |
| 245 | int recordClipRect(const SkRect& rect, SkRegion::Op op, bool doAA); |
| 246 | int recordClipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA); |
| 247 | int recordClipPath(int pathID, SkRegion::Op op, bool doAA); |
| 248 | int recordClipRegion(const SkRegion& region, SkRegion::Op op); |
| 249 | void recordSave(SaveFlags flags); |
| 250 | void recordSaveLayer(const SkRect* bounds, const SkPaint* paint, SaveFlags flags); |
| 251 | void recordRestore(); |
| 252 | |
rileya@google.com | 9f5898d | 2012-09-11 20:21:44 +0000 | [diff] [blame] | 253 | // These are set to NULL in our constructor, but may be changed by |
| 254 | // subclasses, in which case they will be SkSafeUnref'd in our destructor. |
| 255 | SkBBoxHierarchy* fBoundingHierarchy; |
| 256 | SkPictureStateTree* fStateTree; |
| 257 | |
robertphillips@google.com | 801cee1 | 2012-10-19 19:06:11 +0000 | [diff] [blame] | 258 | // Allocated in the constructor and managed by this class. |
djsollen@google.com | c9ab987 | 2012-08-29 18:52:07 +0000 | [diff] [blame] | 259 | SkBitmapHeap* fBitmapHeap; |
robertphillips@google.com | 801cee1 | 2012-10-19 19:06:11 +0000 | [diff] [blame] | 260 | |
| 261 | private: |
djsollen@google.com | 21830d9 | 2012-08-07 19:49:41 +0000 | [diff] [blame] | 262 | SkChunkFlatController fFlattenableHeap; |
junov@chromium.org | 4866cc0 | 2012-06-01 21:23:07 +0000 | [diff] [blame] | 263 | |
djsollen@google.com | d2700ee | 2012-05-30 16:54:13 +0000 | [diff] [blame] | 264 | SkPaintDictionary fPaints; |
djsollen@google.com | d2700ee | 2012-05-30 16:54:13 +0000 | [diff] [blame] | 265 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 266 | SkPathHeap* fPathHeap; // reference counted |
| 267 | SkWriter32 fWriter; |
| 268 | |
reed@android.com | 09b84a0 | 2009-06-26 20:22:26 +0000 | [diff] [blame] | 269 | // we ref each item in these arrays |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 270 | SkTDArray<SkPicture*> fPictureRefs; |
| 271 | |
reed@android.com | ae814c8 | 2009-02-13 14:56:09 +0000 | [diff] [blame] | 272 | uint32_t fRecordFlags; |
junov@chromium.org | 4e6dfa5 | 2012-07-16 14:04:59 +0000 | [diff] [blame] | 273 | int fInitialSaveCount; |
reed@android.com | ae814c8 | 2009-02-13 14:56:09 +0000 | [diff] [blame] | 274 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 275 | friend class SkPicturePlayback; |
junov@chromium.org | 1cc8f6f | 2012-02-22 21:00:42 +0000 | [diff] [blame] | 276 | friend class SkPictureTester; // for unit testing |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 277 | |
| 278 | typedef SkCanvas INHERITED; |
| 279 | }; |
| 280 | |
| 281 | #endif |