зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1258650. Properly use aExtraMasksTransform when combining masks. r=Bas,a=kwierso
Previously we were ignoring the scale.
This commit is contained in:
Родитель
2439c7be30
Коммит
1b059a3417
|
@ -0,0 +1,34 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
|
||||
</head>
|
||||
<body>
|
||||
<svg height="100%" preserveAspectRatio="none meet" viewBox="0 0 1070 462" width="100%">
|
||||
<g height="462" width="1070">
|
||||
<g mask="url(#mask-1)" transform="translate(0,10)">
|
||||
<g>
|
||||
<path class="data-line" d="M30,260L61,266.5L900,266.5" fill="none" stroke="#cc0000" stroke-width="20" visibility="visible">
|
||||
</path>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<mask id="mask-1">
|
||||
<rect fill="#000" height="100%" width="100%" x="0" y="0">
|
||||
</rect>
|
||||
<rect fill="#fff" height="462" width="400" x="40" y="-10">
|
||||
</rect>
|
||||
<rect fill="#fff" height="460" width="100" x="800" y="-10">
|
||||
</rect>
|
||||
<rect fill="#000" height="447" offset="164" width="60" x="164" y="0">
|
||||
</rect>
|
||||
<rect fill="#000" height="447" offset="376" width="56" x="376" y="0">
|
||||
</rect>
|
||||
</mask>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,36 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
|
||||
</head>
|
||||
<body>
|
||||
<svg height="100%" preserveAspectRatio="none meet" viewBox="0 0 1070 462" width="100%">
|
||||
<g height="462" width="1070">
|
||||
<g clip-path="url(#clip-1)" mask="url(#mask-1)" transform="translate(0,10)">
|
||||
<g>
|
||||
<path class="data-line" d="M30,260L61,266.5L900,266.5" fill="none" stroke="#cc0000" stroke-width="20" visibility="visible">
|
||||
</path>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<clipPath id="clip-1">
|
||||
<rect height="462" width="400" x="40" y="-10">
|
||||
</rect>
|
||||
<rect height="460" width="100" x="800" y="-10">
|
||||
</rect>
|
||||
</clipPath>
|
||||
<g>
|
||||
<mask id="mask-1">
|
||||
<rect fill="#fff" height="100%" width="100%" x="0" y="0">
|
||||
</rect>
|
||||
<rect fill="#000" height="447" offset="164" width="60" x="164" y="0">
|
||||
</rect>
|
||||
<rect fill="#000" height="447" offset="376" width="56" x="376" y="0">
|
||||
</rect>
|
||||
</mask>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
</body>
|
||||
</html>
|
|
@ -216,6 +216,8 @@ fuzzy-if(skiaContent,1,5) pref(svg.marker-improvements.enabled,true) == marker-o
|
|||
== mask-transformed-01.svg mask-transformed-01-ref.svg
|
||||
== mask-transformed-02.svg pass.svg
|
||||
== mask-transformed-child-01.svg mask-transformed-child-01-ref.svg
|
||||
# fuzzy because of the differences between clipPath and mask clipping
|
||||
fuzzy(27,28) == mask-and-clipPath.html mask-and-clipPath-ref.html
|
||||
pref(layout.css.masking.enabled,true) fuzzy-if(d2d||skiaContent,1,6400) == mask-type-01.svg mask-type-01-ref.svg
|
||||
pref(layout.css.masking.enabled,true) fuzzy-if(d2d||skiaContent,1,6400) == mask-type-02.svg mask-type-01-ref.svg
|
||||
pref(layout.css.masking.enabled,true) fuzzy-if(d2d||skiaContent,1,6400) == mask-type-03.svg mask-type-01-ref.svg
|
||||
|
|
|
@ -232,16 +232,20 @@ nsSVGClipPathFrame::GetClipMask(gfxContext& aReferenceContext,
|
|||
mat.Invert();
|
||||
|
||||
if (aExtraMask) {
|
||||
MOZ_ASSERT(!aExtraMasksTransform.HasNonTranslation());
|
||||
|
||||
// We could potentially due this more efficiently with OPERATOR_IN
|
||||
// but that operator does not work well on CG or D2D
|
||||
RefPtr<SourceSurface> currentMask = maskDT->Snapshot();
|
||||
Matrix transform = maskDT->GetTransform();
|
||||
maskDT->SetTransform(Matrix());
|
||||
maskDT->ClearRect(Rect(0, 0,
|
||||
devSpaceClipExtents.width,
|
||||
devSpaceClipExtents.height));
|
||||
maskDT->MaskSurface(SurfacePattern(currentMask, ExtendMode::CLAMP),
|
||||
maskDT->SetTransform(aExtraMasksTransform * transform);
|
||||
// draw currentMask with the inverse of the transform that we just so that
|
||||
// it ends up in the same spot with aExtraMask transformed by aExtraMasksTransform
|
||||
maskDT->MaskSurface(SurfacePattern(currentMask, ExtendMode::CLAMP, aExtraMasksTransform.Inverse() * ToMatrix(mat)),
|
||||
aExtraMask,
|
||||
Point(aExtraMasksTransform._31, aExtraMasksTransform._32));
|
||||
Point(0, 0));
|
||||
}
|
||||
|
||||
*aMaskTransform = ToMatrix(mat);
|
||||
|
|
Загрузка…
Ссылка в новой задаче