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

Debug assertion failed in hairline_aa.rs:124 #112

Open
danieldg opened this issue Feb 19, 2024 · 3 comments
Open

Debug assertion failed in hairline_aa.rs:124 #112

danieldg opened this issue Feb 19, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@danieldg
Copy link
Contributor

Using tiny-skia-0.11.4:

use tiny_skia::*;

fn main() {
    let mut pixmap = Pixmap::new(100, 10).unwrap();
    let paint = Paint {
        shader: Shader::SolidColor(Color::BLACK),
        anti_alias: true,
        ..Default::default()
    };
    let rect = Rect::from_ltrb(88.1, 0., 89.6, 10.).unwrap();

    pixmap.fill_rect(rect, &paint, Default::default(), None);
}

Backtrace:

#14 0x00005555555602f3 in core::panicking::panic ()
#15 0x0000555555568b1c in tiny_skia::scan::hairline_aa::fill_dot8 (l=22554, t=<optimized out>, r=22938, b=2560, fill_inner=true, blitter=...) at src/scan/hairline_aa.rs:124
#16 tiny_skia::scan::hairline_aa::fill_fixed_rect (blitter=..., rect=<optimized out>) at src/scan/hairline_aa.rs:58
#17 tiny_skia::scan::hairline_aa::fill_rect (rect=<optimized out>, clip=<optimized out>, blitter=...) at src/scan/hairline_aa.rs:54
#18 0x0000555555561331 in tiny_skia::scan::fill_rect_aa (rect=0x7fffffffddd0, clip=0x7fffffffc8f0, blitter=...) at src/scan/mod.rs:38
#19 tiny_skia::pixmap::PixmapMut::fill_rect (self=0x7fffffffdd30, rect=..., paint=0x7fffffffdde8, transform=..., mask=...) at src/painter.rs:203
#20 0x000055555556113e in tiny_skia::pixmap::Pixmap::fill_rect (self=<optimized out>, rect=<error reading variable: Cannot access memory at address 0x555e>, paint=0x6, transform=..., mask=...) at src/painter.rs:114
@RazrFalcon
Copy link
Owner

Thanks, will take a look.

@RazrFalcon RazrFalcon added the bug Something isn't working label Feb 19, 2024
@nwhitehead
Copy link

I came across what I think is the same issue. I was drawing aa rects with width exactly 1 and non-integral horizontal positions.

I think the right fix is to let width be 0 in the inner part of hairline_aa.rs:fill_dot8 and just skip the blit_rect for that case with no error.

I put up a pull request with test and fix at #119.

@RazrFalcon
Copy link
Owner

Thanks. Will take a look.
The correct fix would be to have exactly the same logic Skia does. So the main problem here is for me to find time to dive into Skia sources.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants