mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 720721. Properly transform the clip path in DrawTargetCG. r=mwoodrow
This is a little tricky because we can't put a save/restore pair around the operation because then we'll loose the clip.
This commit is contained in:
parent
73a1588f02
commit
84e78d7e00
@ -43,6 +43,9 @@
|
||||
|
||||
//CG_EXTERN void CGContextSetCompositeOperation (CGContextRef, PrivateCGCompositeMode);
|
||||
|
||||
// A private API that Cairo has been using for a long time
|
||||
CG_EXTERN void CGContextSetCTM(CGContextRef, CGAffineTransform);
|
||||
|
||||
namespace mozilla {
|
||||
namespace gfx {
|
||||
|
||||
@ -923,7 +926,12 @@ DrawTargetCG::PushClipRect(const Rect &aRect)
|
||||
{
|
||||
CGContextSaveGState(mCg);
|
||||
|
||||
/* We go through a bit of trouble to temporarilly set the transform
|
||||
* while we add the path */
|
||||
CGAffineTransform previousTransform = CGContextGetCTM(mCg);
|
||||
CGContextConcatCTM(mCg, GfxMatrixToCGAffineTransform(mTransform));
|
||||
CGContextClipToRect(mCg, RectToCGRect(aRect));
|
||||
CGContextSetCTM(mCg, previousTransform);
|
||||
}
|
||||
|
||||
|
||||
@ -946,7 +954,14 @@ DrawTargetCG::PushClip(const Path *aPath)
|
||||
}
|
||||
|
||||
|
||||
/* We go through a bit of trouble to temporarilly set the transform
|
||||
* while we add the path. XXX: this could be improved if we keep
|
||||
* the CTM as resident state on the DrawTarget. */
|
||||
CGContextSaveGState(mCg);
|
||||
CGContextConcatCTM(mCg, GfxMatrixToCGAffineTransform(mTransform));
|
||||
CGContextAddPath(mCg, cgPath->GetPath());
|
||||
CGContextRestoreGState(mCg);
|
||||
|
||||
if (cgPath->GetFillRule() == FILL_EVEN_ODD)
|
||||
CGContextEOClip(mCg);
|
||||
else
|
||||
|
@ -75,3 +75,4 @@ fails-if(/Mac\x20OS\x20X\x2010\.[56]/.test(http.oscpu)) == 672646-alpha-radial-g
|
||||
|
||||
!= 693610-1.html 693610-1-notref.html # bug 693610: multiple glyph runs should not be overprinted
|
||||
|
||||
== transformed-clip.html transformed-clip-ref.html
|
||||
|
15
layout/reftests/canvas/transformed-clip-ref.html
Normal file
15
layout/reftests/canvas/transformed-clip-ref.html
Normal file
@ -0,0 +1,15 @@
|
||||
<html>
|
||||
<body>
|
||||
<canvas width="500" height="500"></canvas>
|
||||
<script>
|
||||
var canvas = document.getElementsByTagName('canvas')[0];
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
ctx.fillStyle = "red";
|
||||
ctx.beginPath();
|
||||
ctx.rect(250, 250, 50, 50);
|
||||
ctx.clip();
|
||||
ctx.fillRect(0,0,500,500);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
16
layout/reftests/canvas/transformed-clip.html
Normal file
16
layout/reftests/canvas/transformed-clip.html
Normal file
@ -0,0 +1,16 @@
|
||||
<html>
|
||||
<body>
|
||||
<canvas width="500" height="500"></canvas>
|
||||
<script>
|
||||
var canvas = document.getElementsByTagName('canvas')[0];
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
ctx.translate(500, 500);
|
||||
ctx.fillStyle = "red";
|
||||
ctx.beginPath();
|
||||
ctx.rect(-250, -250, 50, 50);
|
||||
ctx.clip();
|
||||
ctx.fillRect(-500,-500,500,500);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user