commit-bot@chromium.org | c4b21e6 | 2014-04-11 18:33:31 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2014 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 | */ |
| 7 | |
commit-bot@chromium.org | 506db0b | 2014-04-08 23:31:35 +0000 | [diff] [blame] | 8 | #include "SkRecordDraw.h" |
mtklein | 5ad6ee1 | 2014-08-11 08:08:43 -0700 | [diff] [blame] | 9 | #include "SkTSort.h" |
commit-bot@chromium.org | 506db0b | 2014-04-08 23:31:35 +0000 | [diff] [blame] | 10 | |
mtklein | 5ad6ee1 | 2014-08-11 08:08:43 -0700 | [diff] [blame] | 11 | void SkRecordDraw(const SkRecord& record, |
| 12 | SkCanvas* canvas, |
| 13 | const SkBBoxHierarchy* bbh, |
| 14 | SkDrawPictureCallback* callback) { |
Mike Klein | c11530e | 2014-06-24 11:29:06 -0400 | [diff] [blame] | 15 | SkAutoCanvasRestore saveRestore(canvas, true /*save now, restore at exit*/); |
mtklein | 5ad6ee1 | 2014-08-11 08:08:43 -0700 | [diff] [blame] | 16 | |
| 17 | if (NULL != bbh) { |
mtklein | 5ad6ee1 | 2014-08-11 08:08:43 -0700 | [diff] [blame] | 18 | // Draw only ops that affect pixels in the canvas's current clip. |
mtklein | a723b57 | 2014-08-15 11:49:49 -0700 | [diff] [blame] | 19 | SkIRect query; |
| 20 | #if 1 // TODO: Why is this the right way to make the query? I'd think it'd be the else branch. |
| 21 | SkRect clipBounds; |
| 22 | canvas->getClipBounds(&clipBounds); |
| 23 | clipBounds.roundOut(&query); |
| 24 | #else |
| 25 | canvas->getClipDeviceBounds(&query); |
| 26 | #endif |
mtklein | 5ad6ee1 | 2014-08-11 08:08:43 -0700 | [diff] [blame] | 27 | SkTDArray<void*> ops; |
mtklein | a723b57 | 2014-08-15 11:49:49 -0700 | [diff] [blame] | 28 | bbh->search(query, &ops); |
mtklein | 5ad6ee1 | 2014-08-11 08:08:43 -0700 | [diff] [blame] | 29 | |
mtklein | 5ad6ee1 | 2014-08-11 08:08:43 -0700 | [diff] [blame] | 30 | SkRecords::Draw draw(canvas); |
| 31 | for (int i = 0; i < ops.count(); i++) { |
| 32 | if (NULL != callback && callback->abortDrawing()) { |
| 33 | return; |
| 34 | } |
| 35 | record.visit<void>((uintptr_t)ops[i], draw); // See FillBounds below. |
| 36 | } |
| 37 | } else { |
| 38 | // Draw all ops. |
| 39 | for (SkRecords::Draw draw(canvas); draw.index() < record.count(); draw.next()) { |
| 40 | if (NULL != callback && callback->abortDrawing()) { |
| 41 | return; |
| 42 | } |
| 43 | record.visit<void>(draw.index(), draw); |
| 44 | } |
commit-bot@chromium.org | 73b55eb | 2014-04-14 20:35:12 +0000 | [diff] [blame] | 45 | } |
commit-bot@chromium.org | 27f6b0d | 2014-05-09 14:59:29 +0000 | [diff] [blame] | 46 | } |
commit-bot@chromium.org | d9ce2be | 2014-04-09 23:30:28 +0000 | [diff] [blame] | 47 | |
commit-bot@chromium.org | 27f6b0d | 2014-05-09 14:59:29 +0000 | [diff] [blame] | 48 | namespace SkRecords { |
commit-bot@chromium.org | 73b55eb | 2014-04-14 20:35:12 +0000 | [diff] [blame] | 49 | |
mtklein | 7cdc1ee | 2014-07-07 10:41:04 -0700 | [diff] [blame] | 50 | // FIXME: SkBitmaps are stateful, so we need to copy them to play back in multiple threads. |
| 51 | static SkBitmap shallow_copy(const SkBitmap& bitmap) { |
| 52 | return bitmap; |
| 53 | } |
| 54 | |
commit-bot@chromium.org | 2e0c32a | 2014-04-28 16:19:45 +0000 | [diff] [blame] | 55 | // NoOps draw nothing. |
commit-bot@chromium.org | 27f6b0d | 2014-05-09 14:59:29 +0000 | [diff] [blame] | 56 | template <> void Draw::draw(const NoOp&) {} |
commit-bot@chromium.org | 73b55eb | 2014-04-14 20:35:12 +0000 | [diff] [blame] | 57 | |
commit-bot@chromium.org | 27f6b0d | 2014-05-09 14:59:29 +0000 | [diff] [blame] | 58 | #define DRAW(T, call) template <> void Draw::draw(const T& r) { fCanvas->call; } |
commit-bot@chromium.org | 73b55eb | 2014-04-14 20:35:12 +0000 | [diff] [blame] | 59 | DRAW(Restore, restore()); |
Florin Malita | 5f6102d | 2014-06-30 10:13:28 -0400 | [diff] [blame] | 60 | DRAW(Save, save()); |
commit-bot@chromium.org | 73b55eb | 2014-04-14 20:35:12 +0000 | [diff] [blame] | 61 | DRAW(SaveLayer, saveLayer(r.bounds, r.paint, r.flags)); |
| 62 | DRAW(PopCull, popCull()); |
commit-bot@chromium.org | 88c3e27 | 2014-04-22 16:57:20 +0000 | [diff] [blame] | 63 | DRAW(PushCull, pushCull(r.rect)); |
commit-bot@chromium.org | 73b55eb | 2014-04-14 20:35:12 +0000 | [diff] [blame] | 64 | DRAW(Clear, clear(r.color)); |
| 65 | DRAW(Concat, concat(r.matrix)); |
commit-bot@chromium.org | 99bd7d8 | 2014-05-19 15:51:12 +0000 | [diff] [blame] | 66 | DRAW(SetMatrix, setMatrix(SkMatrix::Concat(fInitialCTM, r.matrix))); |
commit-bot@chromium.org | 73b55eb | 2014-04-14 20:35:12 +0000 | [diff] [blame] | 67 | |
| 68 | DRAW(ClipPath, clipPath(r.path, r.op, r.doAA)); |
| 69 | DRAW(ClipRRect, clipRRect(r.rrect, r.op, r.doAA)); |
| 70 | DRAW(ClipRect, clipRect(r.rect, r.op, r.doAA)); |
| 71 | DRAW(ClipRegion, clipRegion(r.region, r.op)); |
| 72 | |
mtklein | 7cdc1ee | 2014-07-07 10:41:04 -0700 | [diff] [blame] | 73 | DRAW(DrawBitmap, drawBitmap(shallow_copy(r.bitmap), r.left, r.top, r.paint)); |
| 74 | DRAW(DrawBitmapMatrix, drawBitmapMatrix(shallow_copy(r.bitmap), r.matrix, r.paint)); |
| 75 | DRAW(DrawBitmapNine, drawBitmapNine(shallow_copy(r.bitmap), r.center, r.dst, r.paint)); |
| 76 | DRAW(DrawBitmapRectToRect, |
| 77 | drawBitmapRectToRect(shallow_copy(r.bitmap), r.src, r.dst, r.paint, r.flags)); |
commit-bot@chromium.org | 73b55eb | 2014-04-14 20:35:12 +0000 | [diff] [blame] | 78 | DRAW(DrawDRRect, drawDRRect(r.outer, r.inner, r.paint)); |
| 79 | DRAW(DrawOval, drawOval(r.oval, r.paint)); |
| 80 | DRAW(DrawPaint, drawPaint(r.paint)); |
| 81 | DRAW(DrawPath, drawPath(r.path, r.paint)); |
dandov | b3c9d1c | 2014-08-12 08:34:29 -0700 | [diff] [blame] | 82 | DRAW(DrawPatch, drawPatch(r.cubics, r.colors, r.texCoords, r.xmode.get(), r.paint)); |
reed | d5fa1a4 | 2014-08-09 11:08:05 -0700 | [diff] [blame] | 83 | DRAW(DrawPicture, drawPicture(r.picture, r.matrix, r.paint)); |
commit-bot@chromium.org | 73b55eb | 2014-04-14 20:35:12 +0000 | [diff] [blame] | 84 | DRAW(DrawPoints, drawPoints(r.mode, r.count, r.pts, r.paint)); |
| 85 | DRAW(DrawPosText, drawPosText(r.text, r.byteLength, r.pos, r.paint)); |
| 86 | DRAW(DrawPosTextH, drawPosTextH(r.text, r.byteLength, r.xpos, r.y, r.paint)); |
| 87 | DRAW(DrawRRect, drawRRect(r.rrect, r.paint)); |
| 88 | DRAW(DrawRect, drawRect(r.rect, r.paint)); |
mtklein | 7cdc1ee | 2014-07-07 10:41:04 -0700 | [diff] [blame] | 89 | DRAW(DrawSprite, drawSprite(shallow_copy(r.bitmap), r.left, r.top, r.paint)); |
commit-bot@chromium.org | 73b55eb | 2014-04-14 20:35:12 +0000 | [diff] [blame] | 90 | DRAW(DrawText, drawText(r.text, r.byteLength, r.x, r.y, r.paint)); |
| 91 | DRAW(DrawTextOnPath, drawTextOnPath(r.text, r.byteLength, r.path, r.matrix, r.paint)); |
| 92 | DRAW(DrawVertices, drawVertices(r.vmode, r.vertexCount, r.vertices, r.texs, r.colors, |
| 93 | r.xmode.get(), r.indices, r.indexCount, r.paint)); |
| 94 | #undef DRAW |
| 95 | |
mtklein | 5ad6ee1 | 2014-08-11 08:08:43 -0700 | [diff] [blame] | 96 | |
| 97 | // This is an SkRecord visitor that fills an SkBBoxHierarchy. |
mtklein | 828ce1f | 2014-08-13 12:58:45 -0700 | [diff] [blame] | 98 | // |
| 99 | // The interesting part here is how to calculate bounds for ops which don't |
| 100 | // have intrinsic bounds. What is the bounds of a Save or a Translate? |
| 101 | // |
| 102 | // We answer this by thinking about a particular definition of bounds: if I |
| 103 | // don't execute this op, pixels in this rectangle might draw incorrectly. So |
| 104 | // the bounds of a Save, a Translate, a Restore, etc. are the union of the |
| 105 | // bounds of Draw* ops that they might have an effect on. For any given |
| 106 | // Save/Restore block, the bounds of the Save, the Restore, and any other |
| 107 | // non-drawing ("control") ops inside are exactly the union of the bounds of |
| 108 | // the drawing ops inside that block. |
| 109 | // |
| 110 | // To implement this, we keep a stack of active Save blocks. As we consume ops |
| 111 | // inside the Save/Restore block, drawing ops are unioned with the bounds of |
| 112 | // the block, and control ops are stashed away for later. When we finish the |
| 113 | // block with a Restore, our bounds are complete, and we go back and fill them |
| 114 | // in for all the control ops we stashed away. |
mtklein | 5ad6ee1 | 2014-08-11 08:08:43 -0700 | [diff] [blame] | 115 | class FillBounds : SkNoncopyable { |
| 116 | public: |
mtklein | 828ce1f | 2014-08-13 12:58:45 -0700 | [diff] [blame] | 117 | FillBounds(const SkRecord& record, SkBBoxHierarchy* bbh) : fBounds(record.count()) { |
| 118 | // Calculate bounds for all ops. This won't go quite in order, so we'll need |
| 119 | // to store the bounds separately then feed them in to the BBH later in order. |
mtklein | a723b57 | 2014-08-15 11:49:49 -0700 | [diff] [blame] | 120 | const SkIRect largest = SkIRect::MakeLargest(); |
mtklein | 6cfa73a | 2014-08-13 13:33:49 -0700 | [diff] [blame] | 121 | fCTM.setIdentity(); |
mtklein | a723b57 | 2014-08-15 11:49:49 -0700 | [diff] [blame] | 122 | fCurrentClipBounds = largest; |
mtklein | 828ce1f | 2014-08-13 12:58:45 -0700 | [diff] [blame] | 123 | for (fCurrentOp = 0; fCurrentOp < record.count(); fCurrentOp++) { |
| 124 | record.visit<void>(fCurrentOp, *this); |
| 125 | } |
mtklein | 5ad6ee1 | 2014-08-11 08:08:43 -0700 | [diff] [blame] | 126 | |
mtklein | 828ce1f | 2014-08-13 12:58:45 -0700 | [diff] [blame] | 127 | // If we have any lingering unpaired Saves, simulate restores to make |
| 128 | // sure all ops in those Save blocks have their bounds calculated. |
| 129 | while (!fSaveStack.isEmpty()) { |
| 130 | this->popSaveBlock(); |
| 131 | } |
| 132 | |
| 133 | // Any control ops not part of any Save/Restore block draw everywhere. |
| 134 | while (!fControlIndices.isEmpty()) { |
mtklein | a723b57 | 2014-08-15 11:49:49 -0700 | [diff] [blame] | 135 | this->popControl(largest); |
mtklein | 828ce1f | 2014-08-13 12:58:45 -0700 | [diff] [blame] | 136 | } |
| 137 | |
| 138 | // Finally feed all stored bounds into the BBH. They'll be returned in this order. |
| 139 | SkASSERT(NULL != bbh); |
| 140 | for (uintptr_t i = 0; i < record.count(); i++) { |
| 141 | if (!fBounds[i].isEmpty()) { |
| 142 | bbh->insert((void*)i, fBounds[i], true/*ok to defer*/); |
| 143 | } |
| 144 | } |
| 145 | bbh->flushDeferredInserts(); |
| 146 | } |
mtklein | 5ad6ee1 | 2014-08-11 08:08:43 -0700 | [diff] [blame] | 147 | |
mtklein | a723b57 | 2014-08-15 11:49:49 -0700 | [diff] [blame] | 148 | template <typename T> void operator()(const T& op) { |
| 149 | this->updateCTM(op); |
| 150 | this->updateClipBounds(op); |
| 151 | this->trackBounds(op); |
mtklein | 5ad6ee1 | 2014-08-11 08:08:43 -0700 | [diff] [blame] | 152 | } |
| 153 | |
| 154 | private: |
mtklein | 828ce1f | 2014-08-13 12:58:45 -0700 | [diff] [blame] | 155 | struct SaveBounds { |
mtklein | a723b57 | 2014-08-15 11:49:49 -0700 | [diff] [blame] | 156 | int controlOps; // Number of control ops in this Save block, including the Save. |
| 157 | SkIRect bounds; // Bounds of everything in the block. |
| 158 | const SkPaint* paint; // Unowned. If set, adjusts the bounds of all ops in this block. |
mtklein | 828ce1f | 2014-08-13 12:58:45 -0700 | [diff] [blame] | 159 | }; |
| 160 | |
mtklein | 6cfa73a | 2014-08-13 13:33:49 -0700 | [diff] [blame] | 161 | template <typename T> void updateCTM(const T&) { /* most ops don't change the CTM */ } |
mtklein | a723b57 | 2014-08-15 11:49:49 -0700 | [diff] [blame] | 162 | void updateCTM(const Restore& op) { fCTM = op.matrix; } |
| 163 | void updateCTM(const SetMatrix& op) { fCTM = op.matrix; } |
| 164 | void updateCTM(const Concat& op) { fCTM.preConcat(op.matrix); } |
| 165 | |
| 166 | template <typename T> void updateClipBounds(const T&) { /* most ops don't change the clip */ } |
| 167 | // Each of these devBounds fields is the state of the device bounds after the op. |
| 168 | // So Restore's devBounds are those bounds saved by its paired Save or SaveLayer. |
| 169 | void updateClipBounds(const Restore& op) { fCurrentClipBounds = op.devBounds; } |
| 170 | void updateClipBounds(const ClipPath& op) { fCurrentClipBounds = op.devBounds; } |
| 171 | void updateClipBounds(const ClipRRect& op) { fCurrentClipBounds = op.devBounds; } |
| 172 | void updateClipBounds(const ClipRect& op) { fCurrentClipBounds = op.devBounds; } |
| 173 | void updateClipBounds(const ClipRegion& op) { fCurrentClipBounds = op.devBounds; } |
| 174 | void updateClipBounds(const SaveLayer& op) { |
| 175 | if (op.bounds) { |
| 176 | fCurrentClipBounds.intersect(this->adjustAndMap(*op.bounds, op.paint)); |
| 177 | } |
| 178 | } |
mtklein | 6cfa73a | 2014-08-13 13:33:49 -0700 | [diff] [blame] | 179 | |
mtklein | 828ce1f | 2014-08-13 12:58:45 -0700 | [diff] [blame] | 180 | // The bounds of these ops must be calculated when we hit the Restore |
| 181 | // from the bounds of the ops in the same Save block. |
mtklein | a723b57 | 2014-08-15 11:49:49 -0700 | [diff] [blame] | 182 | void trackBounds(const Save&) { this->pushSaveBlock(NULL); } |
mtklein | 828ce1f | 2014-08-13 12:58:45 -0700 | [diff] [blame] | 183 | // TODO: bounds of SaveLayer may be more complicated? |
mtklein | a723b57 | 2014-08-15 11:49:49 -0700 | [diff] [blame] | 184 | void trackBounds(const SaveLayer& op) { this->pushSaveBlock(op.paint); } |
| 185 | void trackBounds(const Restore&) { fBounds[fCurrentOp] = this->popSaveBlock(); } |
mtklein | 828ce1f | 2014-08-13 12:58:45 -0700 | [diff] [blame] | 186 | |
| 187 | void trackBounds(const Concat&) { this->pushControl(); } |
| 188 | void trackBounds(const SetMatrix&) { this->pushControl(); } |
| 189 | void trackBounds(const ClipRect&) { this->pushControl(); } |
| 190 | void trackBounds(const ClipRRect&) { this->pushControl(); } |
| 191 | void trackBounds(const ClipPath&) { this->pushControl(); } |
| 192 | void trackBounds(const ClipRegion&) { this->pushControl(); } |
| 193 | |
| 194 | // For all other ops, we can calculate and store the bounds directly now. |
| 195 | template <typename T> void trackBounds(const T& op) { |
| 196 | fBounds[fCurrentOp] = this->bounds(op); |
| 197 | this->updateSaveBounds(fBounds[fCurrentOp]); |
mtklein | 5ad6ee1 | 2014-08-11 08:08:43 -0700 | [diff] [blame] | 198 | } |
| 199 | |
mtklein | a723b57 | 2014-08-15 11:49:49 -0700 | [diff] [blame] | 200 | void pushSaveBlock(const SkPaint* paint) { |
mtklein | 828ce1f | 2014-08-13 12:58:45 -0700 | [diff] [blame] | 201 | // Starting a new Save block. Push a new entry to represent that. |
mtklein | a723b57 | 2014-08-15 11:49:49 -0700 | [diff] [blame] | 202 | SaveBounds sb = { 0, SkIRect::MakeEmpty(), paint }; |
mtklein | 828ce1f | 2014-08-13 12:58:45 -0700 | [diff] [blame] | 203 | fSaveStack.push(sb); |
| 204 | this->pushControl(); |
| 205 | } |
| 206 | |
| 207 | SkIRect popSaveBlock() { |
| 208 | // We're done the Save block. Apply the block's bounds to all control ops inside it. |
| 209 | SaveBounds sb; |
| 210 | fSaveStack.pop(&sb); |
| 211 | while (sb.controlOps --> 0) { |
| 212 | this->popControl(sb.bounds); |
| 213 | } |
| 214 | |
| 215 | // This whole Save block may be part another Save block. |
| 216 | this->updateSaveBounds(sb.bounds); |
| 217 | |
| 218 | // If called from a real Restore (not a phony one for balance), it'll need the bounds. |
| 219 | return sb.bounds; |
| 220 | } |
| 221 | |
| 222 | void pushControl() { |
| 223 | fControlIndices.push(fCurrentOp); |
| 224 | if (!fSaveStack.isEmpty()) { |
| 225 | fSaveStack.top().controlOps++; |
| 226 | } |
| 227 | } |
| 228 | |
| 229 | void popControl(const SkIRect& bounds) { |
| 230 | fBounds[fControlIndices.top()] = bounds; |
| 231 | fControlIndices.pop(); |
| 232 | } |
| 233 | |
| 234 | void updateSaveBounds(const SkIRect& bounds) { |
| 235 | // If we're in a Save block, expand its bounds to cover these bounds too. |
| 236 | if (!fSaveStack.isEmpty()) { |
| 237 | fSaveStack.top().bounds.join(bounds); |
| 238 | } |
| 239 | } |
| 240 | |
mtklein | a723b57 | 2014-08-15 11:49:49 -0700 | [diff] [blame] | 241 | // TODO: Remove this default when done bounding all ops. |
mtklein | 479601b | 2014-08-18 08:45:33 -0700 | [diff] [blame^] | 242 | template <typename T> SkIRect bounds(const T&) const { return fCurrentClipBounds; } |
| 243 | SkIRect bounds(const Clear&) const { return SkIRect::MakeLargest(); } // Ignores the clip |
| 244 | SkIRect bounds(const NoOp&) const { return SkIRect::MakeEmpty(); } // NoOps don't draw. |
mtklein | 828ce1f | 2014-08-13 12:58:45 -0700 | [diff] [blame] | 245 | |
mtklein | 479601b | 2014-08-18 08:45:33 -0700 | [diff] [blame^] | 246 | // Returns true if rect was meaningfully adjusted for the effects of paint, |
| 247 | // false if the paint could affect the rect in unknown ways. |
| 248 | static bool AdjustForPaint(const SkPaint* paint, SkRect* rect) { |
mtklein | a723b57 | 2014-08-15 11:49:49 -0700 | [diff] [blame] | 249 | if (paint) { |
| 250 | if (paint->canComputeFastBounds()) { |
mtklein | 479601b | 2014-08-18 08:45:33 -0700 | [diff] [blame^] | 251 | *rect = paint->computeFastBounds(*rect, rect); |
| 252 | return true; |
mtklein | a723b57 | 2014-08-15 11:49:49 -0700 | [diff] [blame] | 253 | } |
mtklein | 479601b | 2014-08-18 08:45:33 -0700 | [diff] [blame^] | 254 | return false; |
| 255 | } |
| 256 | return true; |
| 257 | } |
| 258 | |
| 259 | // Adjust rect for all paints that may affect its geometry, then map it to device space. |
| 260 | SkIRect adjustAndMap(SkRect rect, const SkPaint* paint) const { |
| 261 | // Inverted rectangles really confuse our BBHs. |
| 262 | rect.sort(); |
| 263 | |
| 264 | // Adjust the rect for its own paint. |
| 265 | if (!AdjustForPaint(paint, &rect)) { |
| 266 | // The paint could do anything to our bounds. The only safe answer is the current clip. |
| 267 | return fCurrentClipBounds; |
mtklein | a723b57 | 2014-08-15 11:49:49 -0700 | [diff] [blame] | 268 | } |
| 269 | |
| 270 | // Adjust rect for all the paints from the SaveLayers we're inside. |
mtklein | a723b57 | 2014-08-15 11:49:49 -0700 | [diff] [blame] | 271 | for (int i = fSaveStack.count() - 1; i >= 0; i--) { |
mtklein | 479601b | 2014-08-18 08:45:33 -0700 | [diff] [blame^] | 272 | if (!AdjustForPaint(fSaveStack[i].paint, &rect)) { |
| 273 | // Same deal as above. |
| 274 | return fCurrentClipBounds; |
mtklein | a723b57 | 2014-08-15 11:49:49 -0700 | [diff] [blame] | 275 | } |
| 276 | } |
| 277 | |
| 278 | // Map the rect back to device space. |
| 279 | fCTM.mapRect(&rect); |
| 280 | SkIRect devRect; |
| 281 | rect.roundOut(&devRect); |
mtklein | 479601b | 2014-08-18 08:45:33 -0700 | [diff] [blame^] | 282 | |
| 283 | // Nothing can draw outside the current clip. |
| 284 | // (Only bounded ops call into this method, so oddballs like Clear don't matter here.) |
| 285 | devRect.intersect(fCurrentClipBounds); |
mtklein | a723b57 | 2014-08-15 11:49:49 -0700 | [diff] [blame] | 286 | return devRect; |
| 287 | } |
| 288 | |
| 289 | // Conservative device bounds for each op in the SkRecord. |
| 290 | SkAutoTMalloc<SkIRect> fBounds; |
| 291 | |
| 292 | // We walk fCurrentOp through the SkRecord, as we go using updateCTM() |
| 293 | // and updateClipBounds() to maintain the exact CTM (fCTM) and conservative |
| 294 | // device bounds of the current clip (fCurrentClipBounds). |
mtklein | 828ce1f | 2014-08-13 12:58:45 -0700 | [diff] [blame] | 295 | unsigned fCurrentOp; |
mtklein | a723b57 | 2014-08-15 11:49:49 -0700 | [diff] [blame] | 296 | SkMatrix fCTM; |
| 297 | SkIRect fCurrentClipBounds; |
| 298 | |
| 299 | // Used to track the bounds of Save/Restore blocks and the control ops inside them. |
mtklein | 828ce1f | 2014-08-13 12:58:45 -0700 | [diff] [blame] | 300 | SkTDArray<SaveBounds> fSaveStack; |
| 301 | SkTDArray<unsigned> fControlIndices; |
mtklein | 5ad6ee1 | 2014-08-11 08:08:43 -0700 | [diff] [blame] | 302 | }; |
| 303 | |
commit-bot@chromium.org | 27f6b0d | 2014-05-09 14:59:29 +0000 | [diff] [blame] | 304 | } // namespace SkRecords |
mtklein | 5ad6ee1 | 2014-08-11 08:08:43 -0700 | [diff] [blame] | 305 | |
| 306 | void SkRecordFillBounds(const SkRecord& record, SkBBoxHierarchy* bbh) { |
mtklein | 828ce1f | 2014-08-13 12:58:45 -0700 | [diff] [blame] | 307 | SkRecords::FillBounds(record, bbh); |
mtklein | 5ad6ee1 | 2014-08-11 08:08:43 -0700 | [diff] [blame] | 308 | } |