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

Lots of wrench fixes and features #660

Merged
merged 3 commits into from Jan 5, 2017
Merged

Lots of wrench fixes and features #660

merged 3 commits into from Jan 5, 2017

Conversation

@vvuk
Copy link
Contributor

vvuk commented Dec 22, 2016

Support for many new yaml display items, clips, and other bits.


This change is Reviewable

@vvuk vvuk force-pushed the vvuk:wrench branch from 59368a6 to 9cb51b8 Dec 22, 2016
Copy link
Member

glennw left a comment

Just a couple of nits.

self.top_right == uniform_radius &&
self.bottom_left == uniform_radius &&
self.bottom_right == uniform_radius
{

This comment has been minimized.

@glennw

glennw Dec 22, 2016

Member

nit: brace placement


pub fn is_uniform(&self) -> Option<f32> {
let uniform_radius = LayoutSize::new(self.top_left.width, self.top_left.width);
if self.top_left == uniform_radius &&

This comment has been minimized.

@glennw

glennw Dec 22, 2016

Member

nit: don't need to check top_left here.

@vvuk vvuk force-pushed the vvuk:wrench branch from 9cb51b8 to 9f4dce3 Dec 22, 2016
@vvuk
Copy link
Contributor Author

vvuk commented Dec 22, 2016

Fixed.

Copy link
Member

kvark left a comment

A lot of great stuff here!

@@ -18,6 +17,9 @@ lazy_static! {
static ref WEBRENDER_RECORDING_DETOUR: Arc<Mutex<Option<Box<ApiRecordingReceiver>>>> = Arc::new(Mutex::new(None));
}

pub static WEBRENDER_RECORDING_HEADER: u64 = 0xbeefbeefbeefbe01u64;
static mut CURRENT_FRAME_NUMBER: u32 = 0xffffffffu32;

This comment has been minimized.

@kvark

kvark Dec 22, 2016

Member

could do ~0, easier than to count f

let pct = pct_int as f32 / 100.;
let index_f = (values.len()-1) as f32 * pct;
let index = f32::floor(index_f) as usize;
if index == index_f as usize {

This comment has been minimized.

@kvark

kvark Dec 22, 2016

Member

any reason of not going with integer-only arithmetic?

let index_big = (values.len() - 1) * (pct_int as usize);
let index = index_big / 100;
if index * 100 != index_big {..} else {..}

let mut min_time = time::Duration::max_value();
let mut min_min_time = time::Duration::max_value();
let mut max_time = time::Duration::min_value();
let mut max_max_time = time::Duration::min_value();
let mut sum_time = time::Duration::zero();

let mut block_avg_ms = vec![];

This comment has been minimized.

@kvark

kvark Dec 22, 2016

Member

would better be called block_avg_durations, since ms here is incorrect

if let Some(limit) = limit_seconds {
if (time::SteadyTime::now() - time_start) >= limit {
let mut block_avg_ms = block_avg_ms.iter().map(|v| as_ms(*v)).collect::<Vec<f64>>();
block_avg_ms.sort_by(|a, b| a.partial_cmp(b).unwrap());
let avg_ms = block_avg_ms.iter().fold(0., |sum, v| sum + v) / block_avg_ms.len() as f64;

This comment has been minimized.

@kvark

kvark Dec 22, 2016

Member

nit: could use sum

frame_start_sender: timing_sender,
};

wrench.set_title("start");
// there's a "frame 0" that webrender itself renders; push this to
// not confuse our notifier
wrench.frame_start_sender.push(time::SteadyTime::now());

This comment has been minimized.

@kvark

kvark Dec 22, 2016

Member

nit: use wrench.begin_frame() instead?
perhaps, frame_start_sender doesn't even need to be public

let start = item["start"].as_point().expect("gradient must have start");
let end = item["end"].as_point().expect("gradient must have end");
let stops = if let Some(stops) = item["stops"].as_vec() {
// FIXME(vlad): I can't find the right way to do this with iterators;

This comment has been minimized.

@kvark

kvark Dec 22, 2016

Member

Chunks come to rescue:

let g_stops = stops.chunks(2).map(|chunk| GradientStop {
  offset: chunk[0].as_force_f32().expect("gradient stop offset is not f32"),
  color: chunk[1].as_colorf().expect("gradient stop color is not color"),
}).collect::<Vec<_>>();
}
}
}

fn handle_rect(&mut self, wrench: &mut Wrench, clip_region: &ClipRegion, item: &Yaml)
{

This comment has been minimized.

@kvark

kvark Dec 22, 2016

Member

opening brackets on the new line is against the rust style guidelines

let colors = item["color"].as_vec_colorf().expect("borders must have color(s)");
let styles = item["style"].as_vec_string().expect("borders must have style(s)");
let styles = styles.iter().map(|s| match s {
s if s == "none" => BorderStyle::None,

This comment has been minimized.

@kvark

kvark Dec 22, 2016

Member

You should be able to just do "something" => BorderStyle::Something without all the if in the matching

let border_radius = item["border_radius"].as_force_f32().unwrap_or(0.0);
let clip_mode = if let Some(mode) = item.as_str() {
match mode {
s if s == "none" => BoxShadowClipMode::None,

This comment has been minimized.

@kvark

kvark Dec 22, 2016

Member

same here. Just make sure you are matching &str and not something else

@@ -14,6 +13,7 @@ use std::path::{Path, PathBuf};
use webrender;
use webrender_traits::*;
use yaml_rust::{Yaml, YamlEmitter};
use time;

use super::CURRENT_FRAME_NUMBER;

This comment has been minimized.

@kvark

kvark Dec 22, 2016

Member

any reason we can't just store the frame number locally and pass it around?

@bors-servo
Copy link
Contributor

bors-servo commented Dec 28, 2016

The latest upstream changes (presumably #649) made this pull request unmergeable. Please resolve the merge conflicts.

@vvuk vvuk force-pushed the vvuk:wrench branch from 9f4dce3 to beee954 Jan 4, 2017
@bors-servo
Copy link
Contributor

bors-servo commented Jan 4, 2017

The latest upstream changes (presumably #677) made this pull request unmergeable. Please resolve the merge conflicts.

add flag to render only certain element types from YAML
Output summary stats at end of time-limited run
handle borders, box shadow, gradients in YAML
Add binary recording header before TypeId, and check for it; clean up binary replay
Fix yaml border stuff
print 10th/90th percentiles
add time prefix to resource filenames to avoid collisions
Add --play option to binary frame reader, and fix window title setting
Implement YAML clips properly
Fix StackingContext bounds to record the proper rect
Add 720p 1080p 4k size shorthand
Add support for complex clips to wrench
@vvuk vvuk force-pushed the vvuk:wrench branch from beee954 to 66c519f Jan 4, 2017
jrmuizel and others added 2 commits Jan 5, 2017
The field is called 'image_mask' so we might as well use that name.
@kvark
Copy link
Member

kvark commented Jan 5, 2017

Thanks @vvuk ! I think it's in good shape now. There are still minor issues to be addressed, but we can do it as a follow up, especially considering that someone is blocked by this PR (see #669).
@glennw - if you happy and you know it... merge this thing

@glennw
Copy link
Member

glennw commented Jan 5, 2017

@bors-servo
Copy link
Contributor

bors-servo commented Jan 5, 2017

📌 Commit 7ead5ff has been approved by glennw

@bors-servo
Copy link
Contributor

bors-servo commented Jan 5, 2017

Testing commit 7ead5ff with merge 69d1e15...

bors-servo added a commit that referenced this pull request Jan 5, 2017
Lots of wrench fixes and features

Support for many new yaml display items, clips, and other bits.

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

bors-servo commented Jan 5, 2017

☀️ Test successful - status-travis

@bors-servo bors-servo merged commit 7ead5ff into servo:master Jan 5, 2017
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
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

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