Skip to content

Commit 2cb7b86

Browse files
committed
Fix deprecations in objc2-core-foundation v0.3.1
1 parent ba60228 commit 2cb7b86

2 files changed

Lines changed: 8 additions & 9 deletions

File tree

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,19 +81,19 @@ features = [
8181
]
8282

8383
[target.'cfg(target_vendor = "apple")'.dependencies]
84-
objc2-core-graphics = { version = "0.3.0", default-features = false, features = [
84+
objc2-core-graphics = { version = "0.3.1", default-features = false, features = [
8585
"std",
8686
"objc2",
8787
"CGColorSpace",
8888
"CGDataProvider",
8989
"CGImage",
9090
] }
9191
objc2 = "0.6.0"
92-
objc2-core-foundation = { version = "0.3.0", default-features = false, features = [
92+
objc2-core-foundation = { version = "0.3.1", default-features = false, features = [
9393
"std",
9494
"CFCGTypes",
9595
] }
96-
objc2-foundation = { version = "0.3.0", default-features = false, features = [
96+
objc2-foundation = { version = "0.3.1", default-features = false, features = [
9797
"std",
9898
"objc2-core-foundation",
9999
"NSDictionary",
@@ -103,7 +103,7 @@ objc2-foundation = { version = "0.3.0", default-features = false, features = [
103103
"NSThread",
104104
"NSValue",
105105
] }
106-
objc2-quartz-core = { version = "0.3.0", default-features = false, features = [
106+
objc2-quartz-core = { version = "0.3.1", default-features = false, features = [
107107
"std",
108108
"objc2-core-foundation",
109109
"CALayer",

src/backends/cg.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ use objc2::runtime::{AnyObject, Bool};
66
use objc2::{define_class, msg_send, AllocAnyThread, DefinedClass, MainThreadMarker, Message};
77
use objc2_core_foundation::{CFRetained, CGPoint};
88
use objc2_core_graphics::{
9-
CGBitmapInfo, CGColorRenderingIntent, CGColorSpace, CGColorSpaceCreateDeviceRGB,
10-
CGDataProviderCreateWithData, CGImageAlphaInfo, CGImageCreate,
9+
CGBitmapInfo, CGColorRenderingIntent, CGColorSpace, CGDataProvider, CGImage, CGImageAlphaInfo,
1110
};
1211
use objc2_foundation::{
1312
ns_string, NSDictionary, NSKeyValueChangeKey, NSKeyValueChangeNewKey,
@@ -229,7 +228,7 @@ impl<D: HasDisplayHandle, W: HasWindowHandle> SurfaceInterface<D, W> for CGImpl<
229228
layer.setContentsGravity(unsafe { kCAGravityTopLeft });
230229

231230
// Initialize color space here, to reduce work later on.
232-
let color_space = unsafe { CGColorSpaceCreateDeviceRGB() }.unwrap();
231+
let color_space = unsafe { CGColorSpace::new_device_rgb() }.unwrap();
233232

234233
// Grab initial width and height from the layer (whose properties have just been initialized
235234
// by the observer using `NSKeyValueObservingOptionInitial`).
@@ -310,12 +309,12 @@ impl<D: HasDisplayHandle, W: HasWindowHandle> BufferInterface for BufferImpl<'_,
310309
// SAFETY: The data pointer and length are valid.
311310
// The info pointer can safely be NULL, we don't use it in the `release` callback.
312311
unsafe {
313-
CGDataProviderCreateWithData(ptr::null_mut(), data_ptr, len, Some(release)).unwrap()
312+
CGDataProvider::with_data(ptr::null_mut(), data_ptr, len, Some(release)).unwrap()
314313
}
315314
};
316315

317316
let image = unsafe {
318-
CGImageCreate(
317+
CGImage::new(
319318
self.imp.width,
320319
self.imp.height,
321320
8,

0 commit comments

Comments
 (0)