SkRecordDraw.cpp revision 65151754b9fdb6a968d7307764c20655d1b680a0
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 8#include "SkRecordDraw.h" 9#include "SkPatchUtils.h" 10 11void SkRecordDraw(const SkRecord& record, 12 SkCanvas* canvas, 13 const SkBBoxHierarchy* bbh, 14 SkDrawPictureCallback* callback) { 15 SkAutoCanvasRestore saveRestore(canvas, true /*save now, restore at exit*/); 16 17 if (bbh) { 18 // Draw only ops that affect pixels in the canvas's current clip. 19 // The SkRecord and BBH were recorded in identity space. This canvas 20 // is not necessarily in that same space. getClipBounds() returns us 21 // this canvas' clip bounds transformed back into identity space, which 22 // lets us query the BBH. 23 SkRect query = { 0, 0, 0, 0 }; 24 (void)canvas->getClipBounds(&query); 25 26 SkTDArray<unsigned> ops; 27 bbh->search(query, &ops); 28 29 SkRecords::Draw draw(canvas); 30 for (int i = 0; i < ops.count(); i++) { 31 if (callback && callback->abortDrawing()) { 32 return; 33 } 34 record.visit<void>(ops[i], draw); 35 } 36 } else { 37 // Draw all ops. 38 SkRecords::Draw draw(canvas); 39 for (unsigned i = 0; i < record.count(); i++) { 40 if (callback && callback->abortDrawing()) { 41 return; 42 } 43 record.visit<void>(i, draw); 44 } 45 } 46} 47 48void SkRecordPartialDraw(const SkRecord& record, 49 SkCanvas* canvas, 50 const SkRect& clearRect, 51 unsigned start, unsigned stop, 52 const SkMatrix& initialCTM) { 53 SkAutoCanvasRestore saveRestore(canvas, true /*save now, restore at exit*/); 54 55 stop = SkTMin(stop, record.count()); 56 SkRecords::PartialDraw draw(canvas, clearRect, initialCTM); 57 for (unsigned i = start; i < stop; i++) { 58 record.visit<void>(i, draw); 59 } 60} 61 62namespace SkRecords { 63 64// FIXME: SkBitmaps are stateful, so we need to copy them to play back in multiple threads. 65static SkBitmap shallow_copy(const SkBitmap& bitmap) { 66 return bitmap; 67} 68 69// NoOps draw nothing. 70template <> void Draw::draw(const NoOp&) {} 71 72#define DRAW(T, call) template <> void Draw::draw(const T& r) { fCanvas->call; } 73DRAW(Restore, restore()); 74DRAW(Save, save()); 75DRAW(SaveLayer, saveLayer(r.bounds, r.paint, r.flags)); 76DRAW(PopCull, popCull()); 77DRAW(PushCull, pushCull(r.rect)); 78DRAW(Clear, clear(r.color)); 79DRAW(SetMatrix, setMatrix(SkMatrix::Concat(fInitialCTM, r.matrix))); 80 81DRAW(ClipPath, clipPath(r.path, r.op, r.doAA)); 82DRAW(ClipRRect, clipRRect(r.rrect, r.op, r.doAA)); 83DRAW(ClipRect, clipRect(r.rect, r.op, r.doAA)); 84DRAW(ClipRegion, clipRegion(r.region, r.op)); 85 86DRAW(BeginCommentGroup, beginCommentGroup(r.description)); 87DRAW(AddComment, addComment(r.key, r.value)); 88DRAW(EndCommentGroup, endCommentGroup()); 89 90DRAW(DrawBitmap, drawBitmap(shallow_copy(r.bitmap), r.left, r.top, r.paint)); 91DRAW(DrawBitmapMatrix, drawBitmapMatrix(shallow_copy(r.bitmap), r.matrix, r.paint)); 92DRAW(DrawBitmapNine, drawBitmapNine(shallow_copy(r.bitmap), r.center, r.dst, r.paint)); 93DRAW(DrawBitmapRectToRect, 94 drawBitmapRectToRect(shallow_copy(r.bitmap), r.src, r.dst, r.paint, r.flags)); 95DRAW(DrawDRRect, drawDRRect(r.outer, r.inner, r.paint)); 96DRAW(DrawImage, drawImage(r.image, r.left, r.top, r.paint)); 97DRAW(DrawImageRect, drawImageRect(r.image, r.src, r.dst, r.paint)); 98DRAW(DrawOval, drawOval(r.oval, r.paint)); 99DRAW(DrawPaint, drawPaint(r.paint)); 100DRAW(DrawPath, drawPath(r.path, r.paint)); 101DRAW(DrawPatch, drawPatch(r.cubics, r.colors, r.texCoords, r.xmode, r.paint)); 102DRAW(DrawPicture, drawPicture(r.picture, r.matrix, r.paint)); 103DRAW(DrawPoints, drawPoints(r.mode, r.count, r.pts, r.paint)); 104DRAW(DrawPosText, drawPosText(r.text, r.byteLength, r.pos, r.paint)); 105DRAW(DrawPosTextH, drawPosTextH(r.text, r.byteLength, r.xpos, r.y, r.paint)); 106DRAW(DrawRRect, drawRRect(r.rrect, r.paint)); 107DRAW(DrawRect, drawRect(r.rect, r.paint)); 108DRAW(DrawSprite, drawSprite(shallow_copy(r.bitmap), r.left, r.top, r.paint)); 109DRAW(DrawText, drawText(r.text, r.byteLength, r.x, r.y, r.paint)); 110DRAW(DrawTextBlob, drawTextBlob(r.blob, r.x, r.y, r.paint)); 111DRAW(DrawTextOnPath, drawTextOnPath(r.text, r.byteLength, r.path, r.matrix, r.paint)); 112DRAW(DrawVertices, drawVertices(r.vmode, r.vertexCount, r.vertices, r.texs, r.colors, 113 r.xmode.get(), r.indices, r.indexCount, r.paint)); 114DRAW(DrawData, drawData(r.data, r.length)); 115#undef DRAW 116 117 118// This looks silly, I know. Why not just use SkRect::MakeLargest()? 119// In practice, this is well large enough, and it has a few extra advantages: 120// it fits in an SkIRect, and we can munge it a little in both SkRect and 121// SKIRect space without worrying about overflow. 122static const SkRect kUnbounded = { -2e9f, -2e9f, 2e9f, 2e9f }; 123 124 125// This is an SkRecord visitor that fills an SkBBoxHierarchy. 126// 127// The interesting part here is how to calculate bounds for ops which don't 128// have intrinsic bounds. What is the bounds of a Save or a Translate? 129// 130// We answer this by thinking about a particular definition of bounds: if I 131// don't execute this op, pixels in this rectangle might draw incorrectly. So 132// the bounds of a Save, a Translate, a Restore, etc. are the union of the 133// bounds of Draw* ops that they might have an effect on. For any given 134// Save/Restore block, the bounds of the Save, the Restore, and any other 135// non-drawing ("control") ops inside are exactly the union of the bounds of 136// the drawing ops inside that block. 137// 138// To implement this, we keep a stack of active Save blocks. As we consume ops 139// inside the Save/Restore block, drawing ops are unioned with the bounds of 140// the block, and control ops are stashed away for later. When we finish the 141// block with a Restore, our bounds are complete, and we go back and fill them 142// in for all the control ops we stashed away. 143class FillBounds : SkNoncopyable { 144public: 145 FillBounds(const SkRecord& record, SkBBoxHierarchy* bbh) : fBounds(record.count()) { 146 // Calculate bounds for all ops. This won't go quite in order, so we'll need 147 // to store the bounds separately then feed them in to the BBH later in order. 148 fCTM = &SkMatrix::I(); 149 fCurrentClipBounds = kUnbounded; 150 for (fCurrentOp = 0; fCurrentOp < record.count(); fCurrentOp++) { 151 record.visit<void>(fCurrentOp, *this); 152 } 153 154 // If we have any lingering unpaired Saves, simulate restores to make 155 // sure all ops in those Save blocks have their bounds calculated. 156 while (!fSaveStack.isEmpty()) { 157 this->popSaveBlock(); 158 } 159 160 // Any control ops not part of any Save/Restore block draw everywhere. 161 while (!fControlIndices.isEmpty()) { 162 this->popControl(kUnbounded); 163 } 164 165 // Finally feed all stored bounds into the BBH. They'll be returned in this order. 166 SkASSERT(bbh); 167 bbh->reserve(record.count()); 168 for (unsigned i = 0; i < record.count(); i++) { 169 if (!fBounds[i].isEmpty()) { 170 bbh->insert(i, fBounds[i], true/*ok to defer*/); 171 } 172 } 173 bbh->flushDeferredInserts(); 174 } 175 176 template <typename T> void operator()(const T& op) { 177 this->updateCTM(op); 178 this->updateClipBounds(op); 179 this->trackBounds(op); 180 } 181 182private: 183 // In this file, SkRect are in local coordinates, Bounds are translated back to identity space. 184 typedef SkRect Bounds; 185 186 struct SaveBounds { 187 int controlOps; // Number of control ops in this Save block, including the Save. 188 Bounds bounds; // Bounds of everything in the block. 189 const SkPaint* paint; // Unowned. If set, adjusts the bounds of all ops in this block. 190 }; 191 192 // Only Restore and SetMatrix change the CTM. 193 template <typename T> void updateCTM(const T&) {} 194 void updateCTM(const Restore& op) { fCTM = &op.matrix; } 195 void updateCTM(const SetMatrix& op) { fCTM = &op.matrix; } 196 197 // Most ops don't change the clip. 198 template <typename T> void updateClipBounds(const T&) {} 199 200 // Clip{Path,RRect,Rect,Region} obviously change the clip. They all know their bounds already. 201 void updateClipBounds(const ClipPath& op) { this->updateClipBoundsForClipOp(op.devBounds); } 202 void updateClipBounds(const ClipRRect& op) { this->updateClipBoundsForClipOp(op.devBounds); } 203 void updateClipBounds(const ClipRect& op) { this->updateClipBoundsForClipOp(op.devBounds); } 204 void updateClipBounds(const ClipRegion& op) { this->updateClipBoundsForClipOp(op.devBounds); } 205 206 // The bounds of clip ops need to be adjusted for the paints of saveLayers they're inside. 207 void updateClipBoundsForClipOp(const SkIRect& devBounds) { 208 Bounds clip = SkRect::Make(devBounds); 209 // We don't call adjustAndMap() because as its last step it would intersect the adjusted 210 // clip bounds with the previous clip, exactly what we can't do when the clip grows. 211 fCurrentClipBounds = this->adjustForSaveLayerPaints(&clip) ? clip : kUnbounded; 212 } 213 214 // Restore holds the devBounds for the clip after the {save,saveLayer}/restore block completes. 215 void updateClipBounds(const Restore& op) { 216 // This is just like the clip ops above, but we need to skip the effects (if any) of our 217 // paired saveLayer (if it is one); it has not yet been popped off the save stack. Our 218 // devBounds reflect the state of the world after the saveLayer/restore block is done, 219 // so they are not affected by the saveLayer's paint. 220 const int kSavesToIgnore = 1; 221 Bounds clip = SkRect::Make(op.devBounds); 222 fCurrentClipBounds = 223 this->adjustForSaveLayerPaints(&clip, kSavesToIgnore) ? clip : kUnbounded; 224 } 225 226 // We also take advantage of SaveLayer bounds when present to further cut the clip down. 227 void updateClipBounds(const SaveLayer& op) { 228 if (op.bounds) { 229 // adjustAndMap() intersects these layer bounds with the previous clip for us. 230 fCurrentClipBounds = this->adjustAndMap(*op.bounds, op.paint); 231 } 232 } 233 234 // The bounds of these ops must be calculated when we hit the Restore 235 // from the bounds of the ops in the same Save block. 236 void trackBounds(const Save&) { this->pushSaveBlock(NULL); } 237 void trackBounds(const SaveLayer& op) { this->pushSaveBlock(op.paint); } 238 void trackBounds(const Restore&) { fBounds[fCurrentOp] = this->popSaveBlock(); } 239 240 void trackBounds(const SetMatrix&) { this->pushControl(); } 241 void trackBounds(const ClipRect&) { this->pushControl(); } 242 void trackBounds(const ClipRRect&) { this->pushControl(); } 243 void trackBounds(const ClipPath&) { this->pushControl(); } 244 void trackBounds(const ClipRegion&) { this->pushControl(); } 245 void trackBounds(const PushCull&) { this->pushControl(); } 246 void trackBounds(const PopCull&) { this->pushControl(); } 247 void trackBounds(const BeginCommentGroup&) { this->pushControl(); } 248 void trackBounds(const AddComment&) { this->pushControl(); } 249 void trackBounds(const EndCommentGroup&) { this->pushControl(); } 250 void trackBounds(const DrawData&) { this->pushControl(); } 251 252 // For all other ops, we can calculate and store the bounds directly now. 253 template <typename T> void trackBounds(const T& op) { 254 fBounds[fCurrentOp] = this->bounds(op); 255 this->updateSaveBounds(fBounds[fCurrentOp]); 256 } 257 258 void pushSaveBlock(const SkPaint* paint) { 259 // Starting a new Save block. Push a new entry to represent that. 260 SaveBounds sb = { 0, Bounds::MakeEmpty(), paint }; 261 fSaveStack.push(sb); 262 this->pushControl(); 263 } 264 265 static bool PaintMayAffectTransparentBlack(const SkPaint* paint) { 266 if (paint) { 267 // FIXME: this is very conservative 268 if (paint->getImageFilter() || paint->getColorFilter()) { 269 return true; 270 } 271 272 // Unusual Xfermodes require us to process a saved layer 273 // even with operations outisde the clip. 274 // For example, DstIn is used by masking layers. 275 // https://code.google.com/p/skia/issues/detail?id=1291 276 // https://crbug.com/401593 277 SkXfermode* xfermode = paint->getXfermode(); 278 SkXfermode::Mode mode; 279 // SrcOver is ok, and is also the common case with a NULL xfermode. 280 // So we should make that the fast path and bypass the mode extraction 281 // and test. 282 if (xfermode && xfermode->asMode(&mode)) { 283 switch (mode) { 284 // For each of the following transfer modes, if the source 285 // alpha is zero (our transparent black), the resulting 286 // blended alpha is not necessarily equal to the original 287 // destination alpha. 288 case SkXfermode::kClear_Mode: 289 case SkXfermode::kSrc_Mode: 290 case SkXfermode::kSrcIn_Mode: 291 case SkXfermode::kDstIn_Mode: 292 case SkXfermode::kSrcOut_Mode: 293 case SkXfermode::kDstATop_Mode: 294 case SkXfermode::kModulate_Mode: 295 return true; 296 break; 297 default: 298 break; 299 } 300 } 301 } 302 return false; 303 } 304 305 Bounds popSaveBlock() { 306 // We're done the Save block. Apply the block's bounds to all control ops inside it. 307 SaveBounds sb; 308 fSaveStack.pop(&sb); 309 310 // If the paint affects transparent black, we can't trust any of our calculated bounds. 311 const Bounds& bounds = 312 PaintMayAffectTransparentBlack(sb.paint) ? fCurrentClipBounds : sb.bounds; 313 314 while (sb.controlOps --> 0) { 315 this->popControl(bounds); 316 } 317 318 // This whole Save block may be part another Save block. 319 this->updateSaveBounds(bounds); 320 321 // If called from a real Restore (not a phony one for balance), it'll need the bounds. 322 return bounds; 323 } 324 325 void pushControl() { 326 fControlIndices.push(fCurrentOp); 327 if (!fSaveStack.isEmpty()) { 328 fSaveStack.top().controlOps++; 329 } 330 } 331 332 void popControl(const Bounds& bounds) { 333 fBounds[fControlIndices.top()] = bounds; 334 fControlIndices.pop(); 335 } 336 337 void updateSaveBounds(const Bounds& bounds) { 338 // If we're in a Save block, expand its bounds to cover these bounds too. 339 if (!fSaveStack.isEmpty()) { 340 fSaveStack.top().bounds.join(bounds); 341 } 342 } 343 344 // FIXME: this method could use better bounds 345 Bounds bounds(const DrawText&) const { return fCurrentClipBounds; } 346 347 Bounds bounds(const Clear&) const { return kUnbounded; } // Ignores the clip. 348 Bounds bounds(const DrawPaint&) const { return fCurrentClipBounds; } 349 Bounds bounds(const NoOp&) const { return Bounds::MakeEmpty(); } // NoOps don't draw. 350 351 Bounds bounds(const DrawSprite& op) const { 352 const SkBitmap& bm = op.bitmap; 353 return Bounds::MakeXYWH(op.left, op.top, bm.width(), bm.height()); // Ignores the matrix. 354 } 355 356 Bounds bounds(const DrawRect& op) const { return this->adjustAndMap(op.rect, &op.paint); } 357 Bounds bounds(const DrawOval& op) const { return this->adjustAndMap(op.oval, &op.paint); } 358 Bounds bounds(const DrawRRect& op) const { 359 return this->adjustAndMap(op.rrect.rect(), &op.paint); 360 } 361 Bounds bounds(const DrawDRRect& op) const { 362 return this->adjustAndMap(op.outer.rect(), &op.paint); 363 } 364 Bounds bounds(const DrawImage& op) const { 365 const SkImage* image = op.image; 366 SkRect rect = SkRect::MakeXYWH(op.left, op.top, image->width(), image->height()); 367 368 return this->adjustAndMap(rect, op.paint); 369 } 370 Bounds bounds(const DrawImageRect& op) const { 371 return this->adjustAndMap(op.dst, op.paint); 372 } 373 Bounds bounds(const DrawBitmapRectToRect& op) const { 374 return this->adjustAndMap(op.dst, op.paint); 375 } 376 Bounds bounds(const DrawBitmapNine& op) const { 377 return this->adjustAndMap(op.dst, op.paint); 378 } 379 Bounds bounds(const DrawBitmap& op) const { 380 const SkBitmap& bm = op.bitmap; 381 return this->adjustAndMap(SkRect::MakeXYWH(op.left, op.top, bm.width(), bm.height()), 382 op.paint); 383 } 384 Bounds bounds(const DrawBitmapMatrix& op) const { 385 const SkBitmap& bm = op.bitmap; 386 SkRect dst = SkRect::MakeWH(bm.width(), bm.height()); 387 op.matrix.mapRect(&dst); 388 return this->adjustAndMap(dst, op.paint); 389 } 390 391 Bounds bounds(const DrawPath& op) const { 392 return op.path.isInverseFillType() ? fCurrentClipBounds 393 : this->adjustAndMap(op.path.getBounds(), &op.paint); 394 } 395 Bounds bounds(const DrawPoints& op) const { 396 SkRect dst; 397 dst.set(op.pts, op.count); 398 399 // Pad the bounding box a little to make sure hairline points' bounds aren't empty. 400 SkScalar stroke = SkMaxScalar(op.paint.getStrokeWidth(), 0.01f); 401 dst.outset(stroke/2, stroke/2); 402 403 return this->adjustAndMap(dst, &op.paint); 404 } 405 Bounds bounds(const DrawPatch& op) const { 406 SkRect dst; 407 dst.set(op.cubics, SkPatchUtils::kNumCtrlPts); 408 return this->adjustAndMap(dst, &op.paint); 409 } 410 Bounds bounds(const DrawVertices& op) const { 411 SkRect dst; 412 dst.set(op.vertices, op.vertexCount); 413 return this->adjustAndMap(dst, &op.paint); 414 } 415 416 Bounds bounds(const DrawPicture& op) const { 417 SkRect dst = op.picture->cullRect(); 418 if (op.matrix) { 419 op.matrix->mapRect(&dst); 420 } 421 return this->adjustAndMap(dst, op.paint); 422 } 423 424 Bounds bounds(const DrawPosText& op) const { 425 const int N = op.paint.countText(op.text, op.byteLength); 426 if (N == 0) { 427 return Bounds::MakeEmpty(); 428 } 429 430 SkRect dst; 431 dst.set(op.pos, N); 432 AdjustTextForFontMetrics(&dst, op.paint); 433 return this->adjustAndMap(dst, &op.paint); 434 } 435 Bounds bounds(const DrawPosTextH& op) const { 436 const int N = op.paint.countText(op.text, op.byteLength); 437 if (N == 0) { 438 return Bounds::MakeEmpty(); 439 } 440 441 SkScalar left = op.xpos[0], right = op.xpos[0]; 442 for (int i = 1; i < N; i++) { 443 left = SkMinScalar(left, op.xpos[i]); 444 right = SkMaxScalar(right, op.xpos[i]); 445 } 446 SkRect dst = { left, op.y, right, op.y }; 447 AdjustTextForFontMetrics(&dst, op.paint); 448 return this->adjustAndMap(dst, &op.paint); 449 } 450 Bounds bounds(const DrawTextOnPath& op) const { 451 SkRect dst = op.path.getBounds(); 452 453 // Pad all sides by the maximum padding in any direction we'd normally apply. 454 SkRect pad = { 0, 0, 0, 0}; 455 AdjustTextForFontMetrics(&pad, op.paint); 456 457 // That maximum padding happens to always be the right pad today. 458 SkASSERT(pad.fLeft == -pad.fRight); 459 SkASSERT(pad.fTop == -pad.fBottom); 460 SkASSERT(pad.fRight > pad.fBottom); 461 dst.outset(pad.fRight, pad.fRight); 462 463 return this->adjustAndMap(dst, &op.paint); 464 } 465 466 Bounds bounds(const DrawTextBlob& op) const { 467 SkRect dst = op.blob->bounds(); 468 dst.offset(op.x, op.y); 469 return this->adjustAndMap(dst, &op.paint); 470 } 471 472 static void AdjustTextForFontMetrics(SkRect* rect, const SkPaint& paint) { 473#ifdef SK_DEBUG 474 SkRect correct = *rect; 475#endif 476 const SkScalar yPad = 2.0f * paint.getTextSize(), // In practice, this seems to be enough. 477 xPad = 4.0f * yPad; // Hack for very wide Github logo font. 478 rect->outset(xPad, yPad); 479#ifdef SK_DEBUG 480 SkPaint::FontMetrics metrics; 481 paint.getFontMetrics(&metrics); 482 correct.fLeft += metrics.fXMin; 483 correct.fTop += metrics.fTop; 484 correct.fRight += metrics.fXMax; 485 correct.fBottom += metrics.fBottom; 486 // See skia:2862 for why we ignore small text sizes. 487 SkASSERTF(paint.getTextSize() < 0.001f || rect->contains(correct), 488 "%f %f %f %f vs. %f %f %f %f\n", 489 -xPad, -yPad, +xPad, +yPad, 490 metrics.fXMin, metrics.fTop, metrics.fXMax, metrics.fBottom); 491#endif 492 } 493 494 // Returns true if rect was meaningfully adjusted for the effects of paint, 495 // false if the paint could affect the rect in unknown ways. 496 static bool AdjustForPaint(const SkPaint* paint, SkRect* rect) { 497 if (paint) { 498 if (paint->canComputeFastBounds()) { 499 *rect = paint->computeFastBounds(*rect, rect); 500 return true; 501 } 502 return false; 503 } 504 return true; 505 } 506 507 bool adjustForSaveLayerPaints(SkRect* rect, int savesToIgnore = 0) const { 508 for (int i = fSaveStack.count() - 1 - savesToIgnore; i >= 0; i--) { 509 if (!AdjustForPaint(fSaveStack[i].paint, rect)) { 510 return false; 511 } 512 } 513 return true; 514 } 515 516 // Adjust rect for all paints that may affect its geometry, then map it to identity space. 517 Bounds adjustAndMap(SkRect rect, const SkPaint* paint) const { 518 // Inverted rectangles really confuse our BBHs. 519 rect.sort(); 520 521 // Adjust the rect for its own paint. 522 if (!AdjustForPaint(paint, &rect)) { 523 // The paint could do anything to our bounds. The only safe answer is the current clip. 524 return fCurrentClipBounds; 525 } 526 527 // Adjust rect for all the paints from the SaveLayers we're inside. 528 if (!this->adjustForSaveLayerPaints(&rect)) { 529 // Same deal as above. 530 return fCurrentClipBounds; 531 } 532 533 // Map the rect back to identity space. 534 fCTM->mapRect(&rect); 535 536 // Nothing can draw outside the current clip. 537 // (Only bounded ops call into this method, so oddballs like Clear don't matter here.) 538 rect.intersect(fCurrentClipBounds); 539 return rect; 540 } 541 542 // Conservative identity-space bounds for each op in the SkRecord. 543 SkAutoTMalloc<Bounds> fBounds; 544 545 // We walk fCurrentOp through the SkRecord, as we go using updateCTM() 546 // and updateClipBounds() to maintain the exact CTM (fCTM) and conservative 547 // identity-space bounds of the current clip (fCurrentClipBounds). 548 unsigned fCurrentOp; 549 const SkMatrix* fCTM; 550 Bounds fCurrentClipBounds; 551 552 // Used to track the bounds of Save/Restore blocks and the control ops inside them. 553 SkTDArray<SaveBounds> fSaveStack; 554 SkTDArray<unsigned> fControlIndices; 555}; 556 557} // namespace SkRecords 558 559void SkRecordFillBounds(const SkRecord& record, SkBBoxHierarchy* bbh) { 560 SkRecords::FillBounds(record, bbh); 561} 562