Closed Bug 989707 Opened 6 years ago Closed 6 years ago

Skia canvas: failed assertion "currE->fLastY >= curr_y"

Categories

(Core :: Graphics, defect, critical)

x86_64
macOS
defect
Not set
critical

Tracking

()

RESOLVED FIXED
mozilla31

People

(Reporter: jruderman, Assigned: gw280)

References

(Blocks 1 open bug)

Details

(Keywords: assertion, testcase, Whiteboard: [skia-upstream])

Attachments

(3 files)

Attached file m.html
Debug:

gfx/skia/trunk/src/core/SkScan_Path.cpp:137: failed assertion "currE->fLastY >= curr_y"

Non-debug:

nothing bad happens
This is with:
   user_pref("gfx.canvas.azure.backends", "skia");
Can you post a stack?
Attached file stack
In a nutshell:

- We build an SkPath
- We grab the bounds of the path (floatrect)
- We convert that to an intrect
- We create a list of edges in the path
- We sort the edge list by y value
- We walk through the edgelist from top to bottom, starting at the y coordinate for the top of the bounding rect and stopping at the y coordinate for the bottom.

The reason we're failing this assert is because the path boundary happens to lie on 0.499999997 or so, and then we add 0.5f then floor to do a round to int, which returns 1 instead of 0 as that's the closest representable floating point value. The edge of the path that fails lies on Y=0 and it blows up because start_y is 1 instead of 0 (rounded from the original 0.499999...). I think it doesn't happen for 0.5 <= start_y <= 1.0 because the edge builder will generate edges in that case with y = 1 rather than y = 0.

I think the solution here is that as we're using this rect to determine the start_y and stop_y coordinates for walking through the edgelist, we should roundOut() instead of round() which will take the floor of (top,left) and the ceil of (bottom,right).
Attachment #8399307 - Flags: review?(matt.woodrow)
To clarify: SkEdge uses fixed point arithmetic rather than floating point, so it'll have different rounding behaviour for values very close to (but not quite) 0.5.
Assignee: nobody → gwright
Comment on attachment 8399307 [details] [diff] [review]
0001-Bug-989707-roundOut-the-bounds-rect-instead-of-round.patch

Review of attachment 8399307 [details] [diff] [review]:
-----------------------------------------------------------------

Seems pretty reasonable to me, but you should get this upstreamed and reviewed by the skia team asap.
Attachment #8399307 - Flags: review?(matt.woodrow) → review+
My thoughts exactly. Mike's away this week so I'll be following up directly with him when he's back.
Whiteboard: [skia-upstream]
https://hg.mozilla.org/mozilla-central/rev/5f286e259379
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla31
The following changeset is now in Firefox Nightly:

> 5f286e259379 Bug 989707 - roundOut() the bounds rect instead of round(), as round() can return a rect that's not quite large enough to cover the path r=mattwoodrow

Nightly Build Information:

        ID: 20140402030201
 Changeset: 4941a2ac0786109b08856738019b016a6c5a66a6
   Version: 31.0a1
      TBPL: https://tbpl.mozilla.org/?rev=4941a2ac0786
       URL: https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2014/04/2014-04-02-03-02-01-mozilla-central

Download Links:

>         Linux x86: https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2014/04/2014-04-02-03-02-01-mozilla-central/firefox-31.0a1.en-US.linux-i686.tar.bz2
>      Linux x86_64: https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2014/04/2014-04-02-03-02-01-mozilla-central/firefox-31.0a1.en-US.linux-x86_64.tar.bz2
> Linux x86_64 ASAN: https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2014/04/2014-04-02-03-02-01-mozilla-central/firefox-31.0a1.en-US.linux-x86_64-asan.tar.bz2
>               Mac: https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2014/04/2014-04-02-03-02-01-mozilla-central/firefox-31.0a1.en-US.mac.dmg
>             Win32: https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2014/04/2014-04-02-03-02-01-mozilla-central/firefox-31.0a1.en-US.win32.installer.exe
>             Win64: https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2014/04/2014-04-02-03-02-01-mozilla-central/firefox-31.0a1.en-US.win64-x86_64.installer.exe

Previous Nightly Build Information:

        ID: 20140401030203
 Changeset: 1417d180a1d8665b1a91b897d1cc4cc31e7980d4
   Version: 31.0a1
      TBPL: https://tbpl.mozilla.org/?rev=1417d180a1d8
       URL: https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2014/04/2014-04-01-03-02-03-mozilla-central
You need to log in before you can comment on or make changes to this bug.