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_USE_SHADOWS |
89 DRAW(TranslateZ, SkCanvas::translateZ(r.z)); | 90 DRAW(TranslateZ, SkCanvas::translateZ(r.z)); |
| 91 #else |
| 92 template <> void Draw::draw(const TranslateZ& r) { } |
| 93 #endif |
90 | 94 |
91 DRAW(DrawBitmap, drawBitmap(r.bitmap.shallowCopy(), r.left, r.top, r.paint)); | 95 DRAW(DrawBitmap, drawBitmap(r.bitmap.shallowCopy(), r.left, r.top, r.paint)); |
92 DRAW(DrawBitmapNine, drawBitmapNine(r.bitmap.shallowCopy(), r.center, r.dst, r.p
aint)); | 96 DRAW(DrawBitmapNine, drawBitmapNine(r.bitmap.shallowCopy(), r.center, r.dst, r.p
aint)); |
93 DRAW(DrawBitmapRect, | 97 DRAW(DrawBitmapRect, |
94 legacy_drawBitmapRect(r.bitmap.shallowCopy(), r.src, r.dst, r.paint, | 98 legacy_drawBitmapRect(r.bitmap.shallowCopy(), r.src, r.dst, r.paint, |
95 SkCanvas::kStrict_SrcRectConstraint)); | 99 SkCanvas::kStrict_SrcRectConstraint)); |
96 DRAW(DrawBitmapRectFast, | 100 DRAW(DrawBitmapRectFast, |
97 legacy_drawBitmapRect(r.bitmap.shallowCopy(), r.src, r.dst, r.paint, | 101 legacy_drawBitmapRect(r.bitmap.shallowCopy(), r.src, r.dst, r.paint, |
98 SkCanvas::kFast_SrcRectConstraint)); | 102 SkCanvas::kFast_SrcRectConstraint)); |
99 DRAW(DrawBitmapRectFixedSize, | 103 DRAW(DrawBitmapRectFixedSize, |
100 legacy_drawBitmapRect(r.bitmap.shallowCopy(), &r.src, r.dst, &r.paint, r
.constraint)); | 104 legacy_drawBitmapRect(r.bitmap.shallowCopy(), &r.src, r.dst, &r.paint, r
.constraint)); |
101 DRAW(DrawDRRect, drawDRRect(r.outer, r.inner, r.paint)); | 105 DRAW(DrawDRRect, drawDRRect(r.outer, r.inner, r.paint)); |
102 DRAW(DrawImage, drawImage(r.image, r.left, r.top, r.paint)); | 106 DRAW(DrawImage, drawImage(r.image, r.left, r.top, r.paint)); |
103 DRAW(DrawImageRect, legacy_drawImageRect(r.image, r.src, r.dst, r.paint, r.const
raint)); | 107 DRAW(DrawImageRect, legacy_drawImageRect(r.image, r.src, r.dst, r.paint, r.const
raint)); |
104 DRAW(DrawImageNine, drawImageNine(r.image, r.center, r.dst, r.paint)); | 108 DRAW(DrawImageNine, drawImageNine(r.image, r.center, r.dst, r.paint)); |
105 DRAW(DrawOval, drawOval(r.oval, r.paint)); | 109 DRAW(DrawOval, drawOval(r.oval, r.paint)); |
106 DRAW(DrawPaint, drawPaint(r.paint)); | 110 DRAW(DrawPaint, drawPaint(r.paint)); |
107 DRAW(DrawPath, drawPath(r.path, r.paint)); | 111 DRAW(DrawPath, drawPath(r.path, r.paint)); |
108 DRAW(DrawPatch, drawPatch(r.cubics, r.colors, r.texCoords, r.xmode, r.paint)); | 112 DRAW(DrawPatch, drawPatch(r.cubics, r.colors, r.texCoords, r.xmode, r.paint)); |
109 DRAW(DrawPicture, drawPicture(r.picture, &r.matrix, r.paint)); | 113 DRAW(DrawPicture, drawPicture(r.picture, &r.matrix, r.paint)); |
| 114 |
| 115 #ifdef SK_USE_SHADOWS |
| 116 DRAW(DrawShadowedPicture, drawShadowedPicture(r.picture, &r.matrix, r.paint)); |
| 117 #else |
| 118 template <> void Draw::draw(const DrawShadowedPicture& r) { } |
| 119 #endif |
| 120 |
110 DRAW(DrawPoints, drawPoints(r.mode, r.count, r.pts, r.paint)); | 121 DRAW(DrawPoints, drawPoints(r.mode, r.count, r.pts, r.paint)); |
111 DRAW(DrawPosText, drawPosText(r.text, r.byteLength, r.pos, r.paint)); | 122 DRAW(DrawPosText, drawPosText(r.text, r.byteLength, r.pos, r.paint)); |
112 DRAW(DrawPosTextH, drawPosTextH(r.text, r.byteLength, r.xpos, r.y, r.paint)); | 123 DRAW(DrawPosTextH, drawPosTextH(r.text, r.byteLength, r.xpos, r.y, r.paint)); |
113 DRAW(DrawRRect, drawRRect(r.rrect, r.paint)); | 124 DRAW(DrawRRect, drawRRect(r.rrect, r.paint)); |
114 DRAW(DrawRect, drawRect(r.rect, r.paint)); | 125 DRAW(DrawRect, drawRect(r.rect, r.paint)); |
115 DRAW(DrawText, drawText(r.text, r.byteLength, r.x, r.y, r.paint)); | 126 DRAW(DrawText, drawText(r.text, r.byteLength, r.x, r.y, r.paint)); |
116 DRAW(DrawTextBlob, drawTextBlob(r.blob, r.x, r.y, r.paint)); | 127 DRAW(DrawTextBlob, drawTextBlob(r.blob, r.x, r.y, r.paint)); |
117 DRAW(DrawTextOnPath, drawTextOnPath(r.text, r.byteLength, r.path, &r.matrix, r.p
aint)); | 128 DRAW(DrawTextOnPath, drawTextOnPath(r.text, r.byteLength, r.path, &r.matrix, r.p
aint)); |
118 DRAW(DrawTextRSXform, drawTextRSXform(r.text, r.byteLength, r.xforms, r.cull, r.
paint)); | 129 DRAW(DrawTextRSXform, drawTextRSXform(r.text, r.byteLength, r.xforms, r.cull, r.
paint)); |
119 DRAW(DrawAtlas, drawAtlas(r.atlas, r.xforms, r.texs, r.colors, r.count, r.mode,
r.cull, r.paint)); | 130 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... |
465 return fCurrentClipBounds; | 476 return fCurrentClipBounds; |
466 } | 477 } |
467 } | 478 } |
468 | 479 |
469 Bounds bounds(const DrawPicture& op) const { | 480 Bounds bounds(const DrawPicture& op) const { |
470 SkRect dst = op.picture->cullRect(); | 481 SkRect dst = op.picture->cullRect(); |
471 op.matrix.mapRect(&dst); | 482 op.matrix.mapRect(&dst); |
472 return this->adjustAndMap(dst, op.paint); | 483 return this->adjustAndMap(dst, op.paint); |
473 } | 484 } |
474 | 485 |
| 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 |
475 Bounds bounds(const DrawPosText& op) const { | 492 Bounds bounds(const DrawPosText& op) const { |
476 const int N = op.paint.countText(op.text, op.byteLength); | 493 const int N = op.paint.countText(op.text, op.byteLength); |
477 if (N == 0) { | 494 if (N == 0) { |
478 return Bounds::MakeEmpty(); | 495 return Bounds::MakeEmpty(); |
479 } | 496 } |
480 | 497 |
481 SkRect dst; | 498 SkRect dst; |
482 dst.set(op.pos, N); | 499 dst.set(op.pos, N); |
483 AdjustTextForFontMetrics(&dst, op.paint); | 500 AdjustTextForFontMetrics(&dst, op.paint); |
484 return this->adjustAndMap(dst, &op.paint); | 501 return this->adjustAndMap(dst, &op.paint); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 | 629 |
613 void SkRecordFillBounds(const SkRect& cullRect, const SkRecord& record, SkRect b
ounds[]) { | 630 void SkRecordFillBounds(const SkRect& cullRect, const SkRecord& record, SkRect b
ounds[]) { |
614 SkRecords::FillBounds visitor(cullRect, record, bounds); | 631 SkRecords::FillBounds visitor(cullRect, record, bounds); |
615 for (int curOp = 0; curOp < record.count(); curOp++) { | 632 for (int curOp = 0; curOp < record.count(); curOp++) { |
616 visitor.setCurrentOp(curOp); | 633 visitor.setCurrentOp(curOp); |
617 record.visit(curOp, visitor); | 634 record.visit(curOp, visitor); |
618 } | 635 } |
619 visitor.cleanUp(); | 636 visitor.cleanUp(); |
620 } | 637 } |
621 | 638 |
OLD | NEW |