Commit Graph

248 Commits

Author SHA1 Message Date
bors-servo 956f58d595 Auto merge of #105 - servo:reexport, r=jdm
Reexport FFI functions that were made private for no reason

<!-- 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-graphics-rs/105)
<!-- Reviewable:end -->
2017-11-17 08:11:55 -06:00
Anthony Ramine e7d15ead28 Reexport FFI functions that were made private for no reason 2017-11-17 11:21:11 +01:00
bors-servo de898c8ee9 Auto merge of #103 - pcwalton:units-per-em, r=emilio
Add a binding to `CGFontGetUnitsPerEm()`

Pathfinder 2 is using this. It saves a little bit of time and memory by avoiding creation of `CTFont` objects just to do this simple query.

r? @jdm

<!-- 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-graphics-rs/103)
<!-- Reviewable:end -->
2017-11-13 22:41:22 -06:00
Patrick Walton b11b04db2e Add a binding to CGFontGetUnitsPerEm() 2017-11-13 20:13:26 -08:00
bors-servo 9f59db427c Auto merge of #101 - pcwalton:cg-data-provider-fix, r=jdm
Fix memory safety problem in `CGDataProvider::from_buffer()`.

The wrapper for that function made no attempt to ensure that the buffer
would stay alive, and as a result use-after-free could easily occur. The
fix is to require that the buffer be stuffed in an `Arc` box and to
teach Core Graphics how to release the `Arc` when it's done with it.

Related: #77. (This is basically a more minimal version of that PR. I had seen #77 but didn't realize that it was a memory safety problem! If you'd like to merge that PR instead, feel free.)

r? @jdm

<!-- 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-graphics-rs/101)
<!-- Reviewable:end -->
2017-10-31 09:26:51 -05:00
bors-servo 865966ebf8 Auto merge of #102 - pcwalton:show-glyphs, r=jdm
Add bindings to `CGContextSetFont(Size)` and `CGContextShowGlyphsAtPositions`.

These functions allow for a minor time savings by avoiding Core Text
font creation in the Pathfinder native rasterization functionality.

r? @jdm

<!-- 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-graphics-rs/102)
<!-- Reviewable:end -->
2017-10-31 09:16:53 -05:00
Patrick Walton 8ece71ab12 Add bindings to CGContextSetFont(Size) and
`CGContextShowGlyphsAtPositions`.

These functions allow for a minor time savings by avoiding Core Text
font creation in the Pathfinder native rasterization functionality.
2017-10-26 13:54:27 -07:00
Patrick Walton df8dcca9b5 Fix memory safety problem in CGDataProvider::from_buffer().
The wrapper for that function made no attempt to ensure that the buffer
would stay alive, and as a result use-after-free could easily occur. The
fix is to require that the buffer be stuffed in an `Arc` box and to
teach Core Graphics how to release the `Arc` when it's done with it.
2017-10-25 16:46:12 -07:00
bors-servo df74138ac1 Auto merge of #100 - pcwalton:pathfinder, r=metajack
Add bindings needed by Pathfinder

The bulk of this consists of `CGPath` routines, which I needed in Pathfinder 2.

r? anyone

<!-- 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-graphics-rs/100)
<!-- Reviewable:end -->
2017-10-19 23:43:40 -05:00
Patrick Walton 0ff1403c56 Bump version to 0.11.0 2017-10-19 20:31:26 -07:00
Patrick Walton abe37e92e9 Add CGPath bindings 2017-10-19 20:31:10 -07:00
Patrick Walton 63811809fd Add bindings to CGFontGetGlyphBBoxes() and CGFontGetGlyphAdvances() 2017-10-19 20:31:01 -07:00
Patrick Walton 5e8f34b936 Flesh out geometry a bit more 2017-10-19 20:30:29 -07:00
bors-servo 1dec303abf Auto merge of #99 - ratake:master, r=jdm
Add support for iOS targets

Only include `CGEvent` and `CGDisplay` on macOS, and link against `CoreGraphics` specifically, not the macOS umbrella framework.

<!-- 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-graphics-rs/99)
<!-- Reviewable:end -->
2017-10-17 07:28:23 -05:00
ratake 82331e7736 Add support for iOS targets
Only include CGEvent and CGDisplay on macOS
2017-10-16 22:50:52 -07:00
bors-servo 56adc70c01 Auto merge of #98 - Eijebong:bitflags, r=jdm
Update bitflags to 1.0 and bump version

<!-- 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-graphics-rs/98)
<!-- Reviewable:end -->
2017-10-12 07:25:30 -05:00
Bastien Orivel 8f3f6b34aa Update bitflags to 1.0 and bump version 2017-10-12 11:12:59 +02:00
bors-servo 9c29d9615b Auto merge of #97 - msanders:ms/cgdisplaymode, r=jdm
Add support for CGDisplayMode & safe CGDisplay wrapper

<!-- 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-graphics-rs/97)
<!-- Reviewable:end -->
2017-10-09 10:09:39 -05:00
Michael Sanders 12a8f0c0a6 Add support for CGDisplayMode & safe CGDisplay wrapper 2017-10-09 06:59:20 -07:00
bors-servo abf5f7c858 Auto merge of #96 - msanders:ms/event-value-field, r=jdm
Add support for CGEvent value fields

<!-- 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-graphics-rs/96)
<!-- Reviewable:end -->
2017-10-08 07:34:50 -05:00
bors-servo a1f4d07bfa Auto merge of #95 - msanders:ms/add-key-codes, r=jdm
Add universal key code constants

<!-- 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-graphics-rs/95)
<!-- Reviewable:end -->
2017-10-08 07:31:42 -05:00
Michael Sanders 2eaf8b5b03 Add support for CGEvent value fields 2017-10-07 17:09:35 -07:00
Michael Sanders 35312c56db Add universal key code constants 2017-10-08 03:58:17 +05:30
bors-servo 930e98f3d9 Auto merge of #94 - pornel:cs, r=jdm
Add named color spaces

<!-- 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-graphics-rs/94)
<!-- Reviewable:end -->
2017-10-04 19:52:34 -05:00
Kornel 3091be3a44 Named color spaces 2017-10-04 11:18:08 +01:00
bors-servo bfdd5ab170 Auto merge of #92 - pornel:foreign-types, r=jdm
Use foreign types crate

As suggested in #81, changed TCFType boilerplate to foreign-types.

<!-- 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-graphics-rs/92)
<!-- Reviewable:end -->
2017-10-02 08:58:51 -05:00
bors-servo cfefff813b Auto merge of #93 - amccreight:patch-1, r=KiChjang
Fix typo in event.rs

<!-- 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-graphics-rs/93)
<!-- Reviewable:end -->
2017-09-19 16:33:28 -05:00
Andrew McCreight df2bd7ea4f Fix typo in event.rs 2017-09-19 14:18:00 -07:00
Kornel a7e05d2e38 Missed change 2017-09-16 02:32:47 +01:00
Kornel 40ee246bec Use foreign-types for CGEventSource 2017-09-15 00:47:06 +01:00
Kornel c86445c76f Use foreign-types for CGContext 2017-09-15 00:47:06 +01:00
Kornel 8c0664a542 Hide foreign-types internals from docs 2017-09-15 00:47:06 +01:00
Kornel 81a2c1dc9d Use foreign-types for CGEvent 2017-09-15 00:47:06 +01:00
Kornel 1993281ca6 Use foreign-types for CGFont 2017-09-15 00:47:06 +01:00
Kornel ae15062bf1 Use foreign-types for CGDataProvider 2017-09-15 00:47:06 +01:00
Kornel 045fa8ca48 Use foreign-types to manage CGColorSpace 2017-09-15 00:47:06 +01:00
Kornel 14f286f8e9 Use foreign-types to manage CFImage 2017-09-15 00:47:06 +01:00
Kornel 987ec455b4 Test 2017-09-15 00:02:53 +01:00
Kornel e0b23498ff Silence warning 2017-09-14 23:17:38 +01:00
bors-servo 6db694d4dd Auto merge of #90 - rthomas:89-warnings, r=jdm
Remove warnings for zero-sized structs

This change removes a bunch of warnings from the crate.

The only remaining warnings are due to the bitflags macro usage.

This will help fix servo/core-text-rs#62 when it upgrades to `core-graphics = 0.9`.

@jdm

<!-- 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-graphics-rs/90)
<!-- Reviewable:end -->
2017-07-27 15:33:02 -05:00
Ryan Thomas 4e29474449 Remove testing path of core-foundation. 2017-07-27 20:39:18 +01:00
Ryan Thomas 7fbe5d50ab Bump version number to 0.9.1. 2017-07-27 20:25:19 +01:00
Ryan Thomas 08f5ffd4bf Squash warnings on zero-sized structs #89.
Changes zero-sized structs to an `enum` and removed unused macro use statement.
2017-07-27 19:46:50 +01:00
Ryan Thomas b0b6dcdbaa Remove warnings for zero-sized structs #89.
This follows the servo pattern mentioned in
https://github.com/rust-lang/rust/issues/27303 to replace the zero-sized
structs with an `enum`.
2017-07-27 19:46:36 +01:00
bors-servo 4ede46bf1c Auto merge of #88 - snapview:cgwindowlist, r=jdm
Add CGWindowListCreateImageFromArray()

Just adds a binding to one small function.

<!-- 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-graphics-rs/88)
<!-- Reviewable:end -->
2017-07-25 07:30:10 -07:00
Daniel Abramov 7066159155 Add CGWindowListCreateImageFromArray() 2017-07-24 16:54:13 +02:00
bors-servo aeb81086b5 Auto merge of #87 - snapview:display, r=KiChjang
Adds an additional display function + bumps core-foundation dependency version

This is a small pull request, basically it adds the following things:

1. Adds a missing `CGDisplayCreateImage()` function, so that now the user has all required functions to capture static images (it was already implemented for window capturing and now the display capturing is also possible).
2. Adds a couple functions to `CGRect`.
3. Updates the version for `core-foundation` from `0.3` to `0.4`. I'm not sure if using `0.3` makes sense if we can use `0.4`. For me personally it was required to change it as my project depends on several crates, including the latest `core-foundation` version, so when I have both `core-graphics` and `core-foundation` in my dependencies, `core-foundation` has been compiled twice (once for `0.4` which is the new version and once for the old `0.3` which has been downloaded and compiled as one of the `core-graphics` dependencies). So basically the people who use the both `core-graphics` and `core-foundation` (the last versions) would encounter the same problems (`core-foundation` is compiled twice and it may cause compile time errors like it was in my case). What are your thoughts on these?

<!-- 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-graphics-rs/87)
<!-- Reviewable:end -->
2017-07-04 02:24:36 -07:00
Daniel Abramov f9f22263d8 Add a couple additional CGRect functions 2017-07-04 10:52:10 +02:00
Daniel Abramov c60afb8261 Update core-foundation version, bump crate version 2017-07-04 10:52:00 +02:00
Daniel Abramov f9d4aa4dea Add missing CGDisplayCreateImage() function. 2017-07-04 10:50:52 +02:00