aboutsummaryrefslogtreecommitdiff
path: root/src/osx/graphics/quartz/Painter.cpp
blob: 65cf9154cf267dc3d116bf7b20d2b6b1915f5f47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include "cru/osx/graphics/quartz/Painter.hpp"

#include "cru/osx/graphics/quartz/Convert.hpp"

namespace cru::platform::graphics::osx::quartz {
  Matrix QuartzCGContextPainter::GetTransform() {
    return Convert(CGContextGetCTM(cg_context_));
  }
  
  void QuartzCGContextPainter::SetTransform(const Matrix& matrix)  {
    auto old = CGContextGetCTM(cg_context_);
    old = CGAffineTransformInvert(old);
    CGContextConcatCTM(cg_context_, old);
    CGContextConcatCTM(cg_context_, Convert(matrix));
  }
}