From 3ea6e49f581ef9d28cc2c3374426b5fac8627802 Mon Sep 17 00:00:00 2001 From: tsahi glik Date: Fri, 30 Aug 2013 13:27:32 -0700 Subject: iOS fix clip area in coretext context Change-Id: Ibaef9701ad4ba1bda1068c0dfa34f83c09a4e409 Reviewed-on: https://gerrit.libreoffice.org/5711 Reviewed-by: Tor Lillqvist Tested-by: Tor Lillqvist --- vcl/coretext/salgdi2.cxx | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'vcl/coretext') diff --git a/vcl/coretext/salgdi2.cxx b/vcl/coretext/salgdi2.cxx index 819d9f9d4693..cf7e7e1a3f37 100644 --- a/vcl/coretext/salgdi2.cxx +++ b/vcl/coretext/salgdi2.cxx @@ -873,6 +873,35 @@ bool SvpSalGraphics::CheckContext() CGContextScaleCTM( mrContext, 1, -1 ); } + + if (mrContext) + { + RectangleVector aRectangles; + m_aClipRegion.GetRegionRectangles(aRectangles); + + CGContextBeginPath( mrContext ); + + for(RectangleVector::const_iterator aRectIter(aRectangles.begin()); aRectIter != aRectangles.end(); aRectIter++) + { + const long nW(aRectIter->Right() - aRectIter->Left() + 1); // uses +1 logic in original + + if(nW) + { + const long nH(aRectIter->Bottom() - aRectIter->Top() + 1); // uses +1 logic in original + + if(nH) + { + CGRect aRect = {{ (CGFloat) aRectIter->Left(), (CGFloat) aRectIter->Top() }, { (CGFloat) nW, (CGFloat) nH }}; + CGContextAddRect( mrContext, aRect ); + } + } + } + + CGContextClip(mrContext); + + } + + SAL_INFO( "vcl.ios", "CheckContext: context=" << mrContext ); return ( mrContext != NULL ); -- cgit