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" |
bungeman | f3c15b7 | 2015-08-19 11:56:48 -0700 | [diff] [blame] | 15 | #include "SkTArray.h" |
| 16 | #include "SkTDArray.h" |
mtklein | c2e2977 | 2015-10-30 05:24:58 -0700 | [diff] [blame] | 17 | #include "SkTHash.h" |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 18 | #include "SkWriter32.h" |
| 19 | |
robertphillips@google.com | 2ca1aaa | 2013-02-15 13:47:37 +0000 | [diff] [blame] | 20 | // These macros help with packing and unpacking a single byte value and |
| 21 | // a 3 byte value into/out of a uint32_t |
| 22 | #define MASK_24 0x00FFFFFF |
| 23 | #define UNPACK_8_24(combined, small, large) \ |
| 24 | small = (combined >> 24) & 0xFF; \ |
| 25 | large = combined & MASK_24; |
| 26 | #define PACK_8_24(small, large) ((small << 24) | large) |
| 27 | |
| 28 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 29 | class SkPictureRecord : public SkCanvas { |
| 30 | public: |
robertphillips | 0bdbea7 | 2014-06-11 11:37:55 -0700 | [diff] [blame] | 31 | SkPictureRecord(const SkISize& dimensions, uint32_t recordFlags); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 32 | virtual ~SkPictureRecord(); |
| 33 | |
robertphillips | 9b14f26 | 2014-06-04 05:40:44 -0700 | [diff] [blame] | 34 | const SkTDArray<const SkPicture* >& getPictureRefs() const { |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 35 | return fPictureRefs; |
| 36 | } |
vandebo@chromium.org | 74b4619 | 2012-01-28 01:45:11 +0000 | [diff] [blame] | 37 | |
msarett | 95416f4 | 2016-04-27 13:51:20 -0700 | [diff] [blame] | 38 | const SkTDArray<SkDrawable* >& getDrawableRefs() const { |
| 39 | return fDrawableRefs; |
| 40 | } |
| 41 | |
fmalita | b742517 | 2014-08-26 07:56:44 -0700 | [diff] [blame] | 42 | const SkTDArray<const SkTextBlob* >& getTextBlobRefs() const { |
| 43 | return fTextBlobRefs; |
| 44 | } |
| 45 | |
reed | 871872f | 2015-06-22 12:48:26 -0700 | [diff] [blame] | 46 | const SkTDArray<const SkImage* >& getImageRefs() const { |
| 47 | return fImageRefs; |
| 48 | } |
bungeman | f3c15b7 | 2015-08-19 11:56:48 -0700 | [diff] [blame] | 49 | |
mtklein | 4d9ff62 | 2016-04-29 14:45:36 -0700 | [diff] [blame] | 50 | sk_sp<SkData> opData() const { |
robertphillips | 0bdbea7 | 2014-06-11 11:37:55 -0700 | [diff] [blame] | 51 | this->validate(fWriter.bytesWritten(), 0); |
| 52 | |
| 53 | if (fWriter.bytesWritten() == 0) { |
reed | fde0511 | 2016-03-11 13:02:28 -0800 | [diff] [blame] | 54 | return SkData::MakeEmpty(); |
robertphillips | 0bdbea7 | 2014-06-11 11:37:55 -0700 | [diff] [blame] | 55 | } |
robertphillips | 0bdbea7 | 2014-06-11 11:37:55 -0700 | [diff] [blame] | 56 | return fWriter.snapshotAsData(); |
| 57 | } |
| 58 | |
robertphillips | 0bdbea7 | 2014-06-11 11:37:55 -0700 | [diff] [blame] | 59 | const SkPictureContentInfo& contentInfo() const { |
| 60 | return fContentInfo; |
| 61 | } |
| 62 | |
junov@chromium.org | 4866cc0 | 2012-06-01 21:23:07 +0000 | [diff] [blame] | 63 | void setFlags(uint32_t recordFlags) { |
| 64 | fRecordFlags = recordFlags; |
| 65 | } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 66 | |
| 67 | const SkWriter32& writeStream() const { |
| 68 | return fWriter; |
| 69 | } |
| 70 | |
reed@google.com | d86e7ab | 2012-09-27 20:31:31 +0000 | [diff] [blame] | 71 | void beginRecording(); |
junov@chromium.org | a6c9e0e | 2012-07-12 17:47:34 +0000 | [diff] [blame] | 72 | void endRecording(); |
reed@google.com | d86e7ab | 2012-09-27 20:31:31 +0000 | [diff] [blame] | 73 | |
senorblanco@chromium.org | 68250c8 | 2014-05-06 22:52:55 +0000 | [diff] [blame] | 74 | protected: |
| 75 | void addNoOp(); |
| 76 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 77 | private: |
commit-bot@chromium.org | 4b32bd5 | 2013-03-15 15:06:03 +0000 | [diff] [blame] | 78 | void handleOptimization(int opt); |
commit-bot@chromium.org | dcecb16 | 2014-04-22 17:54:29 +0000 | [diff] [blame] | 79 | size_t recordRestoreOffsetPlaceholder(SkRegion::Op); |
robertphillips@google.com | 5a63f24 | 2014-02-04 20:07:50 +0000 | [diff] [blame] | 80 | void fillRestoreOffsetPlaceholdersForCurrentStackLevel(uint32_t restoreOffset); |
junov@chromium.org | e3dbedb | 2012-07-09 16:03:55 +0000 | [diff] [blame] | 81 | |
reed@google.com | ffacd3c | 2012-08-30 15:31:23 +0000 | [diff] [blame] | 82 | SkTDArray<int32_t> fRestoreOffsetStack; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 83 | |
commit-bot@chromium.org | 210ae2a | 2014-02-27 17:40:13 +0000 | [diff] [blame] | 84 | SkTDArray<uint32_t> fCullOffsetStack; |
| 85 | |
robertphillips@google.com | 2ca1aaa | 2013-02-15 13:47:37 +0000 | [diff] [blame] | 86 | /* |
| 87 | * 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] | 88 | * 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] | 89 | * location (i.e., it overflows 24 bits). |
| 90 | * Returns the start offset of the chunk. This is the location at which |
| 91 | * the opcode & size are stored. |
skia.committer@gmail.com | ce8343d | 2013-02-16 07:01:31 +0000 | [diff] [blame] | 92 | * 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] | 93 | * and then return a pointer to the memory storage. This could decrease |
| 94 | * allocation overhead but could lead to more wasted space (the tail |
| 95 | * end of blocks could go unused). Possibly add a second addDraw that |
| 96 | * operates in this manner. |
| 97 | */ |
commit-bot@chromium.org | dcecb16 | 2014-04-22 17:54:29 +0000 | [diff] [blame] | 98 | size_t addDraw(DrawType drawType, size_t* size) { |
reed@google.com | 4469938 | 2013-10-31 17:28:30 +0000 | [diff] [blame] | 99 | size_t offset = fWriter.bytesWritten(); |
robertphillips@google.com | 2ca1aaa | 2013-02-15 13:47:37 +0000 | [diff] [blame] | 100 | |
reed@google.com | 97af1a6 | 2012-08-28 12:19:02 +0000 | [diff] [blame] | 101 | this->predrawNotify(); |
hendrikw | afdada2 | 2014-08-08 10:44:33 -0700 | [diff] [blame] | 102 | fContentInfo.addOperation(); |
reed@google.com | 97af1a6 | 2012-08-28 12:19:02 +0000 | [diff] [blame] | 103 | |
robertphillips@google.com | 2ca1aaa | 2013-02-15 13:47:37 +0000 | [diff] [blame] | 104 | SkASSERT(0 != *size); |
| 105 | SkASSERT(((uint8_t) drawType) == drawType); |
| 106 | |
| 107 | if (0 != (*size & ~MASK_24) || *size == MASK_24) { |
| 108 | fWriter.writeInt(PACK_8_24(drawType, MASK_24)); |
| 109 | *size += 1; |
commit-bot@chromium.org | dcecb16 | 2014-04-22 17:54:29 +0000 | [diff] [blame] | 110 | fWriter.writeInt(SkToU32(*size)); |
robertphillips@google.com | 2ca1aaa | 2013-02-15 13:47:37 +0000 | [diff] [blame] | 111 | } else { |
commit-bot@chromium.org | dcecb16 | 2014-04-22 17:54:29 +0000 | [diff] [blame] | 112 | fWriter.writeInt(PACK_8_24(drawType, SkToU32(*size))); |
robertphillips@google.com | 2ca1aaa | 2013-02-15 13:47:37 +0000 | [diff] [blame] | 113 | } |
| 114 | |
| 115 | return offset; |
vandebo@chromium.org | 74b4619 | 2012-01-28 01:45:11 +0000 | [diff] [blame] | 116 | } |
robertphillips@google.com | 2ca1aaa | 2013-02-15 13:47:37 +0000 | [diff] [blame] | 117 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 118 | void addInt(int value) { |
| 119 | fWriter.writeInt(value); |
| 120 | } |
| 121 | void addScalar(SkScalar scalar) { |
| 122 | fWriter.writeScalar(scalar); |
| 123 | } |
vandebo@chromium.org | 74b4619 | 2012-01-28 01:45:11 +0000 | [diff] [blame] | 124 | |
mtklein | e069400 | 2014-11-12 12:49:47 -0800 | [diff] [blame] | 125 | void addBitmap(const SkBitmap& bitmap); |
reed | 871872f | 2015-06-22 12:48:26 -0700 | [diff] [blame] | 126 | void addImage(const SkImage*); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 127 | void addMatrix(const SkMatrix& matrix); |
mtklein | 46616af | 2014-09-30 14:47:10 -0700 | [diff] [blame] | 128 | void addPaint(const SkPaint& paint) { this->addPaintPtr(&paint); } |
| 129 | void addPaintPtr(const SkPaint* paint); |
dandov | b3c9d1c | 2014-08-12 08:34:29 -0700 | [diff] [blame] | 130 | void addPatch(const SkPoint cubics[12]); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 131 | void addPath(const SkPath& path); |
robertphillips | 9b14f26 | 2014-06-04 05:40:44 -0700 | [diff] [blame] | 132 | void addPicture(const SkPicture* picture); |
msarett | 95416f4 | 2016-04-27 13:51:20 -0700 | [diff] [blame] | 133 | void addDrawable(SkDrawable* picture); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 134 | void addPoint(const SkPoint& point); |
| 135 | void addPoints(const SkPoint pts[], int count); |
| 136 | void addRect(const SkRect& rect); |
| 137 | void addRectPtr(const SkRect* rect); |
reed@google.com | f0b5e11 | 2011-09-07 11:57:34 +0000 | [diff] [blame] | 138 | void addIRect(const SkIRect& rect); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 139 | void addIRectPtr(const SkIRect* rect); |
reed@google.com | 4ed0fb7 | 2012-12-12 20:48:18 +0000 | [diff] [blame] | 140 | void addRRect(const SkRRect&); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 141 | void addRegion(const SkRegion& region); |
| 142 | void addText(const void* text, size_t byteLength); |
fmalita | b742517 | 2014-08-26 07:56:44 -0700 | [diff] [blame] | 143 | void addTextBlob(const SkTextBlob* blob); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 144 | |
junov@chromium.org | 4866cc0 | 2012-06-01 21:23:07 +0000 | [diff] [blame] | 145 | int find(const SkBitmap& bitmap); |
| 146 | |
robertphillips | 6162af8 | 2014-08-11 09:50:11 -0700 | [diff] [blame] | 147 | protected: |
commit-bot@chromium.org | dcecb16 | 2014-04-22 17:54:29 +0000 | [diff] [blame] | 148 | void validate(size_t initialOffset, size_t size) const { |
reed@google.com | 4469938 | 2013-10-31 17:28:30 +0000 | [diff] [blame] | 149 | SkASSERT(fWriter.bytesWritten() == initialOffset + size); |
robertphillips@google.com | 2ca1aaa | 2013-02-15 13:47:37 +0000 | [diff] [blame] | 150 | } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 151 | |
reed | e8f3062 | 2016-03-23 18:59:25 -0700 | [diff] [blame] | 152 | sk_sp<SkSurface> onNewSurface(const SkImageInfo&, const SkSurfaceProps&) override; |
reed | 884e97c | 2015-05-26 11:31:54 -0700 | [diff] [blame] | 153 | bool onPeekPixels(SkPixmap*) override { return false; } |
commit-bot@chromium.org | e54a23f | 2014-03-12 20:21:48 +0000 | [diff] [blame] | 154 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 155 | void willSave() override; |
reed | 4960eee | 2015-12-18 07:09:18 -0800 | [diff] [blame] | 156 | SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec&) override; |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 157 | void willRestore() override; |
commit-bot@chromium.org | e54a23f | 2014-03-12 20:21:48 +0000 | [diff] [blame] | 158 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 159 | void didConcat(const SkMatrix&) override; |
| 160 | void didSetMatrix(const SkMatrix&) override; |
commit-bot@chromium.org | 44c48d0 | 2014-03-13 20:03:58 +0000 | [diff] [blame] | 161 | |
vjiaoblack | 95302da | 2016-07-21 10:25:54 -0700 | [diff] [blame^] | 162 | #ifdef SK_EXPERIMENTAL_SHADOWING |
vjiaoblack | e5de130 | 2016-07-13 14:05:28 -0700 | [diff] [blame] | 163 | void didTranslateZ(SkScalar) override; |
vjiaoblack | 95302da | 2016-07-21 10:25:54 -0700 | [diff] [blame^] | 164 | #endif |
| 165 | void didTranslateZ(SkScalar); |
| 166 | #endif |
vjiaoblack | e5de130 | 2016-07-13 14:05:28 -0700 | [diff] [blame] | 167 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 168 | void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) override; |
reed@google.com | 76f10a3 | 2014-02-05 15:32:21 +0000 | [diff] [blame] | 169 | |
reed | 3dfd133 | 2015-06-25 14:26:11 -0700 | [diff] [blame] | 170 | void onDrawText(const void* text, size_t, SkScalar x, SkScalar y, const SkPaint&) override; |
| 171 | void onDrawPosText(const void* text, size_t, const SkPoint pos[], const SkPaint&) override; |
| 172 | void onDrawPosTextH(const void* text, size_t, const SkScalar xpos[], SkScalar constY, |
| 173 | const SkPaint&) override; |
| 174 | void onDrawTextOnPath(const void* text, size_t byteLength, const SkPath& path, |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 175 | const SkMatrix* matrix, const SkPaint&) override; |
reed | 45561a0 | 2016-07-07 12:47:17 -0700 | [diff] [blame] | 176 | void onDrawTextRSXform(const void* text, size_t byteLength, const SkRSXform xform[], |
| 177 | const SkRect* cull, const SkPaint&) override; |
reed | 3dfd133 | 2015-06-25 14:26:11 -0700 | [diff] [blame] | 178 | void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 179 | const SkPaint& paint) override; |
mtklein | 46616af | 2014-09-30 14:47:10 -0700 | [diff] [blame] | 180 | |
reed | 3dfd133 | 2015-06-25 14:26:11 -0700 | [diff] [blame] | 181 | void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4], |
dandov | b3c9d1c | 2014-08-12 08:34:29 -0700 | [diff] [blame] | 182 | const SkPoint texCoords[4], SkXfermode* xmode, |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 183 | const SkPaint& paint) override; |
reed | 71c3c76 | 2015-06-24 10:29:17 -0700 | [diff] [blame] | 184 | void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[], int, |
| 185 | SkXfermode::Mode, const SkRect*, const SkPaint*) override; |
reed@google.com | e0d9ce8 | 2014-04-23 04:00:17 +0000 | [diff] [blame] | 186 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 187 | void onDrawPaint(const SkPaint&) override; |
| 188 | void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPaint&) override; |
| 189 | void onDrawRect(const SkRect&, const SkPaint&) override; |
| 190 | void onDrawOval(const SkRect&, const SkPaint&) override; |
| 191 | void onDrawRRect(const SkRRect&, const SkPaint&) override; |
| 192 | void onDrawPath(const SkPath&, const SkPaint&) override; |
| 193 | void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPaint*) override; |
reed | 41af966 | 2015-01-05 07:49:08 -0800 | [diff] [blame] | 194 | void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst, const SkPaint*, |
reed | 562fe47 | 2015-07-28 07:35:14 -0700 | [diff] [blame] | 195 | SrcRectConstraint) override; |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 196 | void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*) override; |
reed | 41af966 | 2015-01-05 07:49:08 -0800 | [diff] [blame] | 197 | void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst, |
reed | 562fe47 | 2015-07-28 07:35:14 -0700 | [diff] [blame] | 198 | const SkPaint*, SrcRectConstraint) override; |
reed | 4c21dc5 | 2015-06-25 12:32:03 -0700 | [diff] [blame] | 199 | void onDrawImageNine(const SkImage*, const SkIRect& center, const SkRect& dst, |
| 200 | const SkPaint*) override; |
reed | 41af966 | 2015-01-05 07:49:08 -0800 | [diff] [blame] | 201 | void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst, |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 202 | const SkPaint*) override; |
reed | 41af966 | 2015-01-05 07:49:08 -0800 | [diff] [blame] | 203 | void onDrawVertices(VertexMode vmode, int vertexCount, |
| 204 | const SkPoint vertices[], const SkPoint texs[], |
| 205 | const SkColor colors[], SkXfermode* xmode, |
| 206 | const uint16_t indices[], int indexCount, |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 207 | const SkPaint&) override; |
reed | 41af966 | 2015-01-05 07:49:08 -0800 | [diff] [blame] | 208 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 209 | void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) override; |
| 210 | void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) override; |
| 211 | void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) override; |
| 212 | void onClipRegion(const SkRegion&, SkRegion::Op) override; |
robertphillips@google.com | 8f90a89 | 2014-02-28 18:19:39 +0000 | [diff] [blame] | 213 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 214 | void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override; |
vjiaoblack | 95302da | 2016-07-21 10:25:54 -0700 | [diff] [blame^] | 215 | |
| 216 | #ifdef SK_EXPERIMENTAL_SHADOWING |
| 217 | void onDrawShadowedPicture(const SkPicture*, |
| 218 | const SkMatrix*, |
| 219 | const SkPaint*) override; |
| 220 | #else |
| 221 | void onDrawShadowedPicture(const SkPicture*, |
| 222 | const SkMatrix*, |
| 223 | const SkPaint*); |
| 224 | #endif |
| 225 | |
msarett | 95416f4 | 2016-04-27 13:51:20 -0700 | [diff] [blame] | 226 | void onDrawDrawable(SkDrawable*, const SkMatrix*) override; |
reed | f70b531 | 2016-03-04 16:36:20 -0800 | [diff] [blame] | 227 | void onDrawAnnotation(const SkRect&, const char[], SkData*) override; |
robertphillips | 9b14f26 | 2014-06-04 05:40:44 -0700 | [diff] [blame] | 228 | |
robertphillips@google.com | 5a63f24 | 2014-02-04 20:07:50 +0000 | [diff] [blame] | 229 | int addPathToHeap(const SkPath& path); // does not write to ops stream |
| 230 | |
skia.committer@gmail.com | 1dab403 | 2014-02-05 03:01:48 +0000 | [diff] [blame] | 231 | // These entry points allow the writing of matrices, clips, saves & |
robertphillips@google.com | 5a63f24 | 2014-02-04 20:07:50 +0000 | [diff] [blame] | 232 | // restores to be deferred (e.g., if the MC state is being collapsed and |
| 233 | // only written out as needed). |
| 234 | void recordConcat(const SkMatrix& matrix); |
commit-bot@chromium.org | d9ea09e | 2014-03-25 17:32:26 +0000 | [diff] [blame] | 235 | void recordTranslate(const SkMatrix& matrix); |
| 236 | void recordScale(const SkMatrix& matrix); |
commit-bot@chromium.org | dcecb16 | 2014-04-22 17:54:29 +0000 | [diff] [blame] | 237 | size_t recordClipRect(const SkRect& rect, SkRegion::Op op, bool doAA); |
| 238 | size_t recordClipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA); |
| 239 | size_t recordClipPath(int pathID, SkRegion::Op op, bool doAA); |
| 240 | size_t recordClipRegion(const SkRegion& region, SkRegion::Op op); |
Florin Malita | 5f6102d | 2014-06-30 10:13:28 -0400 | [diff] [blame] | 241 | void recordSave(); |
reed | 4960eee | 2015-12-18 07:09:18 -0800 | [diff] [blame] | 242 | void recordSaveLayer(const SaveLayerRec&); |
robertphillips@google.com | 105a4a5 | 2014-02-11 15:10:40 +0000 | [diff] [blame] | 243 | void recordRestore(bool fillInSkips = true); |
robertphillips@google.com | 5a63f24 | 2014-02-04 20:07:50 +0000 | [diff] [blame] | 244 | |
robertphillips@google.com | 801cee1 | 2012-10-19 19:06:11 +0000 | [diff] [blame] | 245 | private: |
robertphillips | 0bdbea7 | 2014-06-11 11:37:55 -0700 | [diff] [blame] | 246 | SkPictureContentInfo fContentInfo; |
robertphillips | 0bdbea7 | 2014-06-11 11:37:55 -0700 | [diff] [blame] | 247 | |
mtklein | 71a2363 | 2014-11-12 10:24:55 -0800 | [diff] [blame] | 248 | SkTArray<SkBitmap> fBitmaps; |
| 249 | SkTArray<SkPaint> fPaints; |
mtklein | c2e2977 | 2015-10-30 05:24:58 -0700 | [diff] [blame] | 250 | |
| 251 | struct PathHash { |
| 252 | uint32_t operator()(const SkPath& p) { return p.getGenerationID(); } |
| 253 | }; |
| 254 | SkTHashMap<SkPath, int, PathHash> fPaths; |
djsollen@google.com | d2700ee | 2012-05-30 16:54:13 +0000 | [diff] [blame] | 255 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 256 | SkWriter32 fWriter; |
| 257 | |
reed@android.com | 09b84a0 | 2009-06-26 20:22:26 +0000 | [diff] [blame] | 258 | // we ref each item in these arrays |
reed | 871872f | 2015-06-22 12:48:26 -0700 | [diff] [blame] | 259 | SkTDArray<const SkImage*> fImageRefs; |
fmalita | b742517 | 2014-08-26 07:56:44 -0700 | [diff] [blame] | 260 | SkTDArray<const SkPicture*> fPictureRefs; |
msarett | 95416f4 | 2016-04-27 13:51:20 -0700 | [diff] [blame] | 261 | SkTDArray<SkDrawable*> fDrawableRefs; |
fmalita | b742517 | 2014-08-26 07:56:44 -0700 | [diff] [blame] | 262 | SkTDArray<const SkTextBlob*> fTextBlobRefs; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 263 | |
reed@android.com | ae814c8 | 2009-02-13 14:56:09 +0000 | [diff] [blame] | 264 | uint32_t fRecordFlags; |
commit-bot@chromium.org | e494dbd | 2014-03-04 19:08:57 +0000 | [diff] [blame] | 265 | int fInitialSaveCount; |
reed@android.com | ae814c8 | 2009-02-13 14:56:09 +0000 | [diff] [blame] | 266 | |
robertphillips | 6142609 | 2014-07-10 09:35:12 -0700 | [diff] [blame] | 267 | friend class SkPictureData; // for SkPictureData's SkPictureRecord-based constructor |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 268 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 269 | typedef SkCanvas INHERITED; |
| 270 | }; |