cacao
cacao copied to clipboard
Replace `core-foundation` and `core-graphics`
Message sending now requires types to implement Encode
, which these crates don't do (yet, though maybe they will, see https://github.com/servo/core-foundation-rs/pull/628). Since these crates are used quite infrequently, and we'll probably want to use icrate
later on anyhow, this PR replaces them.
This one makes sense to me, though I'm wondering if it doesn't make sense to batch all 3 of these PRs into one big PR and just merge that... I could be wrong but I think there's some things repeating across them (e.g *const Class
to static
changes). No idea if that'll make merging hell or not - though I'll defer to you given I don't want to ask for too much free work here. ;P
Don't worry about things being difficult to merge or not, I'll figure that out once https://github.com/ryanmcgrath/cacao/pull/30 is done (which is probably also why things are confusing rn; because that PR is "further ahead" than these).
Will do! Thanks!
On Mon, Aug 22, 2022 at 01:37, Mads Marquart @.***> wrote:
Don't worry about things being difficult to merge or not, I'll figure that out once #30 is done (which is probably also why things are confusing rn; because that PR is "further ahead" than these).
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
I think this one was what I wanted to do after #30.
Note the change in API for Image::draw
, which is unfortunate. It's not a strictly a needed change, but I wanted to avoid the direct dependency on core-graphics
since it locks the public API to the specific version cacao
depends on, and is used so little.
A few more notes:
-
NSRect
andCGRect
(and the others) are exactly equivalent, it's just that the version ofobjc2
that we're using here doesn't have the aliases defined for it. -
NSSize
currently restricts its input to be valid floating points; this turned out to be a bad idea, and I've removed that in a future version ofobjc2
Note the change in API for Image::draw, which is unfortunate. It's not a strictly a needed change, but I wanted to avoid the direct dependency on core-graphics since it locks the public API to the specific version cacao depends on, and is used so little.
Hmm, you're specifically referring to not needing CGContextRef
? I see what you mean, though it is definitely unfortunate... but then again, if there were to be other spots that use CGContextRef
, it might make sense to bite the bullet and at the very least feature-flag it.
How often does core-graphics
change anyway? It might not be a big deal to have it as a dependency.