diff options
-rw-r--r-- | include/cru/osx/graphics/quartz/Painter.hpp | 2 | ||||
-rw-r--r-- | src/osx/graphics/quartz/Painter.cpp | 11 |
2 files changed, 10 insertions, 3 deletions
diff --git a/include/cru/osx/graphics/quartz/Painter.hpp b/include/cru/osx/graphics/quartz/Painter.hpp index c88987a0..e5b8e767 100644 --- a/include/cru/osx/graphics/quartz/Painter.hpp +++ b/include/cru/osx/graphics/quartz/Painter.hpp @@ -48,7 +48,7 @@ class QuartzCGContextPainter : public OsxQuartzResource, void DrawText(const Point& offset, ITextLayout* text_layout, IBrush* brush) override; - void DrawImage(const Rect& rect, IImage* image) override; + void DrawImage(const Point& offset, IImage* image) override; void PushLayer(const Rect& bounds) override; diff --git a/src/osx/graphics/quartz/Painter.cpp b/src/osx/graphics/quartz/Painter.cpp index 3c39ec61..173cf47a 100644 --- a/src/osx/graphics/quartz/Painter.cpp +++ b/src/osx/graphics/quartz/Painter.cpp @@ -174,10 +174,17 @@ void QuartzCGContextPainter::DrawText(const Point& offset, CGContextRestoreGState(cg_context_); } -void QuartzCGContextPainter::DrawImage(const Rect& rect, IImage* image) { +void QuartzCGContextPainter::DrawImage(const Point& offset, IImage* image) { Validate(); auto i = CheckPlatform<QuartzImage>(image, GetPlatformId()); - CGContextDrawImage(cg_context_, Convert(rect), i->GetCGImage()); + + auto cg_image = i->GetCGImage(); + + auto width = CGImageGetWidth(cg_image); + auto height = CGImageGetHeight(cg_image); + + CGContextDrawImage(cg_context_, CGRectMake(offset.x, offset.y, width, height), + cg_image); } void QuartzCGContextPainter::PushLayer(const Rect& bounds) { |