Skip to content

Commit a81d45f

Browse files
planeshift: Fork of the upstream
This is a fork of the upstream, without all of the backends yet, and without the GL integration, and without some of the winit integration.
1 parent 8d87e27 commit a81d45f

File tree

10 files changed

+1981
-7
lines changed

10 files changed

+1981
-7
lines changed

Cargo.lock

Lines changed: 85 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ members = [
2121
"sparse_strips/vello_hybrid/examples/webgl",
2222
"sparse_strips/vello_hybrid/examples/winit",
2323
"sparse_strips/vello_toy",
24+
25+
"planeshift",
2426
]
2527

2628
[workspace.package]

planeshift/Cargo.toml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
[package]
2+
name = "planeshift"
3+
version = "0.1.0"
4+
description = "TODO"
5+
categories = ["gui"]
6+
keywords = ["windowing", "compositor"]
7+
edition.workspace = true
8+
rust-version.workspace = true
9+
license.workspace = true
10+
repository.workspace = true
11+
12+
[package.metadata.docs.rs]
13+
all-features = true
14+
# There are no platform specific docs.
15+
default-target = "x86_64-unknown-linux-gnu"
16+
targets = []
17+
18+
[features]
19+
default = ["enable-winit"]
20+
enable-winit = ["dep:winit"]
21+
22+
[lints]
23+
workspace = true
24+
25+
[dependencies]
26+
bitflags = "2.9.0"
27+
euclid = "0.22.11"
28+
image = { workspace = true }
29+
winit = { workspace = true, optional = true }
30+
31+
[target.'cfg(target_os = "macos")'.dependencies]
32+
block = "0.1"
33+
cocoa = "0.26.0"
34+
core-graphics = "0.24.0"
35+
objc = "0.2"

planeshift/README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<div align="center">
2+
3+
# Planeshift
4+
5+
[![Apache 2.0 or MIT license.](https://img.shields.io/badge/license-Apache--2.0_OR_MIT-blue.svg)](#license)
6+
\
7+
[![Linebender Zulip chat.](https://img.shields.io/badge/Linebender-%23vello-blue?logo=Zulip)](https://xi.zulipchat.com/#narrow/channel/197075-vello)
8+
[![GitHub Actions CI status.](https://img.shields.io/github/actions/workflow/status/linebender/vello/ci.yml?logo=github&label=CI)](https://github.com/linebender/vello/actions)
9+
10+
</div>
11+
12+
## Minimum supported Rust Version (MSRV)
13+
14+
This version of Planeshift has been verified to compile with **Rust 1.85** and later.
15+
16+
Future versions of Planeshift might increase the Rust version requirement.
17+
It will not be treated as a breaking change and as such can even happen with small patch releases.
18+
19+
<details>
20+
<summary>Click here if compiling fails.</summary>
21+
22+
As time has passed, some of Planeshift's dependencies could have released versions with a higher Rust requirement.
23+
If you encounter a compilation issue due to a dependency and don't want to upgrade your Rust toolchain, then you could downgrade the dependency.
24+
25+
```sh
26+
# Use the problematic dependency's name and version
27+
cargo update -p package_name --precise 0.1.1
28+
```
29+
30+
</details>
31+
32+
## Community
33+
34+
Discussion of Planeshift development happens in the [Linebender Zulip](https://xi.zulipchat.com/), specifically the [#vello stream](https://xi.zulipchat.com/#narrow/channel/197075-vello).
35+
All public content can be read without logging in.
36+
37+
Contributions are welcome by pull request.
38+
The [Rust code of conduct] applies.
39+
40+
## License
41+
42+
Licensed under either of
43+
44+
- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or <http://www.apache.org/licenses/LICENSE-2.0>)
45+
- MIT license ([LICENSE-MIT](LICENSE-MIT) or <http://opensource.org/licenses/MIT>)
46+
47+
at your option.
48+
49+
[Rust code of conduct]: https://www.rust-lang.org/policies/code-of-conduct

planeshift/src/backend.rs

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
// Copyright 2018 the Vello Authors and The Pathfinder Project Developers
2+
// SPDX-License-Identifier: Apache-2.0 OR MIT
3+
4+
use image::RgbaImage;
5+
6+
#[cfg(feature = "enable-winit")]
7+
use winit::window::Window;
8+
9+
use crate::Rect;
10+
use crate::{Connection, ConnectionError, LayerContainerInfo};
11+
use crate::{LayerGeometryInfo, LayerId, LayerMap, LayerSurfaceInfo, LayerTreeInfo, Promise};
12+
13+
// Backend definition
14+
15+
pub trait Backend: Sized {
16+
type NativeConnection;
17+
type Host;
18+
19+
// Constructor
20+
fn new(connection: Connection<Self::NativeConnection>) -> Result<Self, ConnectionError>;
21+
22+
// Transactions
23+
fn begin_transaction(&self);
24+
fn end_transaction(
25+
&mut self,
26+
promise: &Promise<()>,
27+
tree_component: &LayerMap<LayerTreeInfo>,
28+
container_component: &LayerMap<LayerContainerInfo>,
29+
geometry_component: &LayerMap<LayerGeometryInfo>,
30+
surface_component: &LayerMap<LayerSurfaceInfo>,
31+
);
32+
33+
// Layer creation and destruction
34+
fn add_container_layer(&mut self, new_layer: LayerId);
35+
fn add_surface_layer(&mut self, new_layer: LayerId);
36+
fn delete_layer(&mut self, layer: LayerId);
37+
38+
// Layer tree management
39+
fn insert_before(
40+
&mut self,
41+
parent: LayerId,
42+
new_child: LayerId,
43+
reference: Option<LayerId>,
44+
tree_component: &LayerMap<LayerTreeInfo>,
45+
container_component: &LayerMap<LayerContainerInfo>,
46+
geometry_component: &LayerMap<LayerGeometryInfo>,
47+
);
48+
fn remove_from_superlayer(
49+
&mut self,
50+
layer: LayerId,
51+
parent: LayerId,
52+
tree_component: &LayerMap<LayerTreeInfo>,
53+
geometry_component: &LayerMap<LayerGeometryInfo>,
54+
);
55+
56+
// Native hosting
57+
unsafe fn host_layer(
58+
&mut self,
59+
layer: LayerId,
60+
host: Self::Host,
61+
tree_component: &LayerMap<LayerTreeInfo>,
62+
container_component: &LayerMap<LayerContainerInfo>,
63+
geometry_component: &LayerMap<LayerGeometryInfo>,
64+
);
65+
fn unhost_layer(&mut self, layer: LayerId);
66+
67+
// Geometry
68+
fn set_layer_bounds(
69+
&mut self,
70+
layer: LayerId,
71+
old_bounds: &Rect<f32>,
72+
tree_component: &LayerMap<LayerTreeInfo>,
73+
container_component: &LayerMap<LayerContainerInfo>,
74+
geometry_component: &LayerMap<LayerGeometryInfo>,
75+
);
76+
77+
// Miscellaneous layer flags
78+
fn set_layer_surface_options(
79+
&mut self,
80+
layer: LayerId,
81+
surface_component: &LayerMap<LayerSurfaceInfo>,
82+
);
83+
84+
// Screenshots
85+
fn screenshot_hosted_layer(
86+
&mut self,
87+
layer: LayerId,
88+
transaction_promise: &Promise<()>,
89+
tree_component: &LayerMap<LayerTreeInfo>,
90+
container_component: &LayerMap<LayerContainerInfo>,
91+
geometry_component: &LayerMap<LayerGeometryInfo>,
92+
surface_component: &LayerMap<LayerSurfaceInfo>,
93+
) -> Promise<RgbaImage>;
94+
95+
// `winit` integration
96+
#[cfg(feature = "enable-winit")]
97+
fn window(&self) -> Option<&Window>;
98+
#[cfg(feature = "enable-winit")]
99+
fn host_layer_in_window(
100+
&mut self,
101+
layer: LayerId,
102+
tree_component: &LayerMap<LayerTreeInfo>,
103+
container_component: &LayerMap<LayerContainerInfo>,
104+
geometry_component: &LayerMap<LayerGeometryInfo>,
105+
) -> Result<(), ()>;
106+
}

0 commit comments

Comments
 (0)