| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkRecordDraw.h" | 8 #include "SkRecordDraw.h" |
| 9 #include "SkPatchUtils.h" | 9 #include "SkPatchUtils.h" |
| 10 | 10 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 DRAW(Save, save()); | 79 DRAW(Save, save()); |
| 80 DRAW(SaveLayer, saveLayer(SkCanvas::SaveLayerRec(r.bounds, r.paint, r.backdrop,
r.saveLayerFlags))); | 80 DRAW(SaveLayer, saveLayer(SkCanvas::SaveLayerRec(r.bounds, r.paint, r.backdrop,
r.saveLayerFlags))); |
| 81 DRAW(SetMatrix, setMatrix(SkMatrix::Concat(fInitialCTM, r.matrix))); | 81 DRAW(SetMatrix, setMatrix(SkMatrix::Concat(fInitialCTM, r.matrix))); |
| 82 DRAW(Concat, concat(r.matrix)); | 82 DRAW(Concat, concat(r.matrix)); |
| 83 | 83 |
| 84 DRAW(ClipPath, clipPath(r.path, r.opAA.op, r.opAA.aa)); | 84 DRAW(ClipPath, clipPath(r.path, r.opAA.op, r.opAA.aa)); |
| 85 DRAW(ClipRRect, clipRRect(r.rrect, r.opAA.op, r.opAA.aa)); | 85 DRAW(ClipRRect, clipRRect(r.rrect, r.opAA.op, r.opAA.aa)); |
| 86 DRAW(ClipRect, clipRect(r.rect, r.opAA.op, r.opAA.aa)); | 86 DRAW(ClipRect, clipRect(r.rect, r.opAA.op, r.opAA.aa)); |
| 87 DRAW(ClipRegion, clipRegion(r.region, r.op)); | 87 DRAW(ClipRegion, clipRegion(r.region, r.op)); |
| 88 | 88 |
| 89 #ifdef SK_EXPERIMENTAL_SHADOWING | |
| 90 DRAW(TranslateZ, SkCanvas::translateZ(r.z)); | 89 DRAW(TranslateZ, SkCanvas::translateZ(r.z)); |
| 91 #else | |
| 92 template <> void Draw::draw(const TranslateZ& r) { } | |
| 93 #endif | |
| 94 | 90 |
| 95 DRAW(DrawBitmap, drawBitmap(r.bitmap.shallowCopy(), r.left, r.top, r.paint)); | 91 DRAW(DrawBitmap, drawBitmap(r.bitmap.shallowCopy(), r.left, r.top, r.paint)); |
| 96 DRAW(DrawBitmapNine, drawBitmapNine(r.bitmap.shallowCopy(), r.center, r.dst, r.p
aint)); | 92 DRAW(DrawBitmapNine, drawBitmapNine(r.bitmap.shallowCopy(), r.center, r.dst, r.p
aint)); |
| 97 DRAW(DrawBitmapRect, | 93 DRAW(DrawBitmapRect, |
| 98 legacy_drawBitmapRect(r.bitmap.shallowCopy(), r.src, r.dst, r.paint, | 94 legacy_drawBitmapRect(r.bitmap.shallowCopy(), r.src, r.dst, r.paint, |
| 99 SkCanvas::kStrict_SrcRectConstraint)); | 95 SkCanvas::kStrict_SrcRectConstraint)); |
| 100 DRAW(DrawBitmapRectFast, | 96 DRAW(DrawBitmapRectFast, |
| 101 legacy_drawBitmapRect(r.bitmap.shallowCopy(), r.src, r.dst, r.paint, | 97 legacy_drawBitmapRect(r.bitmap.shallowCopy(), r.src, r.dst, r.paint, |
| 102 SkCanvas::kFast_SrcRectConstraint)); | 98 SkCanvas::kFast_SrcRectConstraint)); |
| 103 DRAW(DrawBitmapRectFixedSize, | 99 DRAW(DrawBitmapRectFixedSize, |
| 104 legacy_drawBitmapRect(r.bitmap.shallowCopy(), &r.src, r.dst, &r.paint, r
.constraint)); | 100 legacy_drawBitmapRect(r.bitmap.shallowCopy(), &r.src, r.dst, &r.paint, r
.constraint)); |
| 105 DRAW(DrawDRRect, drawDRRect(r.outer, r.inner, r.paint)); | 101 DRAW(DrawDRRect, drawDRRect(r.outer, r.inner, r.paint)); |
| 106 DRAW(DrawImage, drawImage(r.image, r.left, r.top, r.paint)); | 102 DRAW(DrawImage, drawImage(r.image, r.left, r.top, r.paint)); |
| 107 DRAW(DrawImageRect, legacy_drawImageRect(r.image, r.src, r.dst, r.paint, r.const
raint)); | 103 DRAW(DrawImageRect, legacy_drawImageRect(r.image, r.src, r.dst, r.paint, r.const
raint)); |
| 108 DRAW(DrawImageNine, drawImageNine(r.image, r.center, r.dst, r.paint)); | 104 DRAW(DrawImageNine, drawImageNine(r.image, r.center, r.dst, r.paint)); |
| 109 DRAW(DrawOval, drawOval(r.oval, r.paint)); | 105 DRAW(DrawOval, drawOval(r.oval, r.paint)); |
| 110 DRAW(DrawPaint, drawPaint(r.paint)); | 106 DRAW(DrawPaint, drawPaint(r.paint)); |
| 111 DRAW(DrawPath, drawPath(r.path, r.paint)); | 107 DRAW(DrawPath, drawPath(r.path, r.paint)); |
| 112 DRAW(DrawPatch, drawPatch(r.cubics, r.colors, r.texCoords, r.xmode, r.paint)); | 108 DRAW(DrawPatch, drawPatch(r.cubics, r.colors, r.texCoords, r.xmode, r.paint)); |
| 113 DRAW(DrawPicture, drawPicture(r.picture, &r.matrix, r.paint)); | 109 DRAW(DrawPicture, drawPicture(r.picture, &r.matrix, r.paint)); |
| 114 | |
| 115 #ifdef SK_EXPERIMENTAL_SHADOWING | |
| 116 DRAW(DrawShadowedPicture, drawShadowedPicture(r.picture, &r.matrix, r.paint)); | |
| 117 #else | |
| 118 template <> void Draw::draw(const DrawShadowedPicture& r) { } | |
| 119 #endif | |
| 120 | |
| 121 DRAW(DrawPoints, drawPoints(r.mode, r.count, r.pts, r.paint)); | 110 DRAW(DrawPoints, drawPoints(r.mode, r.count, r.pts, r.paint)); |
| 122 DRAW(DrawPosText, drawPosText(r.text, r.byteLength, r.pos, r.paint)); | 111 DRAW(DrawPosText, drawPosText(r.text, r.byteLength, r.pos, r.paint)); |
| 123 DRAW(DrawPosTextH, drawPosTextH(r.text, r.byteLength, r.xpos, r.y, r.paint)); | 112 DRAW(DrawPosTextH, drawPosTextH(r.text, r.byteLength, r.xpos, r.y, r.paint)); |
| 124 DRAW(DrawRRect, drawRRect(r.rrect, r.paint)); | 113 DRAW(DrawRRect, drawRRect(r.rrect, r.paint)); |
| 125 DRAW(DrawRect, drawRect(r.rect, r.paint)); | 114 DRAW(DrawRect, drawRect(r.rect, r.paint)); |
| 126 DRAW(DrawText, drawText(r.text, r.byteLength, r.x, r.y, r.paint)); | 115 DRAW(DrawText, drawText(r.text, r.byteLength, r.x, r.y, r.paint)); |
| 127 DRAW(DrawTextBlob, drawTextBlob(r.blob, r.x, r.y, r.paint)); | 116 DRAW(DrawTextBlob, drawTextBlob(r.blob, r.x, r.y, r.paint)); |
| 128 DRAW(DrawTextOnPath, drawTextOnPath(r.text, r.byteLength, r.path, &r.matrix, r.p
aint)); | 117 DRAW(DrawTextOnPath, drawTextOnPath(r.text, r.byteLength, r.path, &r.matrix, r.p
aint)); |
| 129 DRAW(DrawTextRSXform, drawTextRSXform(r.text, r.byteLength, r.xforms, r.cull, r.
paint)); | 118 DRAW(DrawTextRSXform, drawTextRSXform(r.text, r.byteLength, r.xforms, r.cull, r.
paint)); |
| 130 DRAW(DrawAtlas, drawAtlas(r.atlas, r.xforms, r.texs, r.colors, r.count, r.mode,
r.cull, r.paint)); | 119 DRAW(DrawAtlas, drawAtlas(r.atlas, r.xforms, r.texs, r.colors, r.count, r.mode,
r.cull, r.paint)); |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 return fCurrentClipBounds; | 465 return fCurrentClipBounds; |
| 477 } | 466 } |
| 478 } | 467 } |
| 479 | 468 |
| 480 Bounds bounds(const DrawPicture& op) const { | 469 Bounds bounds(const DrawPicture& op) const { |
| 481 SkRect dst = op.picture->cullRect(); | 470 SkRect dst = op.picture->cullRect(); |
| 482 op.matrix.mapRect(&dst); | 471 op.matrix.mapRect(&dst); |
| 483 return this->adjustAndMap(dst, op.paint); | 472 return this->adjustAndMap(dst, op.paint); |
| 484 } | 473 } |
| 485 | 474 |
| 486 Bounds bounds(const DrawShadowedPicture& op) const { | |
| 487 SkRect dst = op.picture->cullRect(); | |
| 488 op.matrix.mapRect(&dst); | |
| 489 return this->adjustAndMap(dst, op.paint); | |
| 490 } | |
| 491 | |
| 492 Bounds bounds(const DrawPosText& op) const { | 475 Bounds bounds(const DrawPosText& op) const { |
| 493 const int N = op.paint.countText(op.text, op.byteLength); | 476 const int N = op.paint.countText(op.text, op.byteLength); |
| 494 if (N == 0) { | 477 if (N == 0) { |
| 495 return Bounds::MakeEmpty(); | 478 return Bounds::MakeEmpty(); |
| 496 } | 479 } |
| 497 | 480 |
| 498 SkRect dst; | 481 SkRect dst; |
| 499 dst.set(op.pos, N); | 482 dst.set(op.pos, N); |
| 500 AdjustTextForFontMetrics(&dst, op.paint); | 483 AdjustTextForFontMetrics(&dst, op.paint); |
| 501 return this->adjustAndMap(dst, &op.paint); | 484 return this->adjustAndMap(dst, &op.paint); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 | 612 |
| 630 void SkRecordFillBounds(const SkRect& cullRect, const SkRecord& record, SkRect b
ounds[]) { | 613 void SkRecordFillBounds(const SkRect& cullRect, const SkRecord& record, SkRect b
ounds[]) { |
| 631 SkRecords::FillBounds visitor(cullRect, record, bounds); | 614 SkRecords::FillBounds visitor(cullRect, record, bounds); |
| 632 for (int curOp = 0; curOp < record.count(); curOp++) { | 615 for (int curOp = 0; curOp < record.count(); curOp++) { |
| 633 visitor.setCurrentOp(curOp); | 616 visitor.setCurrentOp(curOp); |
| 634 record.visit(curOp, visitor); | 617 record.visit(curOp, visitor); |
| 635 } | 618 } |
| 636 visitor.cleanUp(); | 619 visitor.cleanUp(); |
| 637 } | 620 } |
| 638 | 621 |
| OLD | NEW |