Closed
Bug 780880
Opened 14 years ago
Closed 14 years ago
patternTransform in SVG - rotating by 90 degrees not working
Categories
(Core :: SVG, defect)
Tracking
()
VERIFIED
FIXED
mozilla17
People
(Reporter: lmrspax, Assigned: longsonr)
References
Details
Attachments
(3 files, 2 obsolete files)
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20100101 Firefox/14.0.1
Build ID: 20120713134347
Steps to reproduce:
Make a pattern rotated with patterTransform by 90 degrees.
Make a shape filled with this pattern.
Actual results:
The shape is filled with one uniform color somehow similiar to the color of the pattern.
Expected results:
The shape should be filled with the pattern rotated by 90 degrees.
Updated•14 years ago
|
Attachment #649621 -
Attachment mime type: text/plain → text/html
Comment 1•14 years ago
|
||
Comment 2•14 years ago
|
||
Did a quick animated example and I am not sure what exactly happens since it gets so blurry
Status: UNCONFIRMED → NEW
Ever confirmed: true
Updated•14 years ago
|
Version: 14 Branch → Trunk
| Assignee | ||
Updated•14 years ago
|
Assignee: nobody → longsonr
| Assignee | ||
Comment 3•14 years ago
|
||
Attachment #649698 -
Flags: review?(dholbert)
| Assignee | ||
Comment 4•14 years ago
|
||
The double transform introduces slightly greater rounding errors so I need to increase the stroke-width of the covering circle slightly.
Comment 5•14 years ago
|
||
Comment on attachment 649698 [details] [diff] [review]
patch
>+++ b/layout/svg/base/src/nsSVGPatternFrame.cpp
> gfxIntSize surfaceSize =
> nsSVGUtils::ConvertToSurfaceSize(
>- gfxSize(patternWidth * fabs(patternTransform.xx),
>- patternHeight * fabs(patternTransform.yy)),
>+ gfxSize(patternWidth * fabs(patternTransform.xx) + patternHeight * fabs(patternTransform.xy),
>+ patternHeight * fabs(patternTransform.yy) + patternWidth * fabs(patternTransform.yx)),
> &resultOverflows);
At first glance, I don't grok what all the math inside of the gfxSize() parens is trying to do -- what's the goal there? (perhaps a comment would be helpful)
Comment 6•14 years ago
|
||
(If we're trying to get the bounding-box of a rect of size [patternWidth, patternHeight] after it's been transformed. maybe we should use gfxMatrix.TransformBounds()?)
| Assignee | ||
Comment 7•14 years ago
|
||
TransformBounds amounts to the same thing but the calculates the transformed x and y too. Since TransformBounds is tested code it does seem better to use it.
Attachment #649698 -
Attachment is obsolete: true
Attachment #649698 -
Flags: review?(dholbert)
Attachment #649842 -
Flags: review?(dholbert)
Comment 8•14 years ago
|
||
Comment on attachment 649842 [details] [diff] [review]
updated patch
>--- a/layout/svg/base/src/nsSVGPatternFrame.cpp
>+++ b/layout/svg/base/src/nsSVGPatternFrame.cpp
>@@ -305,27 +305,31 @@ nsSVGPatternFrame::PaintPattern(gfxASurf
> // Now that we have all of the necessary geometries, we can
> // create our surface.
> gfxFloat patternWidth = bbox.Width();
> gfxFloat patternHeight = bbox.Height();
>
>+ gfxRect transformedBBox = patternTransform.TransformBounds(bbox);
>+
> bool resultOverflows;
> gfxIntSize surfaceSize =
> nsSVGUtils::ConvertToSurfaceSize(
>- gfxSize(patternWidth * fabs(patternTransform.xx),
>- patternHeight * fabs(patternTransform.yy)),
>+ gfxSize(transformedBBox.Width(), transformedBBox.Height()),
> &resultOverflows);
Should be able to replace
gfxSize(transformedBBox.Width(), transformedBBox.Height())
with
transformedBBox.Size()
Also, nit: can you bump the patternWidth and patternHeight decls down lower, since we don't use them until later now?
Also, it'd be worth checking if TransformBounds() still produces the rounding-errors from comment 4 (we might not need the test-tweaks in this patch after all?)
| Assignee | ||
Comment 9•14 years ago
|
||
We do still need the test tweaks.
Attachment #649842 -
Attachment is obsolete: true
Attachment #649842 -
Flags: review?(dholbert)
Attachment #650005 -
Flags: review?(dholbert)
Comment 10•14 years ago
|
||
Comment on attachment 650005 [details] [diff] [review]
updated
Looks great, thanks! r=me
Attachment #650005 -
Flags: review?(dholbert) → review+
| Assignee | ||
Comment 11•14 years ago
|
||
Flags: in-testsuite+
Target Milestone: --- → mozilla17
Comment 12•14 years ago
|
||
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•