From f9d4aa4deaefcab197d764c8306367603e357f13 Mon Sep 17 00:00:00 2001 From: Daniel Abramov Date: Thu, 27 Apr 2017 16:43:41 +0200 Subject: [PATCH 1/3] Add missing `CGDisplayCreateImage()` function. --- src/display.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/display.rs b/src/display.rs index 5328737..e398730 100644 --- a/src/display.rs +++ b/src/display.rs @@ -76,6 +76,7 @@ extern { pub fn CGDisplayPixelsHigh(display: CGDirectDisplayID) -> libc::size_t; pub fn CGDisplayPixelsWide(display: CGDirectDisplayID) -> libc::size_t; pub fn CGDisplayBounds(display: CGDirectDisplayID) -> CGRect; + pub fn CGDisplayCreateImage(display: CGDirectDisplayID) -> CGImageRef; // mouse stuff pub fn CGDisplayHideCursor(display: CGDirectDisplayID) -> CGError; From c60afb8261b02bc3e0fbd44f44e1a2de37299b5e Mon Sep 17 00:00:00 2001 From: Daniel Abramov Date: Thu, 8 Jun 2017 10:41:30 +0200 Subject: [PATCH 2/3] Update core-foundation version, bump crate version --- Cargo.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index dae4dc4..88c95e4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ name = "core-graphics" description = "Bindings to Core Graphics for OS X" homepage = "https://github.com/servo/core-graphics-rs" repository = "https://github.com/servo/core-graphics-rs" -version = "0.8.2" +version = "0.9.0" authors = ["The Servo Project Developers"] license = "MIT / Apache-2.0" @@ -12,6 +12,6 @@ default = [] elcapitan = [] [dependencies] -libc = "0.2" -core-foundation = "0.3" bitflags = "0.9" +core-foundation = "0.4" +libc = "0.2" From f9f22263d81504368304acab8882eaf197d68033 Mon Sep 17 00:00:00 2001 From: Daniel Abramov Date: Tue, 20 Jun 2017 12:08:09 +0200 Subject: [PATCH 3/3] Add a couple additional CGRect functions --- src/geometry.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/geometry.rs b/src/geometry.rs index 9497fbb..9f165b2 100644 --- a/src/geometry.rs +++ b/src/geometry.rs @@ -85,6 +85,22 @@ impl CGRect { Some(rect) } } + + #[inline] + pub fn is_empty(&self) -> bool { + unsafe { + // I use one, as it seems that `YES` is not available from this crate. + ffi::CGRectIsEmpty(*self) == 1 + } + } + + #[inline] + pub fn is_intersects(&self, other: &CGRect) -> bool { + unsafe { + // I use one, as it seems that `YES` is not available from this crate. + ffi::CGRectIntersectsRect(*self, *other) == 1 + } + } } mod ffi { @@ -97,6 +113,8 @@ mod ffi { pub fn CGRectInset(rect: CGRect, dx: CGFloat, dy: CGFloat) -> CGRect; pub fn CGRectMakeWithDictionaryRepresentation(dict: CFDictionaryRef, rect: *mut CGRect) -> boolean_t; + pub fn CGRectIsEmpty(rect: CGRect) -> boolean_t; + pub fn CGRectIntersectsRect(rect1: CGRect, rect2: CGRect) -> boolean_t; } }