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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 DRAW(ClipRRect, clipRRect(r.rrect, r.opAA.op, r.opAA.aa)); | 85 DRAW(ClipRRect, clipRRect(r.rrect, r.opAA.op, r.opAA.aa)); |
86 DRAW(ClipRect, clipRect(r.rect, r.opAA.op, r.opAA.aa)); | 86 DRAW(ClipRect, clipRect(r.rect, r.opAA.op, r.opAA.aa)); |
87 DRAW(ClipRegion, clipRegion(r.region, r.op)); | 87 DRAW(ClipRegion, clipRegion(r.region, r.op)); |
88 | 88 |
89 #ifdef SK_EXPERIMENTAL_SHADOWING | 89 #ifdef SK_EXPERIMENTAL_SHADOWING |
90 DRAW(TranslateZ, SkCanvas::translateZ(r.z)); | 90 DRAW(TranslateZ, SkCanvas::translateZ(r.z)); |
91 #else | 91 #else |
92 template <> void Draw::draw(const TranslateZ& r) { } | 92 template <> void Draw::draw(const TranslateZ& r) { } |
93 #endif | 93 #endif |
94 | 94 |
95 DRAW(DrawBitmap, drawBitmap(r.bitmap.shallowCopy(), r.left, r.top, r.paint)); | |
96 DRAW(DrawBitmapNine, drawBitmapNine(r.bitmap.shallowCopy(), r.center, r.dst, r.p
aint)); | |
97 DRAW(DrawBitmapRect, | |
98 legacy_drawBitmapRect(r.bitmap.shallowCopy(), r.src, r.dst, r.paint, | |
99 SkCanvas::kStrict_SrcRectConstraint)); | |
100 DRAW(DrawBitmapRectFast, | |
101 legacy_drawBitmapRect(r.bitmap.shallowCopy(), r.src, r.dst, r.paint, | |
102 SkCanvas::kFast_SrcRectConstraint)); | |
103 DRAW(DrawBitmapRectFixedSize, | |
104 legacy_drawBitmapRect(r.bitmap.shallowCopy(), &r.src, r.dst, &r.paint, r
.constraint)); | |
105 DRAW(DrawDRRect, drawDRRect(r.outer, r.inner, r.paint)); | 95 DRAW(DrawDRRect, drawDRRect(r.outer, r.inner, r.paint)); |
106 DRAW(DrawImage, drawImage(r.image, r.left, r.top, r.paint)); | 96 DRAW(DrawImage, drawImage(r.image, r.left, r.top, r.paint)); |
107 DRAW(DrawImageRect, legacy_drawImageRect(r.image, r.src, r.dst, r.paint, r.const
raint)); | 97 DRAW(DrawImageRect, legacy_drawImageRect(r.image, r.src, r.dst, r.paint, r.const
raint)); |
108 DRAW(DrawImageNine, drawImageNine(r.image, r.center, r.dst, r.paint)); | 98 DRAW(DrawImageNine, drawImageNine(r.image, r.center, r.dst, r.paint)); |
109 DRAW(DrawOval, drawOval(r.oval, r.paint)); | 99 DRAW(DrawOval, drawOval(r.oval, r.paint)); |
110 DRAW(DrawPaint, drawPaint(r.paint)); | 100 DRAW(DrawPaint, drawPaint(r.paint)); |
111 DRAW(DrawPath, drawPath(r.path, r.paint)); | 101 DRAW(DrawPath, drawPath(r.path, r.paint)); |
112 DRAW(DrawPatch, drawPatch(r.cubics, r.colors, r.texCoords, r.xmode, r.paint)); | 102 DRAW(DrawPatch, drawPatch(r.cubics, r.colors, r.texCoords, r.xmode, r.paint)); |
113 DRAW(DrawPicture, drawPicture(r.picture, &r.matrix, r.paint)); | 103 DRAW(DrawPicture, drawPicture(r.picture, &r.matrix, r.paint)); |
114 | 104 |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 SkRect rect = SkRect::MakeXYWH(op.left, op.top, image->width(), image->h
eight()); | 407 SkRect rect = SkRect::MakeXYWH(op.left, op.top, image->width(), image->h
eight()); |
418 | 408 |
419 return this->adjustAndMap(rect, op.paint); | 409 return this->adjustAndMap(rect, op.paint); |
420 } | 410 } |
421 Bounds bounds(const DrawImageRect& op) const { | 411 Bounds bounds(const DrawImageRect& op) const { |
422 return this->adjustAndMap(op.dst, op.paint); | 412 return this->adjustAndMap(op.dst, op.paint); |
423 } | 413 } |
424 Bounds bounds(const DrawImageNine& op) const { | 414 Bounds bounds(const DrawImageNine& op) const { |
425 return this->adjustAndMap(op.dst, op.paint); | 415 return this->adjustAndMap(op.dst, op.paint); |
426 } | 416 } |
427 Bounds bounds(const DrawBitmapRect& op) const { | |
428 return this->adjustAndMap(op.dst, op.paint); | |
429 } | |
430 Bounds bounds(const DrawBitmapRectFast& op) const { | |
431 return this->adjustAndMap(op.dst, op.paint); | |
432 } | |
433 Bounds bounds(const DrawBitmapRectFixedSize& op) const { | |
434 return this->adjustAndMap(op.dst, &op.paint); | |
435 } | |
436 Bounds bounds(const DrawBitmapNine& op) const { | |
437 return this->adjustAndMap(op.dst, op.paint); | |
438 } | |
439 Bounds bounds(const DrawBitmap& op) const { | |
440 return this->adjustAndMap( | |
441 SkRect::MakeXYWH(op.left, op.top, op.bitmap.width(), op.bitmap.h
eight()), | |
442 op.paint); | |
443 } | |
444 | |
445 Bounds bounds(const DrawPath& op) const { | 417 Bounds bounds(const DrawPath& op) const { |
446 return op.path.isInverseFillType() ? fCurrentClipBounds | 418 return op.path.isInverseFillType() ? fCurrentClipBounds |
447 : this->adjustAndMap(op.path.getBound
s(), &op.paint); | 419 : this->adjustAndMap(op.path.getBound
s(), &op.paint); |
448 } | 420 } |
449 Bounds bounds(const DrawPoints& op) const { | 421 Bounds bounds(const DrawPoints& op) const { |
450 SkRect dst; | 422 SkRect dst; |
451 dst.set(op.pts, op.count); | 423 dst.set(op.pts, op.count); |
452 | 424 |
453 // Pad the bounding box a little to make sure hairline points' bounds ar
en't empty. | 425 // Pad the bounding box a little to make sure hairline points' bounds ar
en't empty. |
454 SkScalar stroke = SkMaxScalar(op.paint.getStrokeWidth(), 0.01f); | 426 SkScalar stroke = SkMaxScalar(op.paint.getStrokeWidth(), 0.01f); |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 | 601 |
630 void SkRecordFillBounds(const SkRect& cullRect, const SkRecord& record, SkRect b
ounds[]) { | 602 void SkRecordFillBounds(const SkRect& cullRect, const SkRecord& record, SkRect b
ounds[]) { |
631 SkRecords::FillBounds visitor(cullRect, record, bounds); | 603 SkRecords::FillBounds visitor(cullRect, record, bounds); |
632 for (int curOp = 0; curOp < record.count(); curOp++) { | 604 for (int curOp = 0; curOp < record.count(); curOp++) { |
633 visitor.setCurrentOp(curOp); | 605 visitor.setCurrentOp(curOp); |
634 record.visit(curOp, visitor); | 606 record.visit(curOp, visitor); |
635 } | 607 } |
636 visitor.cleanUp(); | 608 visitor.cleanUp(); |
637 } | 609 } |
638 | 610 |
OLD | NEW |