Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGradient not painted correctly #161
Comments
paulrouget
commented
Feb 1, 2016
|
|
|
Yeah, this is the issue whereby we don't tessellate non-axis-aligned gradients. I now feel like the best solution to this problem may be to just use the upgraded clip rect infrastructure, when we have it—i.e. clip out in the fragment shader. That will depend on a bit of infrastructure we don't yet have, though: the matrix/clip stack. @paulrouget, would it be better if I rendered the gradient correctly, but spilling outside the box, for now until we have that infrastructure? I can do that real quick if that's an improvement. |
|
Dependency: #154. |
Spilling will be a problem too. We can use a PNG instead of a linear-gradient for now. |
|
P1 -> P2. Browserhtml workaround: browserhtml/browserhtml#861 |
|
Actually, I'll fix it for real. :) |
in the fragment shader. This reintroduces the clip-in rect in the FS. Since we'll need it anyway when we have arbitrary matrix/clip stacks, this seems harmless. Color strips for non-axis-aligned linear gradients are submitted as axis-aligned rects centered at the appropriate point, just as axis-aligned ones are. However, we reuse one of the vertex fields to store the rotation angle. The vertex shader detects this condition, rotates the rectangle around its midpoint, and passes the clip rect on to the fragment shader. Additionally, this patch eliminates the ugly (-10000,10000) spans for linear gradient strips that we had before. It was necessary to tighten this up in order to avoid needless fragment shader invocations in the non-axis-aligned case, so I went ahead and fixed it everywhere. Closes #161.
|
@paulrouget I have a fix ready. Sorry for making you go through the work of making a PNG workaround. |
in the fragment shader. This reintroduces the clip-in rect in the FS. Since we'll need it anyway when we have arbitrary matrix/clip stacks, this seems harmless. Color strips for non-axis-aligned linear gradients are submitted as axis-aligned rects centered at the appropriate point, just as axis-aligned ones are. However, we reuse one of the vertex fields to store the rotation angle. The vertex shader detects this condition, rotates the rectangle around its midpoint, and passes the clip rect on to the fragment shader. Additionally, this patch eliminates the ugly (-10000,10000) spans for linear gradient strips that we had before. It was necessary to tighten this up in order to avoid needless fragment shader invocations in the non-axis-aligned case, so I went ahead and fixed it everywhere. Closes servo#161.
in the fragment shader. This reintroduces the clip-in rect in the FS. Since we'll need it anyway when we have arbitrary matrix/clip stacks, this seems harmless. Color strips for non-axis-aligned linear gradients are submitted as axis-aligned rects centered at the appropriate point, just as axis-aligned ones are. However, we reuse one of the vertex fields to store the rotation angle. The vertex shader detects this condition, rotates the rectangle around its midpoint, and passes the clip rect on to the fragment shader. Additionally, this patch eliminates the ugly (-10000,10000) spans for linear gradient strips that we had before. It was necessary to tighten this up in order to avoid needless fragment shader invocations in the non-axis-aligned case, so I went ahead and fixed it everywhere. Closes servo#161.
in the fragment shader. This reintroduces the clip-in rect in the FS. Since we'll need it anyway when we have arbitrary matrix/clip stacks, this seems harmless. Color strips for non-axis-aligned linear gradients are submitted as axis-aligned rects centered at the appropriate point, just as axis-aligned ones are. However, we reuse one of the vertex fields to store the rotation angle. The vertex shader detects this condition, rotates the rectangle around its midpoint, and passes the clip rect on to the fragment shader. Additionally, this patch eliminates the ugly (-10000,10000) spans for linear gradient strips that we had before. It was necessary to tighten this up in order to avoid needless fragment shader invocations in the non-axis-aligned case, so I went ahead and fixed it everywhere. Closes servo#161.
in the fragment shader. This reintroduces the clip-in rect in the FS. Since we'll need it anyway when we have arbitrary matrix/clip stacks, this seems harmless. Color strips for non-axis-aligned linear gradients are submitted as axis-aligned rects centered at the appropriate point, just as axis-aligned ones are. However, we reuse one of the vertex fields to store the rotation angle. The vertex shader detects this condition, rotates the rectangle around its midpoint, and passes the clip rect on to the fragment shader. Additionally, this patch eliminates the ugly (-10000,10000) spans for linear gradient strips that we had before. It was necessary to tighten this up in order to avoid needless fragment shader invocations in the non-axis-aligned case, so I went ahead and fixed it everywhere. Closes servo#161.
1. When the first stop of a gradient was not at position 0%, WebRender did not draw the solid color from 0% to that first stop, in violation of CSS-IMAGES-3. 2. Certain gradient angles would cause the segments to be too narrow. This patch fixes this by correcting the trigonometric calculations. Closes servo#161.

