Closed Bug 666097 Opened 14 years ago Closed 13 years ago

[Azure] Radial gradients in canvas don't always work as expected

Categories

(Core :: Graphics, defect)

x86
Windows 7
defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla8
Tracking Status
firefox7 + fixed

People

(Reporter: bas.schouten, Assigned: bas.schouten)

References

(Depends on 1 open bug)

Details

Attachments

(2 files, 4 obsolete files)

In Azure canvas radial gradients will behave incorrectly if the inner circle intersects with, or lies outside of the outer circle.
This patch makes Azure use special shaders to create radial gradients.
Attachment #544575 - Flags: review?(jmuizelaar)
This fixes some minor bugs.
Attachment #544575 - Attachment is obsolete: true
Attachment #544579 - Flags: review?(jmuizelaar)
Attachment #544575 - Flags: review?(jmuizelaar)
Fix another small bug.
Attachment #544579 - Attachment is obsolete: true
Attachment #544582 - Flags: review?(jmuizelaar)
Attachment #544579 - Flags: review?(jmuizelaar)
Attachment #544588 - Flags: review?(jmuizelaar)
Upload the right patch
Attachment #544582 - Attachment is obsolete: true
Attachment #544589 - Flags: review?(jmuizelaar)
Attachment #544582 - Flags: review?(jmuizelaar)
Comment on attachment 544588 [details] [diff] [review] Properly report passing Doesn't this need changes for the new tests that pass?
Comment on attachment 544589 [details] [diff] [review] Fix Azure radial gradient behavior v3 Review of attachment 544589 [details] [diff] [review]: ----------------------------------------------------------------- ::: gfx/2d/DrawTargetD2D.cpp @@ +1408,5 @@ > + rawStops.resize(stops->mStopCollection->GetGradientStopCount()); > + stops->mStopCollection->GetGradientStops(&rawStops.front(), rawStops.size()); > + > + RefPtr<ID3D10Texture1D> tex = CreateGradientTexture(rawStops); > + I'd move the stops getting into the CreateGradientTexture fucntion. @@ +1445,5 @@ > + > + mPrivateData->mEffect->GetVariableByName("DeviceSpaceToUserSpace")-> > + AsMatrix()->SetMatrix(matrix); > + > + float A = pow(dc.x, 2) + pow(dc.y, 2) - pow(dr, 2); I don't know if you care but VS2008 (didn't check 2010) doesn't turn pow(x, 2) into x*x @@ +1454,5 @@ > + mPrivateData->mEffect->GetVariableByName("A")->AsScalar()->SetFloat(A); > + mPrivateData->mEffect->GetTechniqueByName("SampleRadialGradient")-> > + GetPassByIndex(0)->Apply(0); > + } > + } Can this hunk be a separate function? ::: gfx/2d/HelpersD2D.h @@ +172,5 @@ > + } > + > + return false; > +} > + Can we come up with a better name for IsComplexPattern()? ::: gfx/2d/ShadersD2D.fx @@ +126,5 @@ > + Output.PixelCoord.y = ((1.0f - Output.Position.y) / 2.0f) * dimensions.y; > + Output.PixelCoord.xy = mul(float3(Output.PixelCoord.x, Output.PixelCoord.y, 1.0f), DeviceSpaceToUserSpace).xy; > + return Output; > +} > + Can you add some comments about what this shader is doing. @@ +186,5 @@ > + } > + > + return tex.Sample(sSampler, float2(t, 0.5)) * mask.Sample(sMaskSampler, In.MaskTexCoord).a; > +}; > + Some more documentation here wouldn't hurt. It's also worth saying something like: for a more detailed derivation see pixman.
Attachment #544589 - Flags: review?(jmuizelaar) → review+
Comment on attachment 544589 [details] [diff] [review] Fix Azure radial gradient behavior v3 This patch is one of the fixes for Azure we need to take in the early mozilla-aurora space.
Attachment #544589 - Flags: approval-mozilla-aurora?
Attachment #544588 - Flags: approval-mozilla-aurora?
Attachment #544588 - Flags: review?(jmuizelaar) → review+
Updated with review comments. Carrying r+.
Attachment #544589 - Attachment is obsolete: true
Attachment #544876 - Flags: review+
Attachment #544876 - Flags: approval-mozilla-aurora?
Attachment #544589 - Flags: approval-mozilla-aurora?
I folded these two patches together and pushed them to inbound: http://hg.mozilla.org/integration/mozilla-inbound/rev/c0eaec585ea7
Whiteboard: [inbound]
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla8
Keeping this open for aurora approval!
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Attachment #544588 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Attachment #544876 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Pushed: http://hg.mozilla.org/releases/mozilla-aurora/rev/ce54da315f7a Sadly with the wrong bug number in the comment :(.
Status: REOPENED → RESOLVED
Closed: 13 years ago13 years ago
Resolution: --- → FIXED
Depends on: 672646
Whiteboard: [inbound]
The condition returned from IsPatternSupportedByD2D is reversed.
Build:Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0) Gecko/20100101 Firefox/7.0 Setting this bug as verified fixed for firefox 7. The fix that landed on Aurora is visible in the Beta repository (i.e. http://hg.mozilla.org/releases/mozilla-beta/file/51f4341b6871/content/canvas/src/nsCanvasRenderingContext2DAzure.cpp). Also there are no failures with the attached tests to check the radial gradient (i.e. test_2d.gradient.radial.cone.top.html)
Status: RESOLVED → VERIFIED
Depends on: 1164912
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: