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

core-graphics: move private APIs behind a private-apis feature flag, closes #707 #708

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions core-graphics/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ libc = "0.2"
default = ["link"]
elcapitan = []
highsierra = []
private-apis = []
# Disable to manually link. Enabled by default.
link = ["core-foundation/link", "core-graphics-types/link"]
6 changes: 4 additions & 2 deletions core-graphics/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use crate::font::{CGFont, CGGlyph};
use crate::geometry::{CGPoint, CGSize};
use crate::gradient::{CGGradient, CGGradientDrawingOptions};
use crate::path::CGPathRef;
use core::ffi::{c_int, c_void};
use core::ffi::c_void;
use core_foundation::base::{CFTypeID, TCFType};

use crate::geometry::{CGAffineTransform, CGRect};
Expand Down Expand Up @@ -223,6 +223,7 @@ impl CGContextRef {
unsafe { CGContextSetAllowsFontSmoothing(self.as_ptr(), allows_font_smoothing) }
}

#[cfg(feature = "private-apis")]
pub fn set_font_smoothing_style(&self, style: i32) {
unsafe {
CGContextSetFontSmoothingStyle(self.as_ptr(), style as _);
Expand Down Expand Up @@ -639,7 +640,8 @@ extern "C" {
fn CGContextSetBlendMode(c: crate::sys::CGContextRef, blendMode: CGBlendMode);
fn CGContextSetAllowsFontSmoothing(c: crate::sys::CGContextRef, allowsFontSmoothing: bool);
fn CGContextSetShouldSmoothFonts(c: crate::sys::CGContextRef, shouldSmoothFonts: bool);
fn CGContextSetFontSmoothingStyle(c: crate::sys::CGContextRef, style: c_int);
#[cfg(feature = "private-apis")]
fn CGContextSetFontSmoothingStyle(c: crate::sys::CGContextRef, style: core::ffi::c_int);
fn CGContextSetAllowsAntialiasing(c: crate::sys::CGContextRef, allowsAntialiasing: bool);
fn CGContextSetShouldAntialias(c: crate::sys::CGContextRef, shouldAntialias: bool);
fn CGContextSetAllowsFontSubpixelQuantization(
Expand Down