diff options
Diffstat (limited to 'src/osx/gui/Window.mm')
-rw-r--r-- | src/osx/gui/Window.mm | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/osx/gui/Window.mm b/src/osx/gui/Window.mm index 52cc3934..239e175a 100644 --- a/src/osx/gui/Window.mm +++ b/src/osx/gui/Window.mm @@ -1,9 +1,11 @@ #include "cru/osx/gui/Window.hpp" +#include "cru/osx/graphics/quartz/Painter.hpp" #include "cru/osx/gui/UiApplication.hpp" -#include "cru/platform/gui/Base.hpp" +#include <AppKit/NSGraphicsContext.h> #include <AppKit/NSWindow.h> +#include <memory> namespace cru::platform::gui::osx { namespace details { @@ -112,6 +114,16 @@ void OsxWindow::SetWindowRect(const Rect& rect) { } } +std::unique_ptr<graphics::IPainter> OsxWindow::BeginPaint() { + NSGraphicsContext* ns_graphics_context = + [NSGraphicsContext graphicsContextWithWindow:p_->window_]; + + CGContextRef cg_context = [ns_graphics_context CGContext]; + + return std::make_unique<cru::platform::graphics::osx::quartz::QuartzCGContextPainter>( + GetUiApplication()->GetGraphicsFactory(), cg_context, true, GetClientSize()); +} + void OsxWindow::CreateWindow() { NSRect content_rect{p_->content_rect_.left, p_->content_rect_.top, p_->content_rect_.width, p_->content_rect_.height}; |