| 759 | } // namespace |
| 760 | |
| 761 | void StreamableStack::drawTo(const Surface& s) const { |
| 762 | Box bounds = Box::Intersect(s.clip_box(), extents_.translate(s.dx(), s.dy())); |
| 763 | if (bounds.empty()) return; |
| 764 | std::vector<internal::BufferingStream> streams; |
| 765 | std::vector<BlendingMode> blending_modes; |
| 766 | Composition composition(bounds); |
| 767 | for (const auto& input : inputs_) { |
| 768 | Box extents = |
| 769 | Box::Intersect(input.extents(), bounds.translate(-s.dx(), -s.dy())); |
| 770 | if (composition.Add(extents.translate(s.dx(), s.dy()), |
| 771 | input.blending_mode())) { |
| 772 | streams.emplace_back(input.createStream(extents), extents.area()); |
| 773 | } else { |
| 774 | streams.emplace_back(nullptr, 0); |
| 775 | } |
| 776 | blending_modes.push_back(input.blending_mode()); |
| 777 | } |
| 778 | |
| 779 | Program prg; |
| 780 | composition.Compile(&prg); |
| 781 | Engine engine(&prg); |
| 782 | if (s.fill_mode() == FillMode::kExtents) { |
| 783 | WriteRect(&engine, bounds, &*streams.begin(), &*blending_modes.begin(), s); |
| 784 | } else { |
| 785 | WriteVisible(&engine, bounds, &*streams.begin(), &*blending_modes.begin(), |
| 786 | s); |
| 787 | } |
| 788 | } |
| 789 | |
| 790 | std::unique_ptr<PixelStream> StreamableStack::createStream() const { |
| 791 | Box bounds = extents(); |
nothing calls this directly
no test coverage detected