mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Add disable-canvas-aa option to test runner.
This commit is contained in:
parent
adef44183d
commit
322fd5ad9d
5 changed files with 18 additions and 4 deletions
|
@ -14,6 +14,7 @@ use geom::size::Size2D;
|
||||||
use layers::platform::surface::NativeSurface;
|
use layers::platform::surface::NativeSurface;
|
||||||
use gfx_traits::color;
|
use gfx_traits::color;
|
||||||
use num::ToPrimitive;
|
use num::ToPrimitive;
|
||||||
|
use util::opts;
|
||||||
use util::task::spawn_named;
|
use util::task::spawn_named;
|
||||||
use util::vec::byte_swap;
|
use util::vec::byte_swap;
|
||||||
|
|
||||||
|
@ -174,8 +175,14 @@ struct CanvasPaintState<'a> {
|
||||||
|
|
||||||
impl<'a> CanvasPaintState<'a> {
|
impl<'a> CanvasPaintState<'a> {
|
||||||
fn new() -> CanvasPaintState<'a> {
|
fn new() -> CanvasPaintState<'a> {
|
||||||
|
let antialias = if opts::get().enable_canvas_antialiasing {
|
||||||
|
AntialiasMode::Default
|
||||||
|
} else {
|
||||||
|
AntialiasMode::None
|
||||||
|
};
|
||||||
|
|
||||||
CanvasPaintState {
|
CanvasPaintState {
|
||||||
draw_options: DrawOptions::default(),
|
draw_options: DrawOptions::new(1.0, CompositionOp::Over, antialias),
|
||||||
fill_style: Pattern::Color(ColorPattern::new(color::black())),
|
fill_style: Pattern::Color(ColorPattern::new(color::black())),
|
||||||
stroke_style: Pattern::Color(ColorPattern::new(color::black())),
|
stroke_style: Pattern::Color(ColorPattern::new(color::black())),
|
||||||
stroke_opts: StrokeOptions::new(1.0, JoinStyle::MiterOrBevel, CapStyle::Butt, 10.0, &[]),
|
stroke_opts: StrokeOptions::new(1.0, JoinStyle::MiterOrBevel, CapStyle::Butt, 10.0, &[]),
|
||||||
|
|
|
@ -99,6 +99,10 @@ pub struct Opts {
|
||||||
/// font for layout tests.
|
/// font for layout tests.
|
||||||
pub enable_text_antialiasing: bool,
|
pub enable_text_antialiasing: bool,
|
||||||
|
|
||||||
|
/// If set with --disable-canvas-aa, disable antialiasing on the HTML canvas element.
|
||||||
|
/// Like --disable-text-aa, this is useful for reftests where pixel perfect results are required.
|
||||||
|
pub enable_canvas_antialiasing: bool,
|
||||||
|
|
||||||
/// True if each step of layout is traced to an external JSON file
|
/// True if each step of layout is traced to an external JSON file
|
||||||
/// for debugging purposes. Settings this implies sequential layout
|
/// for debugging purposes. Settings this implies sequential layout
|
||||||
/// and paint.
|
/// and paint.
|
||||||
|
@ -220,6 +224,7 @@ pub fn default_opts() -> Opts {
|
||||||
show_debug_parallel_layout: false,
|
show_debug_parallel_layout: false,
|
||||||
paint_flashing: false,
|
paint_flashing: false,
|
||||||
enable_text_antialiasing: false,
|
enable_text_antialiasing: false,
|
||||||
|
enable_canvas_antialiasing: false,
|
||||||
trace_layout: false,
|
trace_layout: false,
|
||||||
devtools_port: None,
|
devtools_port: None,
|
||||||
webdriver_port: None,
|
webdriver_port: None,
|
||||||
|
@ -398,6 +403,7 @@ pub fn from_cmdline_args(args: &[String]) -> bool {
|
||||||
show_debug_parallel_layout: debug_options.contains(&"show-parallel-layout"),
|
show_debug_parallel_layout: debug_options.contains(&"show-parallel-layout"),
|
||||||
paint_flashing: debug_options.contains(&"paint-flashing"),
|
paint_flashing: debug_options.contains(&"paint-flashing"),
|
||||||
enable_text_antialiasing: !debug_options.contains(&"disable-text-aa"),
|
enable_text_antialiasing: !debug_options.contains(&"disable-text-aa"),
|
||||||
|
enable_canvas_antialiasing: !debug_options.contains(&"disable-canvas-aa"),
|
||||||
dump_flow_tree: debug_options.contains(&"dump-flow-tree"),
|
dump_flow_tree: debug_options.contains(&"dump-flow-tree"),
|
||||||
dump_display_list: debug_options.contains(&"dump-display-list"),
|
dump_display_list: debug_options.contains(&"dump-display-list"),
|
||||||
dump_display_list_optimized: debug_options.contains(&"dump-display-list-optimized"),
|
dump_display_list_optimized: debug_options.contains(&"dump-display-list-optimized"),
|
||||||
|
|
|
@ -73,6 +73,7 @@ pub extern "C" fn cef_initialize(args: *const cef_main_args_t,
|
||||||
temp_opts.headless = false;
|
temp_opts.headless = false;
|
||||||
temp_opts.hard_fail = false;
|
temp_opts.hard_fail = false;
|
||||||
temp_opts.enable_text_antialiasing = true;
|
temp_opts.enable_text_antialiasing = true;
|
||||||
|
temp_opts.enable_canvas_antialiasing = true;
|
||||||
temp_opts.resources_path = None;
|
temp_opts.resources_path = None;
|
||||||
temp_opts.url = None;
|
temp_opts.url = None;
|
||||||
opts::set(temp_opts);
|
opts::set(temp_opts);
|
||||||
|
|
|
@ -250,9 +250,9 @@ fn capture(reftest: &Reftest, side: usize) -> (u32, u32, Vec<u8>) {
|
||||||
.stdout(Stdio::null())
|
.stdout(Stdio::null())
|
||||||
.stderr(Stdio::null())
|
.stderr(Stdio::null())
|
||||||
.args(&reftest.servo_args[..])
|
.args(&reftest.servo_args[..])
|
||||||
// Allows pixel perfect rendering of Ahem font for reftests.
|
// Allows pixel perfect rendering of Ahem font and the HTML canvas for reftests.
|
||||||
.arg("-Z")
|
.arg("-Z")
|
||||||
.arg("disable-text-aa")
|
.arg("disable-text-aa,disable-canvas-aa")
|
||||||
.args(&["-f", "-o"])
|
.args(&["-f", "-o"])
|
||||||
.arg(&png_filename)
|
.arg(&png_filename)
|
||||||
.arg(&{
|
.arg(&{
|
||||||
|
|
|
@ -186,7 +186,7 @@ class ServoRefTestExecutor(ProcessTestExecutor):
|
||||||
|
|
||||||
with TempFilename(self.tempdir) as output_path:
|
with TempFilename(self.tempdir) as output_path:
|
||||||
self.command = [self.binary, "--cpu", "--hard-fail", "--exit",
|
self.command = [self.binary, "--cpu", "--hard-fail", "--exit",
|
||||||
"-Z", "disable-text-aa", "--output=%s" % output_path,
|
"-Z", "disable-text-aa,disable-canvas-aa", "--output=%s" % output_path,
|
||||||
full_url]
|
full_url]
|
||||||
|
|
||||||
env = os.environ.copy()
|
env = os.environ.copy()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue