Skip to content

Commit

Permalink
Make CGFloat invisible to outside crates
Browse files Browse the repository at this point in the history
  • Loading branch information
madsmtm committed Aug 1, 2023
1 parent 7f191d1 commit d63a095
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion examples/raytracing/renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ impl Renderer {
frame_index: 0,
uniform_buffer_index: 0,
uniform_buffer_offset: 0,
size: CGSize::new(1024 as CGFloat, 1024 as CGFloat),
size: CGSize::new(1024.0, 1024.0),
semaphore: Semaphore::new((MAX_FRAMES_IN_FLIGHT - 2) as usize),
instance_buffer,
queue,
Expand Down
12 changes: 7 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ use std::{
};

use foreign_types::ForeignType;
pub(crate) use icrate::Foundation::NSRange;
pub use icrate::Foundation::{CGFloat, NSSize as CGSize};
pub(crate) use icrate::Foundation::{CGFloat, NSRange};
pub use icrate::Foundation::{NSSize as CGSize};
pub(crate) use objc2::encode::{Encode, Encoding, RefEncode};
use objc2::runtime::{AnyObject, Bool, Protocol};

Expand Down Expand Up @@ -498,11 +498,13 @@ impl MetalLayerRef {
unsafe { msg_send![self, nextDrawable] }
}

pub fn contents_scale(&self) -> CGFloat {
unsafe { msg_send![self, contentsScale] }
pub fn contents_scale(&self) -> f64 {
let res: CGFloat = unsafe { msg_send![self, contentsScale] };
res as f64
}

pub fn set_contents_scale(&self, scale: CGFloat) {
pub fn set_contents_scale(&self, scale: f64) {
let scale = scale as CGFloat;
unsafe { msg_send![self, setContentsScale: scale] }
}

Expand Down

0 comments on commit d63a095

Please sign in to comment.