Merge pull request #218 from s3bk/master

fixes and a possible canvas addition
This commit is contained in:
Patrick Walton 2019-07-22 15:17:29 -07:00 committed by GitHub
commit 842348c65f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 53 additions and 7 deletions

View File

@ -8,4 +8,7 @@ addons:
- cmake
script:
- cargo build
# - cargo test # todo: fix tests
- cargo test
env:
global:
- HARFBUZZ_SYS_NO_PKG_CONFIG=true

View File

@ -31,3 +31,32 @@ members = [
"utils/svg-to-skia",
"utils/convert",
]
default-members = [
"c",
"canvas",
"content",
"demo/common",
"demo/native",
"examples/canvas_glutin_minimal",
"examples/canvas_minimal",
"examples/canvas_moire",
"examples/canvas_text",
"examples/lottie_basic",
"examples/swf_basic",
"geometry",
"gl",
"gpu",
"lottie",
"export",
"renderer",
"simd",
"svg",
"swf",
"text",
"ui",
"utils/area-lut",
"utils/gamma-lut",
"utils/svg-to-skia",
"utils/convert",
]

View File

@ -102,6 +102,16 @@ impl CanvasRenderingContext2D {
TextMetrics { width: self.layout_text(string).width() }
}
pub fn fill_layout(&mut self, layout: &Layout, transform: Transform2F) {
let paint_id = self.scene.push_paint(&self.current_state.fill_paint);
drop(self.scene.push_layout(&layout,
&TextStyle { size: self.current_state.font_size },
&(transform * self.current_state.transform),
TextRenderMode::Fill,
HintingOptions::None,
paint_id));
}
fn fill_or_stroke_text(&mut self,
string: &str,
mut position: Vector2F,

View File

@ -14,7 +14,9 @@
pub trait Executor {
/// Like the Rayon snippet:
///
/// (0..length).into_par_iter().flat_map(builder).collect()
/// ```norun
/// (0..length).into_par_iter().flat_map(builder).collect()
/// ```
fn flatten_into_vector<T, F>(&self, length: usize, builder: F) -> Vec<T>
where T: Send, F: Fn(usize) -> Vec<T> + Send + Sync;
}

View File

@ -77,9 +77,11 @@ impl SceneProxy {
///
/// Exactly equivalent to:
///
/// for command in scene_proxy.build_with_stream(options) {
/// renderer.render_command(&command)
/// }
/// ```norun
/// for command in scene_proxy.build_with_stream(options) {
/// renderer.render_command(&command)
/// }
/// ```
#[inline]
pub fn build_and_render<D>(&self, renderer: &mut Renderer<D>, build_options: BuildOptions)
where D: Device {

View File

@ -94,12 +94,12 @@ impl Shape {
#[inline]
fn first(&self) -> LineSegment {
self.outline.first().unwrap()
*self.outline.first().unwrap()
}
#[inline]
fn last(&self) -> LineSegment {
self.outline.last().unwrap()
*self.outline.last().unwrap()
}
#[inline]