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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
108 DRAW(DrawPicture, drawPicture(r.picture, &r.matrix, r.paint)); | 108 DRAW(DrawPicture, drawPicture(r.picture, &r.matrix, r.paint)); |
109 DRAW(DrawPoints, drawPoints(r.mode, r.count, r.pts, r.paint)); | 109 DRAW(DrawPoints, drawPoints(r.mode, r.count, r.pts, r.paint)); |
110 DRAW(DrawPosText, drawPosText(r.text, r.byteLength, r.pos, r.paint)); | 110 DRAW(DrawPosText, drawPosText(r.text, r.byteLength, r.pos, r.paint)); |
111 DRAW(DrawPosTextH, drawPosTextH(r.text, r.byteLength, r.xpos, r.y, r.paint)); | 111 DRAW(DrawPosTextH, drawPosTextH(r.text, r.byteLength, r.xpos, r.y, r.paint)); |
112 DRAW(DrawRRect, drawRRect(r.rrect, r.paint)); | 112 DRAW(DrawRRect, drawRRect(r.rrect, r.paint)); |
113 DRAW(DrawRect, drawRect(r.rect, r.paint)); | 113 DRAW(DrawRect, drawRect(r.rect, r.paint)); |
114 DRAW(DrawSprite, drawSprite(r.bitmap.shallowCopy(), r.left, r.top, r.paint)); | 114 DRAW(DrawSprite, drawSprite(r.bitmap.shallowCopy(), r.left, r.top, r.paint)); |
115 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)); |
116 DRAW(DrawTextBlob, drawTextBlob(r.blob, r.x, r.y, r.paint)); | 116 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)); | 117 DRAW(DrawTextOnPath, drawTextOnPath(r.text, r.byteLength, r.path, &r.matrix, r.p aint)); |
118 DRAW(DrawAtlas, drawAtlas(r.atlas, r.xforms, r.texs, r.colors, r.count, r.cull, r.paint)); | |
118 DRAW(DrawVertices, drawVertices(r.vmode, r.vertexCount, r.vertices, r.texs, r.co lors, | 119 DRAW(DrawVertices, drawVertices(r.vmode, r.vertexCount, r.vertices, r.texs, r.co lors, |
119 r.xmode.get(), r.indices, r.indexCount, r.paint) ); | 120 r.xmode.get(), r.indices, r.indexCount, r.paint) ); |
120 #undef DRAW | 121 #undef DRAW |
121 | 122 |
122 template <> void Draw::draw(const DrawDrawable& r) { | 123 template <> void Draw::draw(const DrawDrawable& r) { |
123 SkASSERT(r.index >= 0); | 124 SkASSERT(r.index >= 0); |
124 SkASSERT(r.index < fDrawableCount); | 125 SkASSERT(r.index < fDrawableCount); |
125 if (fDrawables) { | 126 if (fDrawables) { |
126 SkASSERT(NULL == fDrawablePicts); | 127 SkASSERT(NULL == fDrawablePicts); |
127 fCanvas->drawDrawable(fDrawables[r.index]); | 128 fCanvas->drawDrawable(fDrawables[r.index]); |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
451 Bounds bounds(const DrawPatch& op) const { | 452 Bounds bounds(const DrawPatch& op) const { |
452 SkRect dst; | 453 SkRect dst; |
453 dst.set(op.cubics, SkPatchUtils::kNumCtrlPts); | 454 dst.set(op.cubics, SkPatchUtils::kNumCtrlPts); |
454 return this->adjustAndMap(dst, &op.paint); | 455 return this->adjustAndMap(dst, &op.paint); |
455 } | 456 } |
456 Bounds bounds(const DrawVertices& op) const { | 457 Bounds bounds(const DrawVertices& op) const { |
457 SkRect dst; | 458 SkRect dst; |
458 dst.set(op.vertices, op.vertexCount); | 459 dst.set(op.vertices, op.vertexCount); |
459 return this->adjustAndMap(dst, &op.paint); | 460 return this->adjustAndMap(dst, &op.paint); |
460 } | 461 } |
461 | 462 |
463 Bounds bounds(const DrawAtlas& op) const { | |
464 if (op.cull) { | |
465 return this->adjustAndMap(*op.cull, op.paint); | |
466 } else { | |
467 return fCurrentClipBounds; | |
mtklein
2015/06/15 20:45:40
Add // We could brute force the bounds here. ?
reed1
2015/06/15 20:59:18
Agreed. Will write that. (not as cheap as just bou
| |
468 } | |
469 } | |
470 | |
462 Bounds bounds(const DrawPicture& op) const { | 471 Bounds bounds(const DrawPicture& op) const { |
463 SkRect dst = op.picture->cullRect(); | 472 SkRect dst = op.picture->cullRect(); |
464 op.matrix.mapRect(&dst); | 473 op.matrix.mapRect(&dst); |
465 return this->adjustAndMap(dst, op.paint); | 474 return this->adjustAndMap(dst, op.paint); |
466 } | 475 } |
467 | 476 |
468 Bounds bounds(const DrawPosText& op) const { | 477 Bounds bounds(const DrawPosText& op) const { |
469 const int N = op.paint.countText(op.text, op.byteLength); | 478 const int N = op.paint.countText(op.text, op.byteLength); |
470 if (N == 0) { | 479 if (N == 0) { |
471 return Bounds::MakeEmpty(); | 480 return Bounds::MakeEmpty(); |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
798 SkRecords::CollectLayers visitor(cullRect, record, pictList, data); | 807 SkRecords::CollectLayers visitor(cullRect, record, pictList, data); |
799 | 808 |
800 for (unsigned curOp = 0; curOp < record.count(); curOp++) { | 809 for (unsigned curOp = 0; curOp < record.count(); curOp++) { |
801 visitor.setCurrentOp(curOp); | 810 visitor.setCurrentOp(curOp); |
802 record.visit<void>(curOp, visitor); | 811 record.visit<void>(curOp, visitor); |
803 } | 812 } |
804 | 813 |
805 visitor.cleanUp(bbh); | 814 visitor.cleanUp(bbh); |
806 } | 815 } |
807 | 816 |
OLD | NEW |