SVG linear gradient not rotated

RESOLVED FIXED

Status

()

Core
SVG
RESOLVED FIXED
14 years ago
14 years ago

People

(Reporter: Gildas Trebaol, Assigned: tor)

Tracking

Trunk
x86
Windows XP
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(1 attachment, 1 obsolete attachment)

(Reporter)

Description

14 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b) Gecko/20050210
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b) Gecko/20050210

When a rotated shape uses a linear gradient,
the gradient should rotate as well

Reproducible: Always

Steps to Reproduce:
1. load the URL

Actual Results:  
The rotated trapeze contains a linear gradient with a vertical axis 

Expected Results:  
The axis of the gradient should be rotated at 120°
(Assignee)

Updated

14 years ago
Assignee: general → tor
Status: UNCONFIRMED → NEW
Ever confirmed: true
(Assignee)

Comment 1

14 years ago
Created attachment 174405 [details] [diff] [review]
correct bbox calculation, fix gdiplus matrix setup
Attachment #174405 - Flags: review?(scootermorris)
(Assignee)

Updated

14 years ago
Attachment #174405 - Attachment is obsolete: true
Attachment #174405 - Flags: review?(scootermorris)
(Assignee)

Comment 2

14 years ago
Created attachment 174422 [details] [diff] [review]
same + fix a couple trivial radial gradient bugs
Attachment #174422 - Flags: review?(scootermorris)

Comment 3

14 years ago
Comment on attachment 174422 [details] [diff] [review]
same + fix a couple trivial radial gradient bugs

Just a couple of nits....

>+
>+  nsCOMPtr<nsIDOMSVGMatrix> bboxTransform;
>+  PRUint16 bbox;
>+  GetGradientUnits(&bbox);
>+  if (bbox == nsIDOMSVGGradientElement::SVG_GRUNITS_OBJECTBOUNDINGBOX) {
>+    nsISVGChildFrame *frame = nsnull;
>+    if (aSource)
>+      CallQueryInterface(aSource, &frame);
>+    nsCOMPtr<nsIDOMSVGRect> rect;
>+    if (frame) {
>+      frame->SetMatrixPropagation(PR_FALSE);
>+      frame->NotifyCanvasTMChanged();
>+      frame->GetBBox(getter_AddRefs(rect));
>+      frame->SetMatrixPropagation(PR_TRUE);
>+      frame->NotifyCanvasTMChanged();
>+    }

Why not just include this if-block inside of the if (frame) block
above?	Then rect could be scoped inside of that block.

>+    if (rect) {
>+      float x, y, width, height;
>+      rect->GetX(&x);
>+      rect->GetY(&y);
>+      rect->GetWidth(&width);
>+      rect->GetHeight(&height);
>+      NS_NewSVGMatrix(getter_AddRefs(bboxTransform),
>+                      width, 0, 0, height, x, y);
>+    }
>+  }

>Index: layout/svg/renderer/src/gdiplus/nsSVGGDIPlusGradient.cpp
>===================================================================

Strange spacing here.  Was that intentional for some reason?

>+    rect[0].X = fX1 + INF * dy;             rect[0].Y = fY1 - INF * dx;
>     rect[1].X = fX1 + INF * dx + INF * dy;  rect[1].Y = fY1 + INF * dy - INF * dx;
>     rect[2].X = fX1 + INF * dx - INF * dy;  rect[2].Y = fY1 + INF * dy + INF * dx;
>-    rect[3].X = fX1 - INF * dy;  rect[3].Y = fY1 + INF * dx;
>+    rect[3].X = fX1 - INF * dy;             rect[3].Y = fY1 + INF * dx;
>     left.AddPolygon(rect, 4);
>     left.Transform(aMatrix);
>+    left.Transform(aCTM);
>     

Same thing here...

>+    rect[1].X = fX2 + INF * dy;             rect[1].Y = fY2 - INF * dx;
>+    rect[2].X = fX2 - INF * dy;             rect[2].Y = fY2 + INF * dx;
>     rect[3].X = fX2 - INF * dx - INF * dy;  rect[3].Y = fY2 - INF * dy + INF * dx;
>     right.AddPolygon(rect, 4);
>     right.Transform(aMatrix);
>+    right.Transform(aCTM);
>
Attachment #174422 - Flags: review?(scootermorris) → review+
(Assignee)

Comment 4

14 years ago
Checked in.
Status: NEW → RESOLVED
Last Resolved: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.