Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…aseview into feature/wgpu
  • Loading branch information
murl-digital committed Jul 6, 2024
2 parents 2b37060 + 275cb4c commit a1bb1cc
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
6 changes: 4 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ readme = "README.md"

[features]
default = ["wgpu", "default_fonts"]
opengl = ["egui_glow", "baseview/opengl"]
wgpu = ["egui-wgpu", "raw-window-handle-06", "pollster"]
default_fonts = ["egui/default_fonts"]
opengl = ["egui_glow", "baseview/opengl"]
wgpu = ["egui-wgpu", "raw-window-handle-06", "pollster", "dep:wgpu"]
## Enable parallel tessellation using [`rayon`](https://docs.rs/rayon).
##
## This can help performance for graphics-intense applications.
Expand All @@ -28,11 +28,13 @@ pollster = ["dep:pollster"]
egui = { version = "0.28", default-features = false, features = ["bytemuck"] }
egui_glow = { version = "0.28", optional = true }
egui-wgpu = { version = "0.28", optional = true }
wgpu = { version = "0.20", optional = true }
keyboard-types = { version = "0.6", default-features = false }
baseview = { git = "https://github.com/RustAudio/baseview.git", rev = "45465c5f46abed6c6ce370fffde5edc8e4cd5aa3" }
raw-window-handle = "0.5"
raw-window-handle-06 = { package = "raw-window-handle", version = "0.6", optional = true }
# TODO: Enable wayland feature when baseview gets wayland support.

copypasta = { version = "0.10", default-features = false, features = ["x11"] }
log = "0.4"
open = "5.1"
Expand Down
1 change: 1 addition & 0 deletions src/renderer/opengl_renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ impl Renderer {
width: canvas_width,
height: canvas_height,
} = physical_size;

let shapes = std::mem::take(&mut full_output.shapes);
let textures_delta = &mut full_output.textures_delta;

Expand Down
3 changes: 2 additions & 1 deletion src/renderer/wgpu_renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ impl Renderer {
NonZeroU32::new(handle.window).unwrap(),
))
}
// will this work? i have no idea!
raw_window_handle::RawWindowHandle::Win32(handle) => {
// will this work? i have no idea!
let mut raw_handle =
Win32WindowHandle::new(NonZeroIsize::new(handle.hwnd as isize).unwrap());

Expand Down Expand Up @@ -188,6 +188,7 @@ impl Renderer {
width: canvas_width,
height: canvas_height,
} = physical_size;

let shapes = std::mem::take(&mut full_output.shapes);

let clipped_primitives = egui_ctx.tessellate(shapes, pixels_per_point);
Expand Down
3 changes: 2 additions & 1 deletion src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -432,9 +432,10 @@ where
baseview::ScrollDelta::Lines { x, y } => {
(egui::MouseWheelUnit::Line, egui::vec2(*x, *y))
}

baseview::ScrollDelta::Pixels { x, y } => (
egui::MouseWheelUnit::Point,
egui::vec2(*x * self.points_per_pixel, *y * self.points_per_pixel),
egui::vec2(*x, *y) * self.points_per_pixel,
),
};

Expand Down

0 comments on commit a1bb1cc

Please # to comment.