mirror of
https://github.com/emilk/egui.git
synced 2026-06-26 22:53:14 -04:00
egui_kittest: PNG-encode inspector screenshots via shared egui_inspection::encode_png
- Encode harness frames with egui_inspection::encode_png instead of sending raw RGBA, so the inspector socket carries compressed bytes. - Features: pull egui_inspection/png + image/png for the encoder; drop the now-removed egui_inspection `protocol` feature.
This commit is contained in:
@@ -29,11 +29,11 @@ snapshot = ["dep:dify", "dep:image", "dep:open", "dep:tempfile", "image/png"]
|
||||
## Expose the [`inspector_api`] wire protocol used to talk to the external
|
||||
## `kittest_inspector` binary. Pull this in if you're building a tool that consumes the
|
||||
## same stream — the binary itself enables this transitively.
|
||||
inspector_api = ["dep:egui_inspection", "egui_inspection/protocol", "egui/serde"]
|
||||
inspector_api = ["dep:egui_inspection", "egui/serde"]
|
||||
|
||||
## Stream frames + accesskit tree to a `kittest_inspector` window for live debugging.
|
||||
## Auto-launches when the `KITTEST_INSPECTOR` env var is truthy.
|
||||
inspector = ["inspector_api", "dep:image"]
|
||||
inspector = ["inspector_api", "egui_inspection/png", "dep:image", "image/png"]
|
||||
|
||||
## Allows testing eframe::App
|
||||
eframe = ["dep:eframe", "eframe/accesskit"]
|
||||
|
||||
@@ -396,14 +396,28 @@ impl Connection {
|
||||
return;
|
||||
}
|
||||
self.step = self.step.saturating_add(1);
|
||||
let screenshot = image.and_then(|img| match egui_inspection::encode_png(
|
||||
img.width(),
|
||||
img.height(),
|
||||
img.as_raw(),
|
||||
) {
|
||||
Ok(png) => Some(FrameScreenshot {
|
||||
width: img.width(),
|
||||
height: img.height(),
|
||||
png,
|
||||
}),
|
||||
Err(err) => {
|
||||
#[expect(clippy::print_stderr)]
|
||||
{
|
||||
eprintln!("[kittest] PNG encode failed: {err}");
|
||||
}
|
||||
None
|
||||
}
|
||||
});
|
||||
let frame = Frame {
|
||||
step: self.step,
|
||||
pixels_per_point,
|
||||
screenshot: image.map(|img| FrameScreenshot {
|
||||
width: img.width(),
|
||||
height: img.height(),
|
||||
rgba: img.as_raw().clone(),
|
||||
}),
|
||||
screenshot,
|
||||
accesskit,
|
||||
source,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user