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

pipe through a scene_id to distinguish cached pictures #2776

Merged
merged 2 commits into from Jun 4, 2018
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Next

Add rawtest for blur caching

  • Loading branch information
Gankra committed Jun 4, 2018
commit 0f6e0aeef6235fe4a8b4b36d7d2a8b4f6718d827
@@ -49,6 +49,7 @@ impl<'a> RawtestHarness<'a> {
self.test_very_large_blob();
self.test_offscreen_blob();
self.test_save_restore();
self.test_blur_cache();
self.test_capture();
self.test_zero_height_window();
}
@@ -720,6 +721,51 @@ impl<'a> RawtestHarness<'a> {
assert_eq!(first, second);
}

// regression test for #2769
// "async scene building: cache collisions from reused picture ids"
fn test_blur_cache(&mut self) {
println!("\tblur cache...");
let window_size = self.window.get_inner_size();

let test_size = DeviceUintSize::new(400, 400);

let window_rect = DeviceUintRect::new(
DeviceUintPoint::new(0, window_size.height - test_size.height),
test_size,
);
let layout_size = LayoutSize::new(400., 400.);

let mut do_test = |shadow_is_red| {
let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id, layout_size);
let shadow_color = if shadow_is_red {
ColorF::new(1.0, 0.0, 0.0, 1.0)
} else {
ColorF::new(0.0, 1.0, 0.0, 1.0)
};

builder.push_shadow(&PrimitiveInfo::new(rect(100., 100., 100., 100.)),
Shadow {
offset: LayoutVector2D::new(1.0, 1.0),
blur_radius: 1.0,
color: shadow_color,
});
builder.push_line(&PrimitiveInfo::new(rect(110., 110., 50., 2.)),
0.0, LineOrientation::Horizontal,
&ColorF::new(0.0, 0.0, 0.0, 1.0), LineStyle::Solid);
builder.pop_all_shadows();

let txn = Transaction::new();
self.submit_dl(&mut Epoch(0), layout_size, builder, &txn.resource_updates);

self.render_and_get_pixels(window_rect)
};

let first = do_test(false);
let second = do_test(true);

assert_ne!(first, second);
}

fn test_capture(&mut self) {
println!("\tcapture...");
let path = "../captures/test";
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.