Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panics on a large stroke width #135

Open
RazrFalcon opened this issue Jun 4, 2020 · 1 comment
Open

Panics on a large stroke width #135

RazrFalcon opened this issue Jun 4, 2020 · 1 comment

Comments

@RazrFalcon
Copy link
Contributor

RazrFalcon commented Jun 4, 2020

use raqote::*;

fn main() {
    let mut dt = DrawTarget::new(400, 400);

    let mut pb = PathBuilder::new();
    pb.move_to(200., 200.);
    pb.line_to(300., 300.);
    pb.line_to(200., 300.);

    let path = pb.finish();
    dt.stroke(
        &path,
        &Source::Solid(SolidSource::from_unpremultiplied_argb(0xFF, 0, 0x80, 0)),
        &StrokeStyle {
            width: 100000., // <--
            ..StrokeStyle::default()
        },
        &DrawOptions::new(),
    );

    dt.write_png("out.png").unwrap();
}
thread 'main' panicked at 'attempt to multiply with overflow', src/rasterizer.rs:361:25

The fix should be easy, but I'm not sure what solution do you prefer.

@jrmuizel
Copy link
Owner

This is related to #107

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants