Hand the drag ghost to the renderer through a file, so it draws
The bitmap under the cursor was a solid red rectangle. Slint's drag overlay uploads the image as a texture, draws it and drops the texture in one call; with the wgpu FemtoVG renderer the drop is immediate and the draw is deferred to the flush, so the frame binds femtovg's placeholder — which is red. An image with a cache key survives in the texture cache until after the flush, and only a path gives one. So the composite goes to the data directory's scratch as a PNG and comes back through load_from_path; one file per drag, removed when the drag ends. A workaround for Slint 1.17.1, written up as one beside the code.
This commit is contained in:
@@ -4340,6 +4340,15 @@ pub fn inference_cache_dir() -> PathBuf {
|
||||
data_root().join("inference")
|
||||
}
|
||||
|
||||
/// Somewhere to put a file that only needs to exist for a moment.
|
||||
///
|
||||
/// Under the data root rather than `std::env::temp_dir()`, which on Android
|
||||
/// names a directory the app cannot write to. Nothing here survives a
|
||||
/// launch on purpose: whoever writes into it deletes what they wrote.
|
||||
pub fn scratch_dir() -> PathBuf {
|
||||
data_root().join("scratch")
|
||||
}
|
||||
|
||||
/// The detector and embedder files, if both are present — and the eye
|
||||
/// models beside them, if those are.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user