ruffle-rs / ruffle

A Flash Player emulator written in Rust
https://ruffle.rs
Other
15.62k stars 809 forks source link

wrong drawn rectangle #5614

Open ousia opened 2 years ago

ousia commented 2 years ago

Edited original report

https://github.com/ruffle-rs/ruffle/files/10287036/79.zip contains a frame that reproduces this error:

wrong

While the previous frame is perfectly displayed:

ok

I don’t know which information should I submit to help to fix the issue.

Many thanks for your help.

Rationale

The original report linked to https://free-culture.tk/lfc-presentation.swf (from which the flawed rendering image comes from).

@n0samu was kind enough to provide a minimal SWF that contains the faulty frame (offered as first link now).

ousia commented 1 year ago

Ok, I have investigated further. All SWF files have been appended a .txt extension to upload them here.

Rectangle from frame 79 from this animation is wrong drawn: frames-wrong.swf.txt (as displayed in the first image from previous message).

This other animation embeds the previous SWF file and starts display from frame 79: version-wrong.swf.txt. Right/left keys increase/decrease frame number.

Basic info for object 1639:

Name              Value
Tag Type          DefineShape3 (32)
Character Id      1639
Offset            627313 (0x99271)
Length            118 (0x76)
Bounds            (53.20, 167.25)[613.55 x 205.50]
Dependent Frames  79

Just in case it might help, swfdump (from SWFTools) displays the following code:

[020]       112 DEFINESHAPE3 defines id 1639
                 | fillstyles(01)        linestyles(01)
                 | 1 ) SOLID ffffffff    1 ) 0.75 000000ff
                 |
                 | fill: 01/00 line:00 - moveTo 666.75 167.25
                 | fill: 01/00 line:00 - lineTo 53.95 167.25
                 | fill: 01/00 line:00 - lineTo 53.85 167.25
                 | fill: 01/00 line:00 - moveTo 666.75 167.25
                 | fill: 01/00 line:00 - lineTo 666.70 372.70
                 | fill: 01/00 line:00 - lineTo 53.20 372.75
                 | fill: 01/00 line:00 - moveTo 53.75 167.25
                 | fill: 01/00 line:00 - lineTo 53.65 167.35
                 | fill: 01/00 line:00 - moveTo 53.75 167.25
                 | fill: 01/00 line:00 - lineTo 53.85 167.25
                 | fill: 01/00 line:00 - moveTo 53.65 167.35
                 | fill: 01/00 line:00 - lineTo 53.55 167.35
                 | fill: 01/00 line:00 - lineTo 53.45 167.45
                 | fill: 01/00 line:00 - lineTo 53.35 167.55
                 | fill: 01/00 line:00 - lineTo 53.35 167.65
                 | fill: 01/00 line:00 - lineTo 53.25 167.75
                 | fill: 01/00 line:00 - lineTo 53.25 167.85
                 | fill: 01/00 line:00 - lineTo 53.25 168.00
                 | fill: 01/00 line:00 - lineTo 53.20 372.75
                 | fill: 01/00 line:00 - moveTo 665.25 168.75
                 | fill: 01/00 line:00 - lineTo 54.75 168.75
                 | fill: 01/00 line:00 - moveTo 665.25 168.75
                 | fill: 01/00 line:00 - lineTo 665.20 371.20
                 | fill: 01/00 line:00 - lineTo 54.70 371.25
                 | fill: 01/00 line:00 - moveTo 54.75 168.75
                 | fill: 01/00 line:00 - lineTo 54.70 371.25
                 |

Rectangle in frame 79 from this animation is drawn right: frames-right.swf.txt (as displayed in the second image from previous message).

This other animation embeds the previous SWF file and starts display from frame 79: version-right.swf.txt. As above, right/left keys increase/decrease frame number.

Basic tag info for object 1462:

Name              Value
Tag Type          DefineShape3 (32)
Character Id      1642
Offset            626477 (0x98f2d)
Length            77 (0x4d)
Bound             (53.30, 167.25)[613.45 x 205.55]
Dependent Frames  79

Again, swfdump output fro the rectangle:

[020]        71 DEFINESHAPE3 defines id 1642
                 | fillstyles(01)        linestyles(01)
                 | 1 ) SOLID ffffffff    1 ) 0.75 000000ff
                 |
                 | fill: 01/00 line:00 - moveTo 53.30 167.25
                 | fill: 01/00 line:00 - lineTo 54.05 167.25
                 | fill: 01/00 line:00 - lineTo 666.00 167.25
                 | fill: 01/00 line:00 - lineTo 666.75 167.25
                 | fill: 01/00 line:00 - lineTo 666.75 168.00
                 | fill: 01/00 line:00 - lineTo 666.75 372.05
                 | fill: 01/00 line:00 - lineTo 666.75 372.80
                 | fill: 01/00 line:00 - lineTo 666.00 372.80
                 | fill: 01/00 line:00 - lineTo 54.05 372.80
                 | fill: 01/00 line:00 - lineTo 53.30 372.80
                 | fill: 01/00 line:00 - lineTo 53.30 372.05
                 | fill: 01/00 line:00 - lineTo 53.30 168.00
                 | fill: 01/00 line:00 - lineTo 53.30 167.25
                 | fill: 01/00 line:00 - moveTo 54.80 168.75
                 | fill: 01/00 line:00 - lineTo 54.80 371.30
                 | fill: 01/00 line:00 - lineTo 665.25 371.30
                 | fill: 01/00 line:00 - lineTo 665.25 168.75
                 | fill: 01/00 line:00 - lineTo 54.80 168.75
                 |

I don’t have any idea what is causing the wrong drawing, but the problematic version contains eight more fill commands.

Would anyone be so kind to check what is wrong here?

Many thanks for your help.

ousia commented 1 year ago

@n0samu, would you be so kind to confirm the issue (better with the files from previous comment)?

Many thanks for your help.

n0samu commented 1 year ago

Yes, I can confirm the issue. Here is a truly minimal reproduction with just 1 frame and the 4 shapes: 79.zip

relrelb commented 1 year ago

I've managed to minimize the reproducer a bit more: out4.zip Still didn't pinpoint the root cause, but I guess this is related to Ruffle's implicit assumption that shape fills are always considered as "closed".