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

Cgdisplaymode extensions #253

Merged
merged 5 commits into from Sep 18, 2018
Merged

Cgdisplaymode extensions #253

merged 5 commits into from Sep 18, 2018

Conversation

@bn3t
Copy link
Contributor

bn3t commented Sep 8, 2018

I am writing a tool to change resolution on MacOS. For this I needed, more support for CGDisplayMode methods. I also need support for CGConfigureDisplayWithDisplayMode().


This change is Reviewable

core-graphics/src/display.rs Show resolved Hide resolved
} else if pixel_encoding.eq_ignore_ascii_case(IO8BitIndexedPixels) {
depth = 8;
}
return depth as usize;

This comment has been minimized.

@jdm

jdm Sep 11, 2018

Member

Let's write this as:

pub fn bit_depth(&self) -> usize {
    let pixel_encoding = self.pixel_encoding().to_string();
    // my numerical representation for kIO16BitFloatPixels and kIO32bitFloatPixels
    // are made up and possibly non-sensical
    if pixel_encoding.eq_ignore_ascii_case(kIO32BitFloatPixels) {
        96
    } else if ... {
        64
        ...
    } else {
        0
    }
}
core-graphics/src/display.rs Outdated Show resolved Hide resolved
@@ -536,6 +610,19 @@ extern "C" {
pub fn CGDisplayBounds(display: CGDirectDisplayID) -> CGRect;
pub fn CGDisplayCreateImage(display: CGDirectDisplayID) -> ::sys::CGImageRef;

pub fn CGBeginDisplayConfiguration(config: *const *mut libc::c_void) -> CGError;

This comment has been minimized.

@jdm

jdm Sep 11, 2018

Member

Shouldn't this be config: *mut CGDisplayConfigRef?

pub fn CGBeginDisplayConfiguration(config: *const *mut libc::c_void) -> CGError;
pub fn CGCancelDisplayConfiguration(config: CGDisplayConfigRef) -> CGError;
pub fn CGCompleteDisplayConfiguration(
config: *const libc::c_void,

This comment has been minimized.

@jdm

jdm Sep 11, 2018

Member

CGDisplayConfigRef?

option: CGConfigureOption,
) -> CGError;
pub fn CGConfigureDisplayWithDisplayMode(
config: *const libc::c_void,

This comment has been minimized.

@jdm

jdm Sep 11, 2018

Member

CGDisplayConfigRef?

@bn3t
Copy link
Contributor Author

bn3t commented Sep 17, 2018

I have applied all remarks. Is there more things I need to do before this can be merged?

@jdm
Copy link
Member

jdm commented Sep 18, 2018

@bors-servo
Copy link
Contributor

bors-servo commented Sep 18, 2018

📌 Commit f58e2b6 has been approved by jdm

@bors-servo
Copy link
Contributor

bors-servo commented Sep 18, 2018

Testing commit f58e2b6 with merge 27d8f9e...

bors-servo added a commit that referenced this pull request Sep 18, 2018
Cgdisplaymode extensions

I am writing a tool to change resolution on MacOS. For this I needed, more support for CGDisplayMode methods. I also need support for CGConfigureDisplayWithDisplayMode().

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-foundation-rs/253)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Sep 18, 2018

☀️ Test successful - status-travis
Approved by: jdm
Pushing 27d8f9e to master...

@bors-servo bors-servo merged commit f58e2b6 into servo:master Sep 18, 2018
2 of 3 checks passed
2 of 3 checks passed
code-review/reviewable 1 file left
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@bn3t
Copy link
Contributor Author

bn3t commented Sep 18, 2018

Hi, thanks for the merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.