mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
Document canvas resource and paint helpers
This commit is contained in:
1 parent
1162ea23aa
commit
dc6ca120b4
3 files changed
+3
No files matched your search
@@ -162,6 +162,7 @@ impl CallbackTrait for CanvasCallback {
|
||||
Vec::new()
|
||||
}
|
||||
|
||||
/// Draw this view's visible tiles inside the clipped canvas.
|
||||
fn paint(&self, info: egui::PaintCallbackInfo, pass: &mut wgpu::RenderPass<'static>, resources: &CallbackResources) {
|
||||
let Some(res) = resources.get::<Resources>() else { return };
|
||||
if !res.health.is_ok() {
|
||||
|
||||
@@ -231,6 +231,7 @@ fn pipeline(
|
||||
}
|
||||
|
||||
impl Resources {
|
||||
/// Create the shared canvas pipelines, layouts and display resources.
|
||||
pub(super) fn new(device: &wgpu::Device, queue: &wgpu::Queue, target: wgpu::TextureFormat, high: bool) -> Self {
|
||||
let module =
|
||||
device.create_shader_module(wgpu::ShaderModuleDescriptor { label: Some("pc_canvas"), source: wgpu::ShaderSource::Wgsl(CANVAS_WGSL.into()) });
|
||||
|
||||
@@ -8,6 +8,7 @@ use serde_json::json;
|
||||
|
||||
type Harness = egui_kittest::Harness<'static, PhotocraftApp>;
|
||||
|
||||
/// Build the application harness for GPU and CPU canvas comparisons.
|
||||
fn harness() -> Option<Harness> {
|
||||
let built = std::panic::catch_unwind(|| {
|
||||
egui_kittest::Harness::builder().with_size(egui::vec2(1000.0, 700.0)).with_pixels_per_point(1.0).with_max_steps(64).wgpu().build_eframe(|cc| {
|
||||
|
||||
Reference in new issue
Block a user