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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 DRAW(ClipRRect, clipRRect(r.rrect, r.opAA.op, r.opAA.aa)); | 88 DRAW(ClipRRect, clipRRect(r.rrect, r.opAA.op, r.opAA.aa)); |
89 DRAW(ClipRect, clipRect(r.rect, r.opAA.op, r.opAA.aa)); | 89 DRAW(ClipRect, clipRect(r.rect, r.opAA.op, r.opAA.aa)); |
90 DRAW(ClipRegion, clipRegion(r.region, r.op)); | 90 DRAW(ClipRegion, clipRegion(r.region, r.op)); |
91 | 91 |
92 #ifdef SK_EXPERIMENTAL_SHADOWING | 92 #ifdef SK_EXPERIMENTAL_SHADOWING |
93 DRAW(TranslateZ, SkCanvas::translateZ(r.z)); | 93 DRAW(TranslateZ, SkCanvas::translateZ(r.z)); |
94 #else | 94 #else |
95 template <> void Draw::draw(const TranslateZ& r) { } | 95 template <> void Draw::draw(const TranslateZ& r) { } |
96 #endif | 96 #endif |
97 | 97 |
| 98 DRAW(DrawArc, drawArc(r.oval, r.startAngle, r.sweepAngle, r.useCenter, r.paint))
; |
98 DRAW(DrawDRRect, drawDRRect(r.outer, r.inner, r.paint)); | 99 DRAW(DrawDRRect, drawDRRect(r.outer, r.inner, r.paint)); |
99 DRAW(DrawImage, drawImage(r.image.get(), r.left, r.top, r.paint)); | 100 DRAW(DrawImage, drawImage(r.image.get(), r.left, r.top, r.paint)); |
100 | 101 |
101 template <> void Draw::draw(const DrawImageLattice& r) { | 102 template <> void Draw::draw(const DrawImageLattice& r) { |
102 SkCanvas::Lattice lattice; | 103 SkCanvas::Lattice lattice; |
103 lattice.fXCount = r.xCount; | 104 lattice.fXCount = r.xCount; |
104 lattice.fXDivs = r.xDivs; | 105 lattice.fXDivs = r.xDivs; |
105 lattice.fYCount = r.yCount; | 106 lattice.fYCount = r.yCount; |
106 lattice.fYDivs = r.yDivs; | 107 lattice.fYDivs = r.yDivs; |
107 fCanvas->drawImageLattice(r.image.get(), lattice, r.dst, r.paint); | 108 fCanvas->drawImageLattice(r.image.get(), lattice, r.dst, r.paint); |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 } | 404 } |
404 | 405 |
405 // FIXME: this method could use better bounds | 406 // FIXME: this method could use better bounds |
406 Bounds bounds(const DrawText&) const { return fCurrentClipBounds; } | 407 Bounds bounds(const DrawText&) const { return fCurrentClipBounds; } |
407 | 408 |
408 Bounds bounds(const DrawPaint&) const { return fCurrentClipBounds; } | 409 Bounds bounds(const DrawPaint&) const { return fCurrentClipBounds; } |
409 Bounds bounds(const NoOp&) const { return Bounds::MakeEmpty(); } // NoOp
s don't draw. | 410 Bounds bounds(const NoOp&) const { return Bounds::MakeEmpty(); } // NoOp
s don't draw. |
410 | 411 |
411 Bounds bounds(const DrawRect& op) const { return this->adjustAndMap(op.rect,
&op.paint); } | 412 Bounds bounds(const DrawRect& op) const { return this->adjustAndMap(op.rect,
&op.paint); } |
412 Bounds bounds(const DrawOval& op) const { return this->adjustAndMap(op.oval,
&op.paint); } | 413 Bounds bounds(const DrawOval& op) const { return this->adjustAndMap(op.oval,
&op.paint); } |
| 414 // Tighter arc bounds? |
| 415 Bounds bounds(const DrawArc& op) const { return this->adjustAndMap(op.oval,
&op.paint); } |
413 Bounds bounds(const DrawRRect& op) const { | 416 Bounds bounds(const DrawRRect& op) const { |
414 return this->adjustAndMap(op.rrect.rect(), &op.paint); | 417 return this->adjustAndMap(op.rrect.rect(), &op.paint); |
415 } | 418 } |
416 Bounds bounds(const DrawDRRect& op) const { | 419 Bounds bounds(const DrawDRRect& op) const { |
417 return this->adjustAndMap(op.outer.rect(), &op.paint); | 420 return this->adjustAndMap(op.outer.rect(), &op.paint); |
418 } | 421 } |
419 Bounds bounds(const DrawImage& op) const { | 422 Bounds bounds(const DrawImage& op) const { |
420 const SkImage* image = op.image.get(); | 423 const SkImage* image = op.image.get(); |
421 SkRect rect = SkRect::MakeXYWH(op.left, op.top, image->width(), image->h
eight()); | 424 SkRect rect = SkRect::MakeXYWH(op.left, op.top, image->width(), image->h
eight()); |
422 | 425 |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 | 621 |
619 void SkRecordFillBounds(const SkRect& cullRect, const SkRecord& record, SkRect b
ounds[]) { | 622 void SkRecordFillBounds(const SkRect& cullRect, const SkRecord& record, SkRect b
ounds[]) { |
620 SkRecords::FillBounds visitor(cullRect, record, bounds); | 623 SkRecords::FillBounds visitor(cullRect, record, bounds); |
621 for (int curOp = 0; curOp < record.count(); curOp++) { | 624 for (int curOp = 0; curOp < record.count(); curOp++) { |
622 visitor.setCurrentOp(curOp); | 625 visitor.setCurrentOp(curOp); |
623 record.visit(curOp, visitor); | 626 record.visit(curOp, visitor); |
624 } | 627 } |
625 visitor.cleanUp(); | 628 visitor.cleanUp(); |
626 } | 629 } |
627 | 630 |
OLD | NEW |