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 "SkLayerInfo.h" | 8 #include "SkLayerInfo.h" |
9 #include "SkRecordDraw.h" | 9 #include "SkRecordDraw.h" |
10 #include "SkPatchUtils.h" | 10 #include "SkPatchUtils.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 DRAW(DrawPicture, drawPicture(r.picture, &r.matrix, r.paint)); | 104 DRAW(DrawPicture, drawPicture(r.picture, &r.matrix, r.paint)); |
105 DRAW(DrawPoints, drawPoints(r.mode, r.count, r.pts, r.paint)); | 105 DRAW(DrawPoints, drawPoints(r.mode, r.count, r.pts, r.paint)); |
106 DRAW(DrawPosText, drawPosText(r.text, r.byteLength, r.pos, r.paint)); | 106 DRAW(DrawPosText, drawPosText(r.text, r.byteLength, r.pos, r.paint)); |
107 DRAW(DrawPosTextH, drawPosTextH(r.text, r.byteLength, r.xpos, r.y, r.paint)); | 107 DRAW(DrawPosTextH, drawPosTextH(r.text, r.byteLength, r.xpos, r.y, r.paint)); |
108 DRAW(DrawRRect, drawRRect(r.rrect, r.paint)); | 108 DRAW(DrawRRect, drawRRect(r.rrect, r.paint)); |
109 DRAW(DrawRect, drawRect(r.rect, r.paint)); | 109 DRAW(DrawRect, drawRect(r.rect, r.paint)); |
110 DRAW(DrawSprite, drawSprite(r.bitmap.shallowCopy(), r.left, r.top, r.paint)); | 110 DRAW(DrawSprite, drawSprite(r.bitmap.shallowCopy(), r.left, r.top, r.paint)); |
111 DRAW(DrawText, drawText(r.text, r.byteLength, r.x, r.y, r.paint)); | 111 DRAW(DrawText, drawText(r.text, r.byteLength, r.x, r.y, r.paint)); |
112 DRAW(DrawTextBlob, drawTextBlob(r.blob, r.x, r.y, r.paint)); | 112 DRAW(DrawTextBlob, drawTextBlob(r.blob, r.x, r.y, r.paint)); |
113 DRAW(DrawTextOnPath, drawTextOnPath(r.text, r.byteLength, r.path, &r.matrix, r.p
aint)); | 113 DRAW(DrawTextOnPath, drawTextOnPath(r.text, r.byteLength, r.path, &r.matrix, r.p
aint)); |
| 114 DRAW(DrawAtlas, drawAtlas(r.atlas, r.xforms, r.texs, r.colors, r.count, r.mode,
r.cull, r.paint)); |
114 DRAW(DrawVertices, drawVertices(r.vmode, r.vertexCount, r.vertices, r.texs, r.co
lors, | 115 DRAW(DrawVertices, drawVertices(r.vmode, r.vertexCount, r.vertices, r.texs, r.co
lors, |
115 r.xmode.get(), r.indices, r.indexCount, r.paint)
); | 116 r.xmode.get(), r.indices, r.indexCount, r.paint)
); |
116 #undef DRAW | 117 #undef DRAW |
117 | 118 |
118 template <> void Draw::draw(const DrawDrawable& r) { | 119 template <> void Draw::draw(const DrawDrawable& r) { |
119 SkASSERT(r.index >= 0); | 120 SkASSERT(r.index >= 0); |
120 SkASSERT(r.index < fDrawableCount); | 121 SkASSERT(r.index < fDrawableCount); |
121 if (fDrawables) { | 122 if (fDrawables) { |
122 SkASSERT(NULL == fDrawablePicts); | 123 SkASSERT(NULL == fDrawablePicts); |
123 fCanvas->drawDrawable(fDrawables[r.index]); | 124 fCanvas->drawDrawable(fDrawables[r.index]); |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 Bounds bounds(const DrawPatch& op) const { | 445 Bounds bounds(const DrawPatch& op) const { |
445 SkRect dst; | 446 SkRect dst; |
446 dst.set(op.cubics, SkPatchUtils::kNumCtrlPts); | 447 dst.set(op.cubics, SkPatchUtils::kNumCtrlPts); |
447 return this->adjustAndMap(dst, &op.paint); | 448 return this->adjustAndMap(dst, &op.paint); |
448 } | 449 } |
449 Bounds bounds(const DrawVertices& op) const { | 450 Bounds bounds(const DrawVertices& op) const { |
450 SkRect dst; | 451 SkRect dst; |
451 dst.set(op.vertices, op.vertexCount); | 452 dst.set(op.vertices, op.vertexCount); |
452 return this->adjustAndMap(dst, &op.paint); | 453 return this->adjustAndMap(dst, &op.paint); |
453 } | 454 } |
454 | 455 |
| 456 Bounds bounds(const DrawAtlas& op) const { |
| 457 if (op.cull) { |
| 458 return this->adjustAndMap(*op.cull, op.paint); |
| 459 } else { |
| 460 return fCurrentClipBounds; |
| 461 } |
| 462 } |
| 463 |
455 Bounds bounds(const DrawPicture& op) const { | 464 Bounds bounds(const DrawPicture& op) const { |
456 SkRect dst = op.picture->cullRect(); | 465 SkRect dst = op.picture->cullRect(); |
457 op.matrix.mapRect(&dst); | 466 op.matrix.mapRect(&dst); |
458 return this->adjustAndMap(dst, op.paint); | 467 return this->adjustAndMap(dst, op.paint); |
459 } | 468 } |
460 | 469 |
461 Bounds bounds(const DrawPosText& op) const { | 470 Bounds bounds(const DrawPosText& op) const { |
462 const int N = op.paint.countText(op.text, op.byteLength); | 471 const int N = op.paint.countText(op.text, op.byteLength); |
463 if (N == 0) { | 472 if (N == 0) { |
464 return Bounds::MakeEmpty(); | 473 return Bounds::MakeEmpty(); |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 SkRecords::CollectLayers visitor(cullRect, record, pictList, data); | 800 SkRecords::CollectLayers visitor(cullRect, record, pictList, data); |
792 | 801 |
793 for (unsigned curOp = 0; curOp < record.count(); curOp++) { | 802 for (unsigned curOp = 0; curOp < record.count(); curOp++) { |
794 visitor.setCurrentOp(curOp); | 803 visitor.setCurrentOp(curOp); |
795 record.visit<void>(curOp, visitor); | 804 record.visit<void>(curOp, visitor); |
796 } | 805 } |
797 | 806 |
798 visitor.cleanUp(bbh); | 807 visitor.cleanUp(bbh); |
799 } | 808 } |
800 | 809 |
OLD | NEW |