Canvas: path with bezierCurveTo() does not always fill correctly

RESOLVED DUPLICATE of bug 1063486

Status

()

Core
Graphics
RESOLVED DUPLICATE of bug 1063486
6 years ago
2 years ago

People

(Reporter: Jordan Osete, Unassigned)

Tracking

({regression})

Trunk
x86
All
regression
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Reporter)

Description

6 years ago
Created attachment 613193 [details]
canvas_curve_bug.htm

User Agent: Mozilla/5.0 (X11; Linux i686; rv:13.0) Gecko/20120406 Firefox/13.0a2
Build ID: 20120406042011

Steps to reproduce:

When filling a path with multiple bezierCurveTo(), it may not always fill the whole path, depending on the orientation of the curves. Please see testcase for details.
(Reporter)

Comment 1

6 years ago
Comment on attachment 613193 [details]
canvas_curve_bug.htm

(Changed attachment mime type to text/html)
Attachment #613193 - Attachment mime type: text/plain → text/html
(Reporter)

Comment 2

6 years ago
Might actually be a duplicate of bug 664383.

Comment 3

6 years ago
Regression window(with HWA off)
Cannot reproduce:
http://hg.mozilla.org/mozilla-central/rev/2968d19b0165
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.3a5pre) Gecko/20100426 Minefield/3.7a5pre ID:20100426040533
Can reprodce:
http://hg.mozilla.org/mozilla-central/rev/f236632a9747
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.3a5pre) Gecko/20100426 Minefield/3.7a5pre ID:20100426084628
Pushlog:
http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=2968d19b0165&tochange=f236632a9747

Triggered by:
f236632a9747	Jeff Muizelaar — Bug 542605. Update cairo to 12d521df8acc483b2daa844d4f05dc2fe2765ba6. r=vlad,jwatt,bas Reland after fixing quartz related clipping bug and a bunch of other ones
Blocks: 542605
Status: UNCONFIRMED → NEW
Component: Untriaged → Graphics
Ever confirmed: true
Keywords: regression
OS: Linux → All
Product: Firefox → Core
QA Contact: untriaged → thebes
Version: 13 Branch → Trunk
(Reporter)

Comment 4

6 years ago
By the way, it seems that if context.lineJoin is set to "round" or "bevel", the stroke is not correctly drawn either.
(Reporter)

Comment 5

5 years ago
A simple workaround for the time being is to rewrite bezierCurveTo() so that it draws a single, extremely short straight line at the end of each curve, thus avoiding having two curves in a row.
It actually modifies very slightly the shape drawn, but the naked eye shouldn't tell the difference, as the straight line is very short.

function installWorkaroundBug743578()
{
    var c2dp = CanvasRenderingContext2D.prototype,
        oldBezier = c2dp.bezierCurveTo;
    c2dp.bezierCurveTo = function( a, b, c, d, g, h )
    {
        var alpha = 1/1000,
            e = alpha * c + ( 1 - alpha ) * g,
            f = alpha * d + ( 1 - alpha ) * h;
        oldBezier.call( this, a, b, c, d, e, f );
        this.lineTo( g, h );
    };
}
if( browser.isMozilla() )  // you might even want to detect the bug itself instead of the browser
{
    installWorkaroundBug743578();
}
Created attachment 653834 [details] [diff] [review]
Don't forget to add the current point when computing the bounds

The code was not changing current_point when adding the bounds for a curve. This caused us to compute the wrong bounds.

This has been fixed upstream a different way.
Attachment #653834 - Flags: review?(joe)
Comment on attachment 653834 [details] [diff] [review]
Don't forget to add the current point when computing the bounds

You'll need to add this to the patches too, and somehow mark it as not to be applied when we upgrade.
Attachment #653834 - Flags: review?(joe) → review+

Comment 8

4 years ago
1 year old patch.

Updated

2 years ago
Status: NEW → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1063486
You need to log in before you can comment on or make changes to this bug.