diff options
author | crupest <crupest@outlook.com> | 2020-05-23 23:50:00 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-05-23 23:50:00 +0800 |
commit | f3a8fd608a9776ef0a5f547da918a32cf6074060 (patch) | |
tree | 85b320479296ae12339ee1e28bab66ab001cb44b /src/win/graph/direct | |
parent | 75ff8a6a05afd02aaadf7e3049b0a0e305241182 (diff) | |
download | cru-f3a8fd608a9776ef0a5f547da918a32cf6074060.tar.gz cru-f3a8fd608a9776ef0a5f547da918a32cf6074060.tar.bz2 cru-f3a8fd608a9776ef0a5f547da918a32cf6074060.zip |
...
Diffstat (limited to 'src/win/graph/direct')
-rw-r--r-- | src/win/graph/direct/painter.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/win/graph/direct/painter.cpp b/src/win/graph/direct/painter.cpp index c5150ad4..df0075e0 100644 --- a/src/win/graph/direct/painter.cpp +++ b/src/win/graph/direct/painter.cpp @@ -71,6 +71,23 @@ void D2DPainter::DrawText(const Point& offset, ITextLayout* text_layout, b->GetD2DBrushInterface()); } +void D2DPainter::PushLayer(const Rect& bounds) { + CheckValidation(); + + Microsoft::WRL::ComPtr<ID2D1Layer> layer; + ThrowIfFailed(render_target_->CreateLayer(&layer)); + + render_target_->PushLayer(D2D1::LayerParameters(Convert(bounds)), + layer.Get()); + + layers_.push_back(std::move(layer)); +} + +void D2DPainter::PopLayer() { + render_target_->PopLayer(); + layers_.pop_back(); +} + void D2DPainter::EndDraw() { if (is_drawing_) { is_drawing_ = false; |