Merge branch 'ps_export' of github.com:s3bk/pathfinder into ps_export
This commit is contained in:
commit
781074a0e6
|
@ -1537,6 +1537,16 @@ dependencies = [
|
||||||
"pathfinder_simd 0.3.0",
|
"pathfinder_simd 0.3.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pathfinder_pdf"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"deflate 0.7.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"pathfinder_content 0.1.0",
|
||||||
|
"pathfinder_geometry 0.3.0",
|
||||||
|
"pathfinder_renderer 0.1.0",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pathfinder_renderer"
|
name = "pathfinder_renderer"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
@ -2117,6 +2127,15 @@ dependencies = [
|
||||||
"usvg 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"usvg 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "svg2pdf"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"pathfinder_pdf 0.1.0",
|
||||||
|
"pathfinder_svg 0.1.0",
|
||||||
|
"usvg 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "svgdom"
|
name = "svgdom"
|
||||||
version = "0.17.0"
|
version = "0.17.0"
|
||||||
|
|
30
c/src/lib.rs
30
c/src/lib.rs
|
@ -13,8 +13,8 @@
|
||||||
use font_kit::handle::Handle;
|
use font_kit::handle::Handle;
|
||||||
use foreign_types::ForeignTypeRef;
|
use foreign_types::ForeignTypeRef;
|
||||||
use gl;
|
use gl;
|
||||||
use pathfinder_canvas::{CanvasFontContext, CanvasRenderingContext2D, FillStyle, LineJoin};
|
use pathfinder_canvas::{CanvasFontContext, CanvasRenderingContext2D, FillStyle, LineJoin, Path2D};
|
||||||
use pathfinder_canvas::{Path2D, TextMetrics};
|
use pathfinder_canvas::{TextAlign, TextMetrics};
|
||||||
use pathfinder_content::color::{ColorF, ColorU};
|
use pathfinder_content::color::{ColorF, ColorU};
|
||||||
use pathfinder_content::outline::ArcDirection;
|
use pathfinder_content::outline::ArcDirection;
|
||||||
use pathfinder_content::stroke::LineCap;
|
use pathfinder_content::stroke::LineCap;
|
||||||
|
@ -43,13 +43,17 @@ use pathfinder_metal::MetalDevice;
|
||||||
|
|
||||||
// `canvas`
|
// `canvas`
|
||||||
|
|
||||||
pub const PF_LINE_CAP_BUTT: u8 = 0;
|
pub const PF_LINE_CAP_BUTT: u8 = 0;
|
||||||
pub const PF_LINE_CAP_SQUARE: u8 = 1;
|
pub const PF_LINE_CAP_SQUARE: u8 = 1;
|
||||||
pub const PF_LINE_CAP_ROUND: u8 = 2;
|
pub const PF_LINE_CAP_ROUND: u8 = 2;
|
||||||
|
|
||||||
pub const PF_LINE_JOIN_MITER: u8 = 0;
|
pub const PF_LINE_JOIN_MITER: u8 = 0;
|
||||||
pub const PF_LINE_JOIN_BEVEL: u8 = 1;
|
pub const PF_LINE_JOIN_BEVEL: u8 = 1;
|
||||||
pub const PF_LINE_JOIN_ROUND: u8 = 2;
|
pub const PF_LINE_JOIN_ROUND: u8 = 2;
|
||||||
|
|
||||||
|
pub const PF_TEXT_ALIGN_LEFT: u8 = 0;
|
||||||
|
pub const PF_TEXT_ALIGN_CENTER: u8 = 1;
|
||||||
|
pub const PF_TEXT_ALIGN_RIGHT: u8 = 2;
|
||||||
|
|
||||||
// `content`
|
// `content`
|
||||||
|
|
||||||
|
@ -73,6 +77,7 @@ pub type PFFillStyleRef = *mut FillStyle;
|
||||||
pub type PFLineCap = u8;
|
pub type PFLineCap = u8;
|
||||||
pub type PFLineJoin = u8;
|
pub type PFLineJoin = u8;
|
||||||
pub type PFArcDirection = u8;
|
pub type PFArcDirection = u8;
|
||||||
|
pub type PFTextAlign = u8;
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct PFTextMetrics {
|
pub struct PFTextMetrics {
|
||||||
pub width: f32,
|
pub width: f32,
|
||||||
|
@ -290,6 +295,15 @@ pub unsafe extern "C" fn PFCanvasSetFontSize(canvas: PFCanvasRef, new_font_size:
|
||||||
(*canvas).set_font_size(new_font_size)
|
(*canvas).set_font_size(new_font_size)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub unsafe extern "C" fn PFCanvasSetTextAlign(canvas: PFCanvasRef, new_text_align: PFTextAlign) {
|
||||||
|
(*canvas).set_text_align(match new_text_align {
|
||||||
|
PF_TEXT_ALIGN_CENTER => TextAlign::Center,
|
||||||
|
PF_TEXT_ALIGN_RIGHT => TextAlign::Right,
|
||||||
|
_ => TextAlign::Left,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn PFCanvasSetFillStyle(canvas: PFCanvasRef, fill_style: PFFillStyleRef) {
|
pub unsafe extern "C" fn PFCanvasSetFillStyle(canvas: PFCanvasRef, fill_style: PFFillStyleRef) {
|
||||||
(*canvas).set_fill_style(*fill_style)
|
(*canvas).set_fill_style(*fill_style)
|
||||||
|
|
|
@ -868,6 +868,11 @@ impl MetalDevice {
|
||||||
|
|
||||||
render_command_encoder.use_resource(&data_buffer, MTLResourceUsage::Read);
|
render_command_encoder.use_resource(&data_buffer, MTLResourceUsage::Read);
|
||||||
|
|
||||||
|
// Metal expects the data buffer to remain live. (Issue #199.)
|
||||||
|
// FIXME(pcwalton): When do we deallocate this? What are the expected
|
||||||
|
// lifetime semantics?
|
||||||
|
mem::forget(data_buffer);
|
||||||
|
|
||||||
if let Some(vertex_argument_buffer) = vertex_argument_buffer {
|
if let Some(vertex_argument_buffer) = vertex_argument_buffer {
|
||||||
let range = NSRange::new(0, vertex_argument_buffer.length());
|
let range = NSRange::new(0, vertex_argument_buffer.length());
|
||||||
vertex_argument_buffer.did_modify_range(range);
|
vertex_argument_buffer.did_modify_range(range);
|
||||||
|
|
Loading…
Reference in New Issue