aboutsummaryrefslogtreecommitdiff
path: root/src/win/native/window_d2d_painter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/win/native/window_d2d_painter.cpp')
-rw-r--r--src/win/native/window_d2d_painter.cpp21
1 files changed, 6 insertions, 15 deletions
diff --git a/src/win/native/window_d2d_painter.cpp b/src/win/native/window_d2d_painter.cpp
index ab74a964..023559f4 100644
--- a/src/win/native/window_d2d_painter.cpp
+++ b/src/win/native/window_d2d_painter.cpp
@@ -9,25 +9,16 @@
namespace cru::platform::native::win {
using namespace cru::platform::graph::win::direct;
-WindowD2DPainter::WindowD2DPainter(WinNativeWindow* window)
- : D2DPainter(window->GetWindowRenderTarget()
- ->GetDirectFactory()
- ->GetD2D1DeviceContext()),
- window_(window) {
- window->GetWindowRenderTarget()->SetAsTarget();
- window->GetWindowRenderTarget()
- ->GetDirectFactory()
- ->GetD2D1DeviceContext()
- ->BeginDraw();
+WindowD2DPainter::WindowD2DPainter(WindowRenderTarget* render_target)
+ : D2DPainter(render_target->GetD2D1DeviceContext()),
+ render_target_(render_target) {
+ render_target_->GetD2D1DeviceContext()->BeginDraw();
}
WindowD2DPainter::~WindowD2DPainter() { EndDraw(); }
void WindowD2DPainter::DoEndDraw() {
- ThrowIfFailed(window_->GetWindowRenderTarget()
- ->GetDirectFactory()
- ->GetD2D1DeviceContext()
- ->EndDraw());
- window_->GetWindowRenderTarget()->Present();
+ ThrowIfFailed(render_target_->GetD2D1DeviceContext()->EndDraw());
+ render_target_->Present();
}
} // namespace cru::platform::native::win