Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates for skia-safe >= v0.73.0 #114

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

mpaperno
Copy link

Hi,

As the title says, this brings support for newer skia-safe versions, with the minimum being 0.73. I tested with this version and the latest 0.78.2. I ran through all the examples. No warnings or errors, but only tested on Windows.

This would be pretty straight-forward, but it introduces a breaking change, thanks to rust-skia/rust-skia#816 , which is released starting with v0.67.0.

The Canvas instance returned by *SkiaSurface::canvas() (and others) is no longer mutable, so, as far as I can tell, the signature of the callback passed to Renderer::draw() needed to change also so that the Canvas reference is no longer mutable.

-- pub fn draw<F: FnOnce(&mut skia_safe::Canvas, CoordinateSystemHelper)>(
++ pub fn draw<F: FnOnce(&skia_safe::Canvas, CoordinateSystemHelper)>(

Which I imagine will break probably every downstream usage of Renderer. Maybe there's some other clever way to fix this so it doesn't break existing Renderer::draw() callbacks, but from what I understand this could be a "bad idea."

This also makes the skia-safe version ">=" again so this crate can be used alongside others with a higher version dependency (subject to future breaking changes in their crate, of course). I picked v0.73.0 as the minimum since that was the last version with a breaking change which affected skulpin.

No worries if you're not interested, just close it... I was updating my version of skia-canvas (JS interface to skia-safe) which uses skulpin for one of its features, and it was much easier to fix than replace and cooler than removing the feature. :)

Cheers,
-Max

texture
.vulkan_image_info()
.unwrap()
.image()
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the actual change: .image to .image().
When it was one line, cargo fmt reported an error in the CI.

coordinate_system_helper.use_logical_coordinates(&mut canvas)
}
CoordinateSystem::Physical => coordinate_system_helper.use_physical_coordinates(canvas),
CoordinateSystem::Logical => coordinate_system_helper.use_logical_coordinates(canvas),
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only changes are removing &mut but again cargo fmt complained about the block wrap. 🤷🏼‍♂️


[dependencies]
# rafx does not yet follow semver
rafx = { version = "=0.0.14", features = ["rafx-vulkan", "framework"] }
bincode = "1.3.1"
lazy_static = "1"
serde = { version = ">=1.0", features = ["derive"], optional = true }
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to add this to get around Linux build error in the CI workflow... 🤷🏼‍♂️

    Checking skulpin-renderer v0.14.1 (/home/runner/work/skulpin/skulpin/skulpin-renderer)
error: unexpected `cfg` condition value: `serde`
  --> skulpin-renderer/src/coordinates.rs:60:12
   |
60 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
   |            ^^^^^^^^^^^^^^^^^
   |
   = note: expected values for `feature` are: `complete`, `default`, `shaper`, `svg`, and `textlayout`
   = help: consider adding `serde` as a feature in `Cargo.toml`
   = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
   = note: `-D unexpected-cfgs` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(unexpected_cfgs)]`

@aclysma
Copy link
Owner

aclysma commented Oct 18, 2024

I've approved the CI to run, and if it passes I will merge it. However, I am not maintaining this crate anymore, and won't be pushing releases to crates.io. I'd be happy for you to fork and take the project further on your own if you'd like to do so.

@mpaperno
Copy link
Author

Thanks. And yea, I saw your note in the readme, and wasn't sure if you'd be interested. No worries about crates.io... we were already using the git source anyway. This whole update project is a side-track for me already, so I'm not sure about maintaining anything longer-term. But I'll "watch" this repo to see if anything comes up...

The MacOS CI builds are hanging on my repo as well... 5 hours and counting!

@mpaperno
Copy link
Author

I guess the Mac build never ran because OS 10.15 is no longer supported...? Would be nicer if it just threw an error or something!

Should finish up fine now, like https://github.com/mpaperno/skulpin/actions/runs/11408094934

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants