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

Images are drawn with white pixel border #593

Open
ghost opened this issue Apr 2, 2020 · 2 comments
Open

Images are drawn with white pixel border #593

ghost opened this issue Apr 2, 2020 · 2 comments
Labels
bug Some API breaks the contract it establishes platform-wasm WASM-specific code changes or bugs subsystem-graphics
Milestone

Comments

@ghost
Copy link

ghost commented Apr 2, 2020

Describe the bug
In the web-version, when an image is drawn to pixel-coordinates with a decimal component (e.g. 100.6), then white pixels occur where presumably those fractional pixels would have been.

To Reproduce
Start the following code with cargo web start --release --open:

use quicksilver::{geom::*, graphics::*, lifecycle::*, Result};

fn main() {
    run(Settings::default(), app);
}

async fn app(window: Window, mut gfx: Graphics, mut events: EventStream) -> Result<()> {
    
    //render image with just a dark-grey background color
    gfx.clear(Color::from_rgba(33, 33, 33, 1.0));
    let mut surface = Surface::new(
        &gfx,
        Image::from_raw(&gfx, None, 512, 512, PixelFormat::RGBA)?,
    )?;
    gfx.fit_to_surface(&surface)?;
    gfx.flush(Some(&surface))?;
    let image = surface.detach().expect("The image failed to detach.");
    
    
    gfx.clear(Color::BLACK);
    gfx.fit_to_window(&window);
    let image_size = Vector::new(100.0, 100.0);
    
    //normal image drawn without problem
    gfx.draw_image(
        &image,
        Rectangle::new(
            Vector::new(100.0, 100.0),
            image_size,
        ),
    );
    
    //image drawn to fractional pixels (shows white line at top and left side)
    gfx.draw_image(
        &image,
        Rectangle::new(
            Vector::new(300.6, 100.6), //mind the .6 (the effect is less visible for other decimal values)
            image_size,
        ),
    );
    
    //image drawn with rotation (also shows white line at top and left side)
    gfx.set_transform(Transform::rotate(33));
    gfx.draw_image(
        &image,
        Rectangle::new(
            Vector::new(400.0, 100.0),
            image_size,
        ),
    );
    
    gfx.present(&window)?;
    loop {
        while let Some(_) = events.next_event().await {}
    }
}

screenshot_quicksilver_image_bug

Environment and versions

  • Environment: openSUSE Tumbleweed 20200331, tested in Firefox and Chromium-based Falkon
  • Rust compiler version: Stable 1.42
$ rustc -vV
rustc 1.42.0 (b8cedc004 2020-03-09)
binary: rustc
commit-hash: b8cedc00407a4c56a3bda1ed605c6fc166655447
commit-date: 2020-03-09
host: x86_64-unknown-linux-gnu
release: 1.42.0
LLVM version: 9.0
  • Quicksilver version: 0.4.0-alpha0.2, tested only with stdweb
@ryanisaacg
Copy link
Owner

Thanks for the detailed report! When I get some time to look into this, it will definitely help with getting this fixed 👍

@ryanisaacg ryanisaacg added bug Some API breaks the contract it establishes platform-wasm WASM-specific code changes or bugs subsystem-graphics labels Apr 3, 2020
@ryanisaacg
Copy link
Owner

I haven't had time to test this as much as I'd like, but I've determined the following:

  • The bug is present when running under WebGL and WebGL 2
  • The bug does not appear to be present when running under desktop GL (at least on macOS)

This will make it a little hard to track down, but I'll keep looking.

@ryanisaacg ryanisaacg modified the milestones: v0.4.x, v0.4 Beta Aug 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Some API breaks the contract it establishes platform-wasm WASM-specific code changes or bugs subsystem-graphics
Projects
None yet
Development

No branches or pull requests

1 participant