Skip to content

Commit

Permalink
webgl: Implement pixel snapping
Browse files Browse the repository at this point in the history
  • Loading branch information
Dinnerbone committed Jul 21, 2023
1 parent 4410d66 commit 77c0dac
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions render/webgl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1167,7 +1167,7 @@ impl CommandHandler for WebGlRenderBackend {
bitmap: BitmapHandle,
transform: Transform,
smoothing: bool,
_pixel_snapping: PixelSnapping,
pixel_snapping: PixelSnapping,
) {
self.set_stencil_state();
let entry = as_registry_data(&bitmap);
Expand All @@ -1181,8 +1181,9 @@ impl CommandHandler for WebGlRenderBackend {
};

// Scale the quad to the bitmap's dimensions.
let matrix = transform.matrix
* ruffle_render::matrix::Matrix::scale(entry.width as f32, entry.height as f32);
let mut matrix = transform.matrix;
pixel_snapping.apply(&mut matrix);
matrix *= ruffle_render::matrix::Matrix::scale(entry.width as f32, entry.height as f32);

let world_matrix = [
[matrix.a, matrix.b, 0.0, 0.0],
Expand Down

0 comments on commit 77c0dac

Please sign in to comment.