-
Notifications
You must be signed in to change notification settings - Fork 77
Open
Labels
bugSome API breaks the contract it establishesSome API breaks the contract it establishesplatform-wasmWASM-specific code changes or bugsWASM-specific code changes or bugssubsystem-graphics
Milestone
Description
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 {}
}
}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
Metadata
Metadata
Assignees
Labels
bugSome API breaks the contract it establishesSome API breaks the contract it establishesplatform-wasmWASM-specific code changes or bugsWASM-specific code changes or bugssubsystem-graphics
