epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2011 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
reed@google.com | 76f10a3 | 2014-02-05 15:32:21 +0000 | [diff] [blame] | 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" |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 13 | #include "SkPicture.h" |
robertphillips | db53990 | 2014-07-01 08:47:04 -0700 | [diff] [blame] | 14 | #include "SkPictureData.h" |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 15 | #include "SkTemplates.h" |
| 16 | #include "SkWriter32.h" |
| 17 | |
robertphillips@google.com | 2ca1aaa | 2013-02-15 13:47:37 +0000 | [diff] [blame] | 18 | // These macros help with packing and unpacking a single byte value and |
| 19 | // a 3 byte value into/out of a uint32_t |
| 20 | #define MASK_24 0x00FFFFFF |
| 21 | #define UNPACK_8_24(combined, small, large) \ |
| 22 | small = (combined >> 24) & 0xFF; \ |
| 23 | large = combined & MASK_24; |
| 24 | #define PACK_8_24(small, large) ((small << 24) | large) |
| 25 | |
| 26 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 27 | class SkPictureRecord : public SkCanvas { |
| 28 | public: |
robertphillips | 0bdbea7 | 2014-06-11 11:37:55 -0700 | [diff] [blame] | 29 | SkPictureRecord(const SkISize& dimensions, uint32_t recordFlags); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 30 | virtual ~SkPictureRecord(); |
| 31 | |
reed@google.com | 2d4297c | 2011-10-06 13:14:12 +0000 | [diff] [blame] | 32 | virtual void clear(SkColor) SK_OVERRIDE; |
| 33 | virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 34 | virtual void drawPoints(PointMode, size_t count, const SkPoint pts[], |
reed@google.com | 2d4297c | 2011-10-06 13:14:12 +0000 | [diff] [blame] | 35 | const SkPaint&) SK_OVERRIDE; |
reed@google.com | 4ed0fb7 | 2012-12-12 20:48:18 +0000 | [diff] [blame] | 36 | virtual void drawOval(const SkRect&, const SkPaint&) SK_OVERRIDE; |
bsalomon@google.com | 7ce564c | 2013-10-22 16:54:15 +0000 | [diff] [blame] | 37 | virtual void drawRect(const SkRect&, const SkPaint&) SK_OVERRIDE; |
reed@google.com | 4ed0fb7 | 2012-12-12 20:48:18 +0000 | [diff] [blame] | 38 | virtual void drawRRect(const SkRRect&, const SkPaint&) SK_OVERRIDE; |
bsalomon@google.com | 7ce564c | 2013-10-22 16:54:15 +0000 | [diff] [blame] | 39 | virtual void drawPath(const SkPath& path, const SkPaint&) SK_OVERRIDE; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 40 | virtual void drawBitmap(const SkBitmap&, SkScalar left, SkScalar top, |
reed@google.com | 2d4297c | 2011-10-06 13:14:12 +0000 | [diff] [blame] | 41 | const SkPaint*) SK_OVERRIDE; |
reed@google.com | 7112173 | 2012-09-18 15:14:33 +0000 | [diff] [blame] | 42 | virtual void drawBitmapRectToRect(const SkBitmap&, const SkRect* src, |
skia.committer@gmail.com | 7475811 | 2013-08-17 07:01:54 +0000 | [diff] [blame] | 43 | const SkRect& dst, const SkPaint* paint, |
commit-bot@chromium.org | eed779d | 2013-08-16 10:24:37 +0000 | [diff] [blame] | 44 | DrawBitmapRectFlags flags) SK_OVERRIDE; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 45 | virtual void drawBitmapMatrix(const SkBitmap&, const SkMatrix&, |
reed@google.com | 2d4297c | 2011-10-06 13:14:12 +0000 | [diff] [blame] | 46 | const SkPaint*) SK_OVERRIDE; |
reed@google.com | f0b5e11 | 2011-09-07 11:57:34 +0000 | [diff] [blame] | 47 | virtual void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, |
reed@google.com | 2d4297c | 2011-10-06 13:14:12 +0000 | [diff] [blame] | 48 | const SkRect& dst, const SkPaint*) SK_OVERRIDE; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 49 | virtual void drawSprite(const SkBitmap&, int left, int top, |
reed@google.com | 2d4297c | 2011-10-06 13:14:12 +0000 | [diff] [blame] | 50 | const SkPaint*) SK_OVERRIDE; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 51 | virtual void drawVertices(VertexMode, int vertexCount, |
| 52 | const SkPoint vertices[], const SkPoint texs[], |
| 53 | const SkColor colors[], SkXfermode*, |
| 54 | const uint16_t indices[], int indexCount, |
reed@google.com | 2d4297c | 2011-10-06 13:14:12 +0000 | [diff] [blame] | 55 | const SkPaint&) SK_OVERRIDE; |
| 56 | virtual void drawData(const void*, size_t) SK_OVERRIDE; |
robertphillips@google.com | 0a4805e | 2013-05-29 13:24:23 +0000 | [diff] [blame] | 57 | virtual void beginCommentGroup(const char* description) SK_OVERRIDE; |
| 58 | virtual void addComment(const char* kywd, const char* value) SK_OVERRIDE; |
| 59 | virtual void endCommentGroup() SK_OVERRIDE; |
junov@chromium.org | 8f9ecbd | 2012-02-13 21:53:45 +0000 | [diff] [blame] | 60 | virtual bool isDrawingToLayer() const SK_OVERRIDE; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 61 | |
robertphillips | 9b14f26 | 2014-06-04 05:40:44 -0700 | [diff] [blame] | 62 | const SkTDArray<const SkPicture* >& getPictureRefs() const { |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 63 | return fPictureRefs; |
| 64 | } |
vandebo@chromium.org | 74b4619 | 2012-01-28 01:45:11 +0000 | [diff] [blame] | 65 | |
fmalita | b742517 | 2014-08-26 07:56:44 -0700 | [diff] [blame] | 66 | const SkTDArray<const SkTextBlob* >& getTextBlobRefs() const { |
| 67 | return fTextBlobRefs; |
| 68 | } |
| 69 | |
robertphillips | 0bdbea7 | 2014-06-11 11:37:55 -0700 | [diff] [blame] | 70 | SkData* opData(bool deepCopy) const { |
| 71 | this->validate(fWriter.bytesWritten(), 0); |
| 72 | |
| 73 | if (fWriter.bytesWritten() == 0) { |
| 74 | return SkData::NewEmpty(); |
| 75 | } |
| 76 | |
| 77 | if (deepCopy) { |
| 78 | return SkData::NewWithCopy(fWriter.contiguousArray(), fWriter.bytesWritten()); |
| 79 | } |
| 80 | |
| 81 | return fWriter.snapshotAsData(); |
| 82 | } |
| 83 | |
robertphillips | 0bdbea7 | 2014-06-11 11:37:55 -0700 | [diff] [blame] | 84 | const SkPictureContentInfo& contentInfo() const { |
| 85 | return fContentInfo; |
| 86 | } |
| 87 | |
junov@chromium.org | 4866cc0 | 2012-06-01 21:23:07 +0000 | [diff] [blame] | 88 | void setFlags(uint32_t recordFlags) { |
| 89 | fRecordFlags = recordFlags; |
| 90 | } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 91 | |
| 92 | const SkWriter32& writeStream() const { |
| 93 | return fWriter; |
| 94 | } |
| 95 | |
reed@google.com | d86e7ab | 2012-09-27 20:31:31 +0000 | [diff] [blame] | 96 | void beginRecording(); |
junov@chromium.org | a6c9e0e | 2012-07-12 17:47:34 +0000 | [diff] [blame] | 97 | void endRecording(); |
reed@google.com | d86e7ab | 2012-09-27 20:31:31 +0000 | [diff] [blame] | 98 | |
senorblanco@chromium.org | 68250c8 | 2014-05-06 22:52:55 +0000 | [diff] [blame] | 99 | protected: |
| 100 | void addNoOp(); |
| 101 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 102 | private: |
commit-bot@chromium.org | 4b32bd5 | 2013-03-15 15:06:03 +0000 | [diff] [blame] | 103 | void handleOptimization(int opt); |
commit-bot@chromium.org | dcecb16 | 2014-04-22 17:54:29 +0000 | [diff] [blame] | 104 | size_t recordRestoreOffsetPlaceholder(SkRegion::Op); |
robertphillips@google.com | 5a63f24 | 2014-02-04 20:07:50 +0000 | [diff] [blame] | 105 | void fillRestoreOffsetPlaceholdersForCurrentStackLevel(uint32_t restoreOffset); |
junov@chromium.org | e3dbedb | 2012-07-09 16:03:55 +0000 | [diff] [blame] | 106 | |
reed@google.com | ffacd3c | 2012-08-30 15:31:23 +0000 | [diff] [blame] | 107 | SkTDArray<int32_t> fRestoreOffsetStack; |
junov@chromium.org | 8f9ecbd | 2012-02-13 21:53:45 +0000 | [diff] [blame] | 108 | int fFirstSavedLayerIndex; |
| 109 | enum { |
| 110 | kNoSavedLayerIndex = -1 |
| 111 | }; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 112 | |
commit-bot@chromium.org | 210ae2a | 2014-02-27 17:40:13 +0000 | [diff] [blame] | 113 | SkTDArray<uint32_t> fCullOffsetStack; |
| 114 | |
robertphillips@google.com | 2ca1aaa | 2013-02-15 13:47:37 +0000 | [diff] [blame] | 115 | /* |
| 116 | * 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] | 117 | * 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] | 118 | * location (i.e., it overflows 24 bits). |
| 119 | * Returns the start offset of the chunk. This is the location at which |
| 120 | * the opcode & size are stored. |
skia.committer@gmail.com | ce8343d | 2013-02-16 07:01:31 +0000 | [diff] [blame] | 121 | * 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] | 122 | * and then return a pointer to the memory storage. This could decrease |
| 123 | * allocation overhead but could lead to more wasted space (the tail |
| 124 | * end of blocks could go unused). Possibly add a second addDraw that |
| 125 | * operates in this manner. |
| 126 | */ |
commit-bot@chromium.org | dcecb16 | 2014-04-22 17:54:29 +0000 | [diff] [blame] | 127 | size_t addDraw(DrawType drawType, size_t* size) { |
reed@google.com | 4469938 | 2013-10-31 17:28:30 +0000 | [diff] [blame] | 128 | size_t offset = fWriter.bytesWritten(); |
robertphillips@google.com | 2ca1aaa | 2013-02-15 13:47:37 +0000 | [diff] [blame] | 129 | |
reed@google.com | 97af1a6 | 2012-08-28 12:19:02 +0000 | [diff] [blame] | 130 | this->predrawNotify(); |
hendrikw | afdada2 | 2014-08-08 10:44:33 -0700 | [diff] [blame] | 131 | fContentInfo.addOperation(); |
reed@google.com | 97af1a6 | 2012-08-28 12:19:02 +0000 | [diff] [blame] | 132 | |
robertphillips@google.com | 2ca1aaa | 2013-02-15 13:47:37 +0000 | [diff] [blame] | 133 | SkASSERT(0 != *size); |
| 134 | SkASSERT(((uint8_t) drawType) == drawType); |
| 135 | |
| 136 | if (0 != (*size & ~MASK_24) || *size == MASK_24) { |
| 137 | fWriter.writeInt(PACK_8_24(drawType, MASK_24)); |
| 138 | *size += 1; |
commit-bot@chromium.org | dcecb16 | 2014-04-22 17:54:29 +0000 | [diff] [blame] | 139 | fWriter.writeInt(SkToU32(*size)); |
robertphillips@google.com | 2ca1aaa | 2013-02-15 13:47:37 +0000 | [diff] [blame] | 140 | } else { |
commit-bot@chromium.org | dcecb16 | 2014-04-22 17:54:29 +0000 | [diff] [blame] | 141 | fWriter.writeInt(PACK_8_24(drawType, SkToU32(*size))); |
robertphillips@google.com | 2ca1aaa | 2013-02-15 13:47:37 +0000 | [diff] [blame] | 142 | } |
| 143 | |
| 144 | return offset; |
vandebo@chromium.org | 74b4619 | 2012-01-28 01:45:11 +0000 | [diff] [blame] | 145 | } |
robertphillips@google.com | 2ca1aaa | 2013-02-15 13:47:37 +0000 | [diff] [blame] | 146 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 147 | void addInt(int value) { |
| 148 | fWriter.writeInt(value); |
| 149 | } |
| 150 | void addScalar(SkScalar scalar) { |
| 151 | fWriter.writeScalar(scalar); |
| 152 | } |
vandebo@chromium.org | 74b4619 | 2012-01-28 01:45:11 +0000 | [diff] [blame] | 153 | |
commit-bot@chromium.org | 8016f79 | 2014-03-07 15:53:01 +0000 | [diff] [blame] | 154 | // The command at 'offset' in the skp uses the specified bitmap |
commit-bot@chromium.org | 8016f79 | 2014-03-07 15:53:01 +0000 | [diff] [blame] | 155 | int addBitmap(const SkBitmap& bitmap); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 156 | void addMatrix(const SkMatrix& matrix); |
mtklein | 46616af | 2014-09-30 14:47:10 -0700 | [diff] [blame] | 157 | void addPaint(const SkPaint& paint) { this->addPaintPtr(&paint); } |
| 158 | void addPaintPtr(const SkPaint* paint); |
dandov | b3c9d1c | 2014-08-12 08:34:29 -0700 | [diff] [blame] | 159 | void addPatch(const SkPoint cubics[12]); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 160 | void addPath(const SkPath& path); |
robertphillips | 9b14f26 | 2014-06-04 05:40:44 -0700 | [diff] [blame] | 161 | void addPicture(const SkPicture* picture); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 162 | void addPoint(const SkPoint& point); |
| 163 | void addPoints(const SkPoint pts[], int count); |
| 164 | void addRect(const SkRect& rect); |
| 165 | void addRectPtr(const SkRect* rect); |
reed@google.com | f0b5e11 | 2011-09-07 11:57:34 +0000 | [diff] [blame] | 166 | void addIRect(const SkIRect& rect); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 167 | void addIRectPtr(const SkIRect* rect); |
reed@google.com | 4ed0fb7 | 2012-12-12 20:48:18 +0000 | [diff] [blame] | 168 | void addRRect(const SkRRect&); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 169 | void addRegion(const SkRegion& region); |
| 170 | void addText(const void* text, size_t byteLength); |
fmalita | b742517 | 2014-08-26 07:56:44 -0700 | [diff] [blame] | 171 | void addTextBlob(const SkTextBlob* blob); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 172 | |
junov@chromium.org | 4866cc0 | 2012-06-01 21:23:07 +0000 | [diff] [blame] | 173 | int find(const SkBitmap& bitmap); |
| 174 | |
robertphillips | 6162af8 | 2014-08-11 09:50:11 -0700 | [diff] [blame] | 175 | protected: |
commit-bot@chromium.org | dcecb16 | 2014-04-22 17:54:29 +0000 | [diff] [blame] | 176 | void validate(size_t initialOffset, size_t size) const { |
reed@google.com | 4469938 | 2013-10-31 17:28:30 +0000 | [diff] [blame] | 177 | SkASSERT(fWriter.bytesWritten() == initialOffset + size); |
robertphillips@google.com | 2ca1aaa | 2013-02-15 13:47:37 +0000 | [diff] [blame] | 178 | } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 179 | |
reed | 4a8126e | 2014-09-22 07:29:03 -0700 | [diff] [blame] | 180 | virtual SkSurface* onNewSurface(const SkImageInfo&, const SkSurfaceProps&) SK_OVERRIDE; |
commit-bot@chromium.org | c3bd8af | 2014-02-13 17:14:46 +0000 | [diff] [blame] | 181 | const void* onPeekPixels(SkImageInfo*, size_t*) SK_OVERRIDE { |
| 182 | return NULL; |
| 183 | } |
commit-bot@chromium.org | e54a23f | 2014-03-12 20:21:48 +0000 | [diff] [blame] | 184 | |
Florin Malita | 5f6102d | 2014-06-30 10:13:28 -0400 | [diff] [blame] | 185 | virtual void willSave() SK_OVERRIDE; |
commit-bot@chromium.org | e54a23f | 2014-03-12 20:21:48 +0000 | [diff] [blame] | 186 | virtual SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SaveFlags) SK_OVERRIDE; |
| 187 | virtual void willRestore() SK_OVERRIDE; |
| 188 | |
commit-bot@chromium.org | 44c48d0 | 2014-03-13 20:03:58 +0000 | [diff] [blame] | 189 | virtual void didConcat(const SkMatrix&) SK_OVERRIDE; |
| 190 | virtual void didSetMatrix(const SkMatrix&) SK_OVERRIDE; |
| 191 | |
commit-bot@chromium.org | ed9806f | 2014-02-21 02:32:36 +0000 | [diff] [blame] | 192 | virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRIDE; |
commit-bot@chromium.org | 210ae2a | 2014-02-27 17:40:13 +0000 | [diff] [blame] | 193 | virtual void onPushCull(const SkRect&) SK_OVERRIDE; |
| 194 | virtual void onPopCull() SK_OVERRIDE; |
reed@google.com | 76f10a3 | 2014-02-05 15:32:21 +0000 | [diff] [blame] | 195 | |
reed@google.com | e0d9ce8 | 2014-04-23 04:00:17 +0000 | [diff] [blame] | 196 | virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, SkScalar y, |
| 197 | const SkPaint&) SK_OVERRIDE; |
| 198 | virtual void onDrawPosText(const void* text, size_t byteLength, const SkPoint pos[], |
| 199 | const SkPaint&) SK_OVERRIDE; |
| 200 | virtual void onDrawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[], |
| 201 | SkScalar constY, const SkPaint&) SK_OVERRIDE; |
| 202 | virtual void onDrawTextOnPath(const void* text, size_t byteLength, const SkPath& path, |
| 203 | const SkMatrix* matrix, const SkPaint&) SK_OVERRIDE; |
fmalita | b742517 | 2014-08-26 07:56:44 -0700 | [diff] [blame] | 204 | virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, |
| 205 | const SkPaint& paint) SK_OVERRIDE; |
mtklein | 46616af | 2014-09-30 14:47:10 -0700 | [diff] [blame] | 206 | |
dandov | b3c9d1c | 2014-08-12 08:34:29 -0700 | [diff] [blame] | 207 | virtual void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4], |
| 208 | const SkPoint texCoords[4], SkXfermode* xmode, |
| 209 | const SkPaint& paint) SK_OVERRIDE; |
reed@google.com | e0d9ce8 | 2014-04-23 04:00:17 +0000 | [diff] [blame] | 210 | |
robertphillips@google.com | 8f90a89 | 2014-02-28 18:19:39 +0000 | [diff] [blame] | 211 | virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; |
| 212 | virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; |
| 213 | virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; |
| 214 | virtual void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE; |
| 215 | |
reed | d5fa1a4 | 2014-08-09 11:08:05 -0700 | [diff] [blame] | 216 | virtual void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) SK_OVERRIDE; |
robertphillips | 9b14f26 | 2014-06-04 05:40:44 -0700 | [diff] [blame] | 217 | |
robertphillips@google.com | 5a63f24 | 2014-02-04 20:07:50 +0000 | [diff] [blame] | 218 | int addPathToHeap(const SkPath& path); // does not write to ops stream |
| 219 | |
skia.committer@gmail.com | 1dab403 | 2014-02-05 03:01:48 +0000 | [diff] [blame] | 220 | // These entry points allow the writing of matrices, clips, saves & |
robertphillips@google.com | 5a63f24 | 2014-02-04 20:07:50 +0000 | [diff] [blame] | 221 | // restores to be deferred (e.g., if the MC state is being collapsed and |
| 222 | // only written out as needed). |
| 223 | void recordConcat(const SkMatrix& matrix); |
commit-bot@chromium.org | d9ea09e | 2014-03-25 17:32:26 +0000 | [diff] [blame] | 224 | void recordTranslate(const SkMatrix& matrix); |
| 225 | void recordScale(const SkMatrix& matrix); |
commit-bot@chromium.org | dcecb16 | 2014-04-22 17:54:29 +0000 | [diff] [blame] | 226 | size_t recordClipRect(const SkRect& rect, SkRegion::Op op, bool doAA); |
| 227 | size_t recordClipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA); |
| 228 | size_t recordClipPath(int pathID, SkRegion::Op op, bool doAA); |
| 229 | size_t recordClipRegion(const SkRegion& region, SkRegion::Op op); |
Florin Malita | 5f6102d | 2014-06-30 10:13:28 -0400 | [diff] [blame] | 230 | void recordSave(); |
robertphillips@google.com | 5a63f24 | 2014-02-04 20:07:50 +0000 | [diff] [blame] | 231 | void recordSaveLayer(const SkRect* bounds, const SkPaint* paint, SaveFlags flags); |
robertphillips@google.com | 105a4a5 | 2014-02-11 15:10:40 +0000 | [diff] [blame] | 232 | void recordRestore(bool fillInSkips = true); |
robertphillips@google.com | 5a63f24 | 2014-02-04 20:07:50 +0000 | [diff] [blame] | 233 | |
robertphillips@google.com | 801cee1 | 2012-10-19 19:06:11 +0000 | [diff] [blame] | 234 | private: |
robertphillips | 0bdbea7 | 2014-06-11 11:37:55 -0700 | [diff] [blame] | 235 | SkPictureContentInfo fContentInfo; |
robertphillips | 0bdbea7 | 2014-06-11 11:37:55 -0700 | [diff] [blame] | 236 | |
mtklein | 71a2363 | 2014-11-12 10:24:55 -0800 | [diff] [blame^] | 237 | SkTArray<SkBitmap> fBitmaps; |
| 238 | SkTArray<SkPaint> fPaints; |
| 239 | SkTArray<SkPath> fPaths; |
djsollen@google.com | d2700ee | 2012-05-30 16:54:13 +0000 | [diff] [blame] | 240 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 241 | SkWriter32 fWriter; |
| 242 | |
reed@android.com | 09b84a0 | 2009-06-26 20:22:26 +0000 | [diff] [blame] | 243 | // we ref each item in these arrays |
fmalita | b742517 | 2014-08-26 07:56:44 -0700 | [diff] [blame] | 244 | SkTDArray<const SkPicture*> fPictureRefs; |
| 245 | SkTDArray<const SkTextBlob*> fTextBlobRefs; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 246 | |
reed@android.com | ae814c8 | 2009-02-13 14:56:09 +0000 | [diff] [blame] | 247 | uint32_t fRecordFlags; |
commit-bot@chromium.org | e494dbd | 2014-03-04 19:08:57 +0000 | [diff] [blame] | 248 | int fInitialSaveCount; |
reed@android.com | ae814c8 | 2009-02-13 14:56:09 +0000 | [diff] [blame] | 249 | |
robertphillips | 6142609 | 2014-07-10 09:35:12 -0700 | [diff] [blame] | 250 | friend class SkPictureData; // for SkPictureData's SkPictureRecord-based constructor |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 251 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 252 | typedef SkCanvas INHERITED; |
| 253 | }; |
| 254 | |
| 255 | #endif |