зеркало из https://github.com/mozilla/pjs.git
Bug 697057 - Patterns are blurred when the element is scaled. r=dholbert
--HG-- rename : layout/reftests/svg/pattern-scale-01.svg => layout/reftests/svg/pattern-scale-01a.svg
This commit is contained in:
Родитель
903c1e295e
Коммит
1849aca068
До Ширина: | Высота: | Размер: 531 B После Ширина: | Высота: | Размер: 531 B |
|
@ -0,0 +1,15 @@
|
|||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<pattern id="pattern" width="1" height="1" patternUnits="userSpaceOnUse">
|
||||
<circle cx="0.5" cy="0.5" r="0.5" fill="lime" />
|
||||
</pattern>
|
||||
</defs>
|
||||
<g transform="scale(200)">
|
||||
<rect width="1" height="1" fill="url(#pattern)" />
|
||||
</g>
|
||||
<circle cx="100" cy="100" r="100" fill="none" stroke="lime" stroke-width="2" shape-rendering="crispEdges" />
|
||||
</svg>
|
После Ширина: | Высота: | Размер: 535 B |
|
@ -180,7 +180,8 @@ random-if(gtk2Widget) == objectBoundingBox-and-fePointLight-02.svg objectBoundin
|
|||
== pattern-live-01a.svg pattern-live-01-ref.svg
|
||||
== pattern-live-01b.svg pattern-live-01-ref.svg
|
||||
== pattern-live-01c.svg pattern-live-01-ref.svg
|
||||
== pattern-scale-01.svg pattern-scale-01-ref.svg
|
||||
== pattern-scale-01a.svg pattern-scale-01-ref.svg
|
||||
== pattern-scale-01b.svg pattern-scale-01-ref.svg
|
||||
== pattern-transform-presence-01.svg pattern-transform-presence-01-ref.svg
|
||||
== polygon-marker-01.svg pass.svg
|
||||
== polygon-points-negative-01.svg pass.svg
|
||||
|
|
|
@ -250,20 +250,24 @@ nsSVGPatternFrame::PaintPattern(gfxASurface** surface,
|
|||
// box for the pattern tile.
|
||||
gfxRect bbox = GetPatternRect(callerBBox, callerCTM, aSource);
|
||||
|
||||
// Get the pattern transform
|
||||
gfxMatrix patternTransform = GetPatternTransform();
|
||||
|
||||
// Get the transformation matrix that we will hand to the renderer's pattern
|
||||
// routine.
|
||||
*patternMatrix = GetPatternMatrix(bbox, callerBBox, callerCTM);
|
||||
*patternMatrix = GetPatternMatrix(patternTransform,
|
||||
bbox, callerBBox, callerCTM);
|
||||
|
||||
// Now that we have all of the necessary geometries, we can
|
||||
// create our surface.
|
||||
float patternWidth = bbox.Width();
|
||||
float patternHeight = bbox.Height();
|
||||
gfxFloat patternWidth = bbox.Width();
|
||||
gfxFloat patternHeight = bbox.Height();
|
||||
|
||||
bool resultOverflows;
|
||||
gfxIntSize surfaceSize =
|
||||
nsSVGUtils::ConvertToSurfaceSize(
|
||||
gfxSize(patternWidth * fabs(patternMatrix->xx),
|
||||
patternHeight * fabs(patternMatrix->yy)),
|
||||
gfxSize(patternWidth * fabs(patternTransform.xx),
|
||||
patternHeight * fabs(patternTransform.yy)),
|
||||
&resultOverflows);
|
||||
|
||||
// 0 disables rendering, < 0 is an error
|
||||
|
@ -607,17 +611,17 @@ nsSVGPatternFrame::ConstructCTM(const gfxRect &callerBBox,
|
|||
return tm * tCTM;
|
||||
}
|
||||
|
||||
// Given the matrix for the pattern element's own transform, this returns a
|
||||
// combined matrix including the transforms applicable to its target.
|
||||
gfxMatrix
|
||||
nsSVGPatternFrame::GetPatternMatrix(const gfxRect &bbox,
|
||||
nsSVGPatternFrame::GetPatternMatrix(const gfxMatrix &patternTransform,
|
||||
const gfxRect &bbox,
|
||||
const gfxRect &callerBBox,
|
||||
const gfxMatrix &callerCTM)
|
||||
{
|
||||
// Get the pattern transform
|
||||
gfxMatrix patternTransform = GetPatternTransform();
|
||||
|
||||
// We really want the pattern matrix to handle translations
|
||||
float minx = bbox.X();
|
||||
float miny = bbox.Y();
|
||||
gfxFloat minx = bbox.X();
|
||||
gfxFloat miny = bbox.Y();
|
||||
|
||||
PRUint16 type = GetEnumValue(nsSVGPatternElement::PATTERNCONTENTUNITS);
|
||||
if (type == nsIDOMSVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
|
||||
|
@ -626,10 +630,11 @@ nsSVGPatternFrame::GetPatternMatrix(const gfxRect &bbox,
|
|||
}
|
||||
|
||||
float scale = 1.0f / nsSVGUtils::MaxExpansion(callerCTM);
|
||||
patternTransform.Scale(scale, scale);
|
||||
patternTransform.Translate(gfxPoint(minx, miny));
|
||||
gfxMatrix patternMatrix = patternTransform;
|
||||
patternMatrix.Scale(scale, scale);
|
||||
patternMatrix.Translate(gfxPoint(minx, miny));
|
||||
|
||||
return patternTransform;
|
||||
return patternMatrix;
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -147,7 +147,8 @@ protected:
|
|||
gfxRect GetPatternRect(const gfxRect &bbox,
|
||||
const gfxMatrix &callerCTM,
|
||||
nsIFrame *aTarget);
|
||||
gfxMatrix GetPatternMatrix(const gfxRect &bbox,
|
||||
gfxMatrix GetPatternMatrix(const gfxMatrix &patternTransform,
|
||||
const gfxRect &bbox,
|
||||
const gfxRect &callerBBox,
|
||||
const gfxMatrix &callerCTM);
|
||||
gfxMatrix ConstructCTM(const gfxRect &callerBBox,
|
||||
|
|
Загрузка…
Ссылка в новой задаче