diff options
Diffstat (limited to 'include/cru/win/native')
| -rw-r--r-- | include/cru/win/native/Base.hpp | 1 | ||||
| -rw-r--r-- | include/cru/win/native/Window.hpp | 6 | ||||
| -rw-r--r-- | include/cru/win/native/WindowRenderTarget.hpp | 48 |
3 files changed, 4 insertions, 51 deletions
diff --git a/include/cru/win/native/Base.hpp b/include/cru/win/native/Base.hpp index a50c6dd1..7ddc6b54 100644 --- a/include/cru/win/native/Base.hpp +++ b/include/cru/win/native/Base.hpp @@ -10,7 +10,6 @@ class WinCursor; class WinCursorManager; class WindowClass; class WindowManager; -class WindowRenderTarget; class WinNativeWindow; class WinNativeWindowResolver; class WinUiApplication; diff --git a/include/cru/win/native/Window.hpp b/include/cru/win/native/Window.hpp index 37df0768..ecc0dd04 100644 --- a/include/cru/win/native/Window.hpp +++ b/include/cru/win/native/Window.hpp @@ -4,6 +4,7 @@ #include "WindowNativeMessageEventArgs.hpp" #include "cru/platform/GraphBase.hpp" #include "cru/platform/native/Window.hpp" +#include "cru/win/graph/direct/WindowRenderTarget.hpp" #include <memory> @@ -86,7 +87,7 @@ class WinNativeWindow : public WinNativeResource, public virtual INativeWindow { bool HandleNativeWindowMessage(HWND hwnd, UINT msg, WPARAM w_param, LPARAM l_param, LRESULT* result); - WindowRenderTarget* GetWindowRenderTarget() const { + graph::win::direct::D2DWindowRenderTarget* GetWindowRenderTarget() const { return window_render_target_.get(); } @@ -157,7 +158,8 @@ class WinNativeWindow : public WinNativeResource, public virtual INativeWindow { bool has_focus_ = false; bool is_mouse_in_ = false; - std::unique_ptr<WindowRenderTarget> window_render_target_; + std::unique_ptr<graph::win::direct::D2DWindowRenderTarget> + window_render_target_; std::shared_ptr<WinCursor> cursor_; diff --git a/include/cru/win/native/WindowRenderTarget.hpp b/include/cru/win/native/WindowRenderTarget.hpp deleted file mode 100644 index 786a90a6..00000000 --- a/include/cru/win/native/WindowRenderTarget.hpp +++ /dev/null @@ -1,48 +0,0 @@ -#pragma once -#include "Base.hpp" - -namespace cru::platform::graph::win::direct { -class DirectGraphFactory; -} - -namespace cru::platform::native::win { -// Represents a window render target. -class WindowRenderTarget : public Object { - public: - WindowRenderTarget(graph::win::direct::DirectGraphFactory* factory, - WinNativeWindow* window); - - CRU_DELETE_COPY(WindowRenderTarget) - CRU_DELETE_MOVE(WindowRenderTarget) - - ~WindowRenderTarget() override = default; - - public: - graph::win::direct::DirectGraphFactory* GetDirectFactory() const { - return factory_; - } - - ID2D1DeviceContext* GetD2D1DeviceContext() { - return d2d1_device_context_.Get(); - } - - // Resize the underlying buffer. - void ResizeBuffer(int width, int height); - - // Set this render target as the d2d device context's target. - void SetAsTarget(); - - // Present the data of the underlying buffer to the window. - void Present(); - - private: - void CreateTargetBitmap(); - - private: - WinNativeWindow* window_; - graph::win::direct::DirectGraphFactory* factory_; - Microsoft::WRL::ComPtr<ID2D1DeviceContext> d2d1_device_context_; - Microsoft::WRL::ComPtr<IDXGISwapChain1> dxgi_swap_chain_; - Microsoft::WRL::ComPtr<ID2D1Bitmap1> target_bitmap_; -}; -} // namespace cru::platform::native::win |
