| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 DRAW(DrawPatch, drawPatch(r.cubics, r.colors, r.texCoords, r.xmode, r.paint)); | 107 DRAW(DrawPatch, drawPatch(r.cubics, r.colors, r.texCoords, r.xmode, r.paint)); |
| 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(DrawText, drawText(r.text, r.byteLength, r.x, r.y, r.paint)); | 114 DRAW(DrawText, drawText(r.text, r.byteLength, r.x, r.y, r.paint)); |
| 115 DRAW(DrawTextBlob, drawTextBlob(r.blob, r.x, r.y, r.paint)); | 115 DRAW(DrawTextBlob, drawTextBlob(r.blob, r.x, r.y, r.paint)); |
| 116 DRAW(DrawTextOnPath, drawTextOnPath(r.text, r.byteLength, r.path, &r.matrix, r.p
aint)); | 116 DRAW(DrawTextOnPath, drawTextOnPath(r.text, r.byteLength, r.path, &r.matrix, r.p
aint)); |
| 117 DRAW(DrawTextRSXform, drawTextRSXform(r.text, r.byteLength, r.xforms, r.cull, r.
paint)); |
| 117 DRAW(DrawAtlas, drawAtlas(r.atlas, r.xforms, r.texs, r.colors, r.count, r.mode,
r.cull, r.paint)); | 118 DRAW(DrawAtlas, drawAtlas(r.atlas, r.xforms, r.texs, r.colors, r.count, r.mode,
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, r.indices, r.indexCount, r.paint)); | 120 r.xmode, r.indices, r.indexCount, r.paint)); |
| 120 DRAW(DrawAnnotation, drawAnnotation(r.rect, r.key.c_str(), r.value)); | 121 DRAW(DrawAnnotation, drawAnnotation(r.rect, r.key.c_str(), r.value)); |
| 121 #undef DRAW | 122 #undef DRAW |
| 122 | 123 |
| 123 template <> void Draw::draw(const DrawDrawable& r) { | 124 template <> void Draw::draw(const DrawDrawable& r) { |
| 124 SkASSERT(r.index >= 0); | 125 SkASSERT(r.index >= 0); |
| 125 SkASSERT(r.index < fDrawableCount); | 126 SkASSERT(r.index < fDrawableCount); |
| 126 if (fDrawables) { | 127 if (fDrawables) { |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| 455 Bounds bounds(const DrawAtlas& op) const { | 456 Bounds bounds(const DrawAtlas& op) const { |
| 456 if (op.cull) { | 457 if (op.cull) { |
| 458 // TODO: <reed> can we pass nullptr for the paint? Isn't cull alread
y "correct" |
| 459 // for the paint (by the caller)? |
| 457 return this->adjustAndMap(*op.cull, op.paint); | 460 return this->adjustAndMap(*op.cull, op.paint); |
| 458 } else { | 461 } else { |
| 459 return fCurrentClipBounds; | 462 return fCurrentClipBounds; |
| 460 } | 463 } |
| 461 } | 464 } |
| 462 | 465 |
| 463 Bounds bounds(const DrawPicture& op) const { | 466 Bounds bounds(const DrawPicture& op) const { |
| 464 SkRect dst = op.picture->cullRect(); | 467 SkRect dst = op.picture->cullRect(); |
| 465 op.matrix.mapRect(&dst); | 468 op.matrix.mapRect(&dst); |
| 466 return this->adjustAndMap(dst, op.paint); | 469 return this->adjustAndMap(dst, op.paint); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 | 504 |
| 502 // That maximum padding happens to always be the right pad today. | 505 // That maximum padding happens to always be the right pad today. |
| 503 SkASSERT(pad.fLeft == -pad.fRight); | 506 SkASSERT(pad.fLeft == -pad.fRight); |
| 504 SkASSERT(pad.fTop == -pad.fBottom); | 507 SkASSERT(pad.fTop == -pad.fBottom); |
| 505 SkASSERT(pad.fRight > pad.fBottom); | 508 SkASSERT(pad.fRight > pad.fBottom); |
| 506 dst.outset(pad.fRight, pad.fRight); | 509 dst.outset(pad.fRight, pad.fRight); |
| 507 | 510 |
| 508 return this->adjustAndMap(dst, &op.paint); | 511 return this->adjustAndMap(dst, &op.paint); |
| 509 } | 512 } |
| 510 | 513 |
| 514 Bounds bounds(const DrawTextRSXform& op) const { |
| 515 if (op.cull) { |
| 516 return this->adjustAndMap(*op.cull, nullptr); |
| 517 } else { |
| 518 return fCurrentClipBounds; |
| 519 } |
| 520 } |
| 521 |
| 511 Bounds bounds(const DrawTextBlob& op) const { | 522 Bounds bounds(const DrawTextBlob& op) const { |
| 512 SkRect dst = op.blob->bounds(); | 523 SkRect dst = op.blob->bounds(); |
| 513 dst.offset(op.x, op.y); | 524 dst.offset(op.x, op.y); |
| 514 return this->adjustAndMap(dst, &op.paint); | 525 return this->adjustAndMap(dst, &op.paint); |
| 515 } | 526 } |
| 516 | 527 |
| 517 Bounds bounds(const DrawDrawable& op) const { | 528 Bounds bounds(const DrawDrawable& op) const { |
| 518 return this->adjustAndMap(op.worstCaseBounds, nullptr); | 529 return this->adjustAndMap(op.worstCaseBounds, nullptr); |
| 519 } | 530 } |
| 520 | 531 |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 804 | 815 |
| 805 void SkRecordComputeLayers(const SkRect& cullRect, const SkRecord& record, SkRec
t bounds[], | 816 void SkRecordComputeLayers(const SkRect& cullRect, const SkRecord& record, SkRec
t bounds[], |
| 806 const SkBigPicture::SnapshotArray* pictList, SkLayerI
nfo* data) { | 817 const SkBigPicture::SnapshotArray* pictList, SkLayerI
nfo* data) { |
| 807 SkRecords::CollectLayers visitor(cullRect, record, bounds, pictList, data); | 818 SkRecords::CollectLayers visitor(cullRect, record, bounds, pictList, data); |
| 808 for (int curOp = 0; curOp < record.count(); curOp++) { | 819 for (int curOp = 0; curOp < record.count(); curOp++) { |
| 809 visitor.setCurrentOp(curOp); | 820 visitor.setCurrentOp(curOp); |
| 810 record.visit(curOp, visitor); | 821 record.visit(curOp, visitor); |
| 811 } | 822 } |
| 812 visitor.cleanUp(); | 823 visitor.cleanUp(); |
| 813 } | 824 } |
| OLD | NEW |