зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1824025 - transformed patterns may be blurry r=jfkthame a=reland
Differential Revision: https://phabricator.services.mozilla.com/D173545
This commit is contained in:
Родитель
31ed1c67cc
Коммит
9ce9208392
|
@ -0,0 +1,20 @@
|
|||
<svg width="800" height="500" xmlns="http://www.w3.org/2000/svg">
|
||||
|
||||
<text x="25" y="25">Both patterns should render without blurriness</text>
|
||||
|
||||
<pattern id="pattern1" viewBox="0 0 100 20" width="100" height="20"
|
||||
patternUnits="userSpaceOnUse">
|
||||
<circle r="2" cx="10" cy="10" fill="green"/>
|
||||
<circle r="4" cx="30" cy="10" fill="green"/>
|
||||
<circle r="6" cx="50" cy="10" fill="green"/>
|
||||
<circle r="8" cx="70" cy="10" fill="green"/>
|
||||
<circle r="10" cx="90" cy="10" fill="green"/>
|
||||
</pattern>
|
||||
|
||||
<circle r="150" cx="200" cy="200" stroke="gray" fill="none"/>
|
||||
<circle r="150" cx="200" cy="200" fill="url(#pattern1)"/>
|
||||
|
||||
<circle r="150" cx="600" cy="200" stroke="gray" fill="none"/>
|
||||
<circle r="150" cx="600" cy="200" fill="url(#pattern1)"/>
|
||||
|
||||
</svg>
|
После Ширина: | Высота: | Размер: 773 B |
|
@ -0,0 +1,29 @@
|
|||
<svg width="800" height="500" xmlns="http://www.w3.org/2000/svg">
|
||||
|
||||
<text x="25" y="25">Both patterns should render without blurriness</text>
|
||||
|
||||
<pattern id="pattern1" viewBox="0 0 100 20" width="100" height="20"
|
||||
patternUnits="userSpaceOnUse">
|
||||
<circle r="2" cx="10" cy="10" fill="green"/>
|
||||
<circle r="4" cx="30" cy="10" fill="green"/>
|
||||
<circle r="6" cx="50" cy="10" fill="green"/>
|
||||
<circle r="8" cx="70" cy="10" fill="green"/>
|
||||
<circle r="10" cx="90" cy="10" fill="green"/>
|
||||
</pattern>
|
||||
|
||||
<circle r="150" cx="200" cy="200" stroke="gray" fill="none"/>
|
||||
<circle r="150" cx="200" cy="200" fill="url(#pattern1)"/>
|
||||
|
||||
<pattern id="pattern2" viewBox="0 0 20 100" width="20" height="100"
|
||||
patternUnits="userSpaceOnUse" patternTransform="rotate(270)">
|
||||
<circle r="2" cx="10" cy="10" fill="green"/>
|
||||
<circle r="4" cx="10" cy="30" fill="green"/>
|
||||
<circle r="6" cx="10" cy="50" fill="green"/>
|
||||
<circle r="8" cx="10" cy="70" fill="green"/>
|
||||
<circle r="10" cx="10" cy="90" fill="green"/>
|
||||
</pattern>
|
||||
|
||||
<circle r="150" cx="600" cy="200" stroke="gray" fill="none"/>
|
||||
<circle r="150" cx="600" cy="200" fill="url(#pattern2)"/>
|
||||
|
||||
</svg>
|
После Ширина: | Высота: | Размер: 1.1 KiB |
|
@ -394,11 +394,12 @@ fuzzy(0-128,0-100) == pattern-big-image.html pattern-big-image-ref.html
|
|||
fuzzy(0-1,0-5) == pattern-live-01a.svg pattern-live-01-ref.svg
|
||||
fuzzy(0-1,0-5) == pattern-live-01b.svg pattern-live-01-ref.svg
|
||||
fuzzy(0-1,0-5) == pattern-live-01c.svg pattern-live-01-ref.svg
|
||||
fuzzy(0-1,0-5) == pattern-scale-01a.svg pattern-scale-01-ref.svg
|
||||
== pattern-scale-01a.svg pattern-scale-01-ref.svg
|
||||
== pattern-scale-01b.svg pattern-scale-01-ref.svg
|
||||
fuzzy(0-3,0-5) == pattern-scale-01c.svg pattern-scale-01-ref.svg
|
||||
fuzzy(0-2,0-227) == pattern-transform-presence-01.svg pattern-transform-presence-01-ref.svg
|
||||
fuzzy(0-72,0-1255) == pattern-transformed-01.svg pattern-transformed-01-ref.svg
|
||||
== pattern-scale-01c.svg pattern-scale-01-ref.svg
|
||||
== pattern-transform-presence-01.svg pattern-transform-presence-01-ref.svg
|
||||
fuzzy(0-67,0-805) == pattern-transformed-01.svg pattern-transformed-01-ref.svg
|
||||
fuzzy(0-17,0-2375) == pattern-transformed-02.svg pattern-transformed-02-ref.svg
|
||||
|
||||
== polygon-01.svg polygon-01-ref.svg
|
||||
== polygon-marker-01.svg pass.svg
|
||||
|
|
|
@ -304,12 +304,11 @@ already_AddRefed<SourceSurface> SVGPatternFrame::PaintPattern(
|
|||
|
||||
// Now that we have all of the necessary geometries, we can
|
||||
// create our surface.
|
||||
gfxRect transformedBBox =
|
||||
ThebesRect(patternTransform.TransformBounds(ToRect(bbox)));
|
||||
gfxSize scaledSize = bbox.Size() * MaxExpansion(patternTransform);
|
||||
|
||||
bool resultOverflows;
|
||||
IntSize surfaceSize =
|
||||
SVGUtils::ConvertToSurfaceSize(transformedBBox.Size(), &resultOverflows);
|
||||
SVGUtils::ConvertToSurfaceSize(scaledSize, &resultOverflows);
|
||||
|
||||
// 0 disables rendering, < 0 is an error
|
||||
if (surfaceSize.width <= 0 || surfaceSize.height <= 0) {
|
||||
|
@ -322,9 +321,8 @@ already_AddRefed<SourceSurface> SVGPatternFrame::PaintPattern(
|
|||
if (resultOverflows || patternWidth != surfaceSize.width ||
|
||||
patternHeight != surfaceSize.height) {
|
||||
// scale drawing to pattern surface size
|
||||
gfxMatrix tempTM = gfxMatrix(surfaceSize.width / patternWidth, 0.0, 0.0,
|
||||
surfaceSize.height / patternHeight, 0.0, 0.0);
|
||||
patternWithChildren->mCTM->PreMultiply(tempTM);
|
||||
patternWithChildren->mCTM->PreScale(surfaceSize.width / patternWidth,
|
||||
surfaceSize.height / patternHeight);
|
||||
|
||||
// and rescale pattern to compensate
|
||||
patternMatrix->PreScale(patternWidth / surfaceSize.width,
|
||||
|
|
Загрузка…
Ссылка в новой задаче