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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 DRAW(DrawShadowedPicture, drawShadowedPicture(r.picture.get(), &r.matrix, r.pain
t)); | 121 DRAW(DrawShadowedPicture, drawShadowedPicture(r.picture.get(), &r.matrix, r.pain
t)); |
122 #else | 122 #else |
123 template <> void Draw::draw(const DrawShadowedPicture& r) { } | 123 template <> void Draw::draw(const DrawShadowedPicture& r) { } |
124 #endif | 124 #endif |
125 | 125 |
126 DRAW(DrawPoints, drawPoints(r.mode, r.count, r.pts, r.paint)); | 126 DRAW(DrawPoints, drawPoints(r.mode, r.count, r.pts, r.paint)); |
127 DRAW(DrawPosText, drawPosText(r.text, r.byteLength, r.pos, r.paint)); | 127 DRAW(DrawPosText, drawPosText(r.text, r.byteLength, r.pos, r.paint)); |
128 DRAW(DrawPosTextH, drawPosTextH(r.text, r.byteLength, r.xpos, r.y, r.paint)); | 128 DRAW(DrawPosTextH, drawPosTextH(r.text, r.byteLength, r.xpos, r.y, r.paint)); |
129 DRAW(DrawRRect, drawRRect(r.rrect, r.paint)); | 129 DRAW(DrawRRect, drawRRect(r.rrect, r.paint)); |
130 DRAW(DrawRect, drawRect(r.rect, r.paint)); | 130 DRAW(DrawRect, drawRect(r.rect, r.paint)); |
| 131 DRAW(DrawRegion, drawRegion(r.region, r.paint)); |
131 DRAW(DrawText, drawText(r.text, r.byteLength, r.x, r.y, r.paint)); | 132 DRAW(DrawText, drawText(r.text, r.byteLength, r.x, r.y, r.paint)); |
132 DRAW(DrawTextBlob, drawTextBlob(r.blob.get(), r.x, r.y, r.paint)); | 133 DRAW(DrawTextBlob, drawTextBlob(r.blob.get(), r.x, r.y, r.paint)); |
133 DRAW(DrawTextOnPath, drawTextOnPath(r.text, r.byteLength, r.path, &r.matrix, r.p
aint)); | 134 DRAW(DrawTextOnPath, drawTextOnPath(r.text, r.byteLength, r.path, &r.matrix, r.p
aint)); |
134 DRAW(DrawTextRSXform, drawTextRSXform(r.text, r.byteLength, r.xforms, r.cull, r.
paint)); | 135 DRAW(DrawTextRSXform, drawTextRSXform(r.text, r.byteLength, r.xforms, r.cull, r.
paint)); |
135 DRAW(DrawAtlas, drawAtlas(r.atlas.get(), | 136 DRAW(DrawAtlas, drawAtlas(r.atlas.get(), |
136 r.xforms, r.texs, r.colors, r.count, r.mode, r.cull, r
.paint)); | 137 r.xforms, r.texs, r.colors, r.count, r.mode, r.cull, r
.paint)); |
137 DRAW(DrawVertices, drawVertices(r.vmode, r.vertexCount, r.vertices, r.texs, r.co
lors, | 138 DRAW(DrawVertices, drawVertices(r.vmode, r.vertexCount, r.vertices, r.texs, r.co
lors, |
138 r.xmode, r.indices, r.indexCount, r.paint)); | 139 r.xmode, r.indices, r.indexCount, r.paint)); |
139 DRAW(DrawAnnotation, drawAnnotation(r.rect, r.key.c_str(), r.value.get())); | 140 DRAW(DrawAnnotation, drawAnnotation(r.rect, r.key.c_str(), r.value.get())); |
140 #undef DRAW | 141 #undef DRAW |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 } | 407 } |
407 } | 408 } |
408 | 409 |
409 // FIXME: this method could use better bounds | 410 // FIXME: this method could use better bounds |
410 Bounds bounds(const DrawText&) const { return fCurrentClipBounds; } | 411 Bounds bounds(const DrawText&) const { return fCurrentClipBounds; } |
411 | 412 |
412 Bounds bounds(const DrawPaint&) const { return fCurrentClipBounds; } | 413 Bounds bounds(const DrawPaint&) const { return fCurrentClipBounds; } |
413 Bounds bounds(const NoOp&) const { return Bounds::MakeEmpty(); } // NoOp
s don't draw. | 414 Bounds bounds(const NoOp&) const { return Bounds::MakeEmpty(); } // NoOp
s don't draw. |
414 | 415 |
415 Bounds bounds(const DrawRect& op) const { return this->adjustAndMap(op.rect,
&op.paint); } | 416 Bounds bounds(const DrawRect& op) const { return this->adjustAndMap(op.rect,
&op.paint); } |
| 417 Bounds bounds(const DrawRegion& op) const { |
| 418 SkRect rect = SkRect::Make(op.region.getBounds()); |
| 419 return this->adjustAndMap(rect, &op.paint); |
| 420 } |
416 Bounds bounds(const DrawOval& op) const { return this->adjustAndMap(op.oval,
&op.paint); } | 421 Bounds bounds(const DrawOval& op) const { return this->adjustAndMap(op.oval,
&op.paint); } |
417 // Tighter arc bounds? | 422 // Tighter arc bounds? |
418 Bounds bounds(const DrawArc& op) const { return this->adjustAndMap(op.oval,
&op.paint); } | 423 Bounds bounds(const DrawArc& op) const { return this->adjustAndMap(op.oval,
&op.paint); } |
419 Bounds bounds(const DrawRRect& op) const { | 424 Bounds bounds(const DrawRRect& op) const { |
420 return this->adjustAndMap(op.rrect.rect(), &op.paint); | 425 return this->adjustAndMap(op.rrect.rect(), &op.paint); |
421 } | 426 } |
422 Bounds bounds(const DrawDRRect& op) const { | 427 Bounds bounds(const DrawDRRect& op) const { |
423 return this->adjustAndMap(op.outer.rect(), &op.paint); | 428 return this->adjustAndMap(op.outer.rect(), &op.paint); |
424 } | 429 } |
425 Bounds bounds(const DrawImage& op) const { | 430 Bounds bounds(const DrawImage& op) const { |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 | 629 |
625 void SkRecordFillBounds(const SkRect& cullRect, const SkRecord& record, SkRect b
ounds[]) { | 630 void SkRecordFillBounds(const SkRect& cullRect, const SkRecord& record, SkRect b
ounds[]) { |
626 SkRecords::FillBounds visitor(cullRect, record, bounds); | 631 SkRecords::FillBounds visitor(cullRect, record, bounds); |
627 for (int curOp = 0; curOp < record.count(); curOp++) { | 632 for (int curOp = 0; curOp < record.count(); curOp++) { |
628 visitor.setCurrentOp(curOp); | 633 visitor.setCurrentOp(curOp); |
629 record.visit(curOp, visitor); | 634 record.visit(curOp, visitor); |
630 } | 635 } |
631 visitor.cleanUp(); | 636 visitor.cleanUp(); |
632 } | 637 } |
633 | 638 |
OLD | NEW |