Turn off default antialiasing for most DrawOptions.

This commit is contained in:
Mátyás Mustoha 2015-05-21 12:38:55 +02:00
parent 322fd5ad9d
commit f4c0bd3b80
7 changed files with 28 additions and 15 deletions

View file

@ -5,7 +5,7 @@
use azure::azure::AzFloat; use azure::azure::AzFloat;
use azure::azure_hl::{DrawTarget, SurfaceFormat, BackendType, StrokeOptions, DrawOptions, Pattern}; use azure::azure_hl::{DrawTarget, SurfaceFormat, BackendType, StrokeOptions, DrawOptions, Pattern};
use azure::azure_hl::{ColorPattern, PathBuilder, DrawSurfaceOptions, Filter}; use azure::azure_hl::{ColorPattern, PathBuilder, DrawSurfaceOptions, Filter};
use azure::azure_hl::{JoinStyle, CapStyle}; use azure::azure_hl::{JoinStyle, CapStyle, CompositionOp, AntialiasMode};
use canvas_traits::*; use canvas_traits::*;
use geom::matrix2d::Matrix2D; use geom::matrix2d::Matrix2D;
use geom::point::Point2D; use geom::point::Point2D;
@ -80,7 +80,7 @@ impl<'a> CanvasPaintTask<'a> {
image_size, image_size.width * 4, SurfaceFormat::B8G8R8A8); image_size, image_size.width * 4, SurfaceFormat::B8G8R8A8);
let draw_surface_options = DrawSurfaceOptions::new(filter, true); let draw_surface_options = DrawSurfaceOptions::new(filter, true);
let draw_options = DrawOptions::new(self.state.draw_options.alpha, CompositionOp::Over, AntialiasMode::Default); let draw_options = DrawOptions::new(self.state.draw_options.alpha, CompositionOp::Over, AntialiasMode::None);
self.drawtarget.draw_surface(source_surface, self.drawtarget.draw_surface(source_surface,
dest_rect.to_azfloat(), dest_rect.to_azfloat(),

View file

@ -159,7 +159,7 @@ impl<'a> PaintContext<'a> {
} }
}; };
let draw_options = DrawOptions::default(); let draw_options = DrawOptions::new(1.0, CompositionOp::Over, AntialiasMode::None);
draw_target_ref.draw_surface(azure_surface, draw_target_ref.draw_surface(azure_surface,
dest_rect, dest_rect,
source_rect, source_rect,
@ -173,7 +173,7 @@ impl<'a> PaintContext<'a> {
self.page_rect.origin.y as AzFloat), self.page_rect.origin.y as AzFloat),
Size2D(self.screen_rect.size.width as AzFloat, Size2D(self.screen_rect.size.width as AzFloat,
self.screen_rect.size.height as AzFloat)); self.screen_rect.size.height as AzFloat));
let mut draw_options = DrawOptions::default(); let mut draw_options = DrawOptions::new(1.0, CompositionOp::Over, AntialiasMode::None);
draw_options.set_composition_op(CompositionOp::Source); draw_options.set_composition_op(CompositionOp::Source);
self.draw_target.make_current(); self.draw_target.make_current();
self.draw_target.fill_rect(&rect, PatternRef::Color(&pattern), Some(&draw_options)); self.draw_target.fill_rect(&rect, PatternRef::Color(&pattern), Some(&draw_options));
@ -290,7 +290,7 @@ impl<'a> PaintContext<'a> {
color: Color) { color: Color) {
let mut path_builder = self.draw_target.create_path_builder(); let mut path_builder = self.draw_target.create_path_builder();
self.create_border_path_segment(&mut path_builder, bounds, direction, border, radii); self.create_border_path_segment(&mut path_builder, bounds, direction, border, radii);
let draw_options = DrawOptions::default(); let draw_options = DrawOptions::new(1.0, CompositionOp::Over, AntialiasMode::None);
self.draw_target.fill(&path_builder.finish(), &ColorPattern::new(color), &draw_options); self.draw_target.fill(&path_builder.finish(), &ColorPattern::new(color), &draw_options);
} }
@ -617,7 +617,7 @@ impl<'a> PaintContext<'a> {
color: Color, color: Color,
dash_size: DashSize) { dash_size: DashSize) {
let rect = bounds.to_nearest_azure_rect(); let rect = bounds.to_nearest_azure_rect();
let draw_opts = DrawOptions::default(); let draw_opts = DrawOptions::new(1.0, CompositionOp::Over, AntialiasMode::None);
let border_width = match direction { let border_width = match direction {
Direction::Top => border.top, Direction::Top => border.top,
Direction::Left => border.left, Direction::Left => border.left,
@ -960,7 +960,7 @@ impl<'a> PaintContext<'a> {
&mut accum_blur); &mut accum_blur);
// Perform the blit operation. // Perform the blit operation.
let mut draw_options = DrawOptions::new(opacity, CompositionOp::Over, AntialiasMode::Default); let mut draw_options = DrawOptions::new(opacity, CompositionOp::Over, AntialiasMode::None);
draw_options.set_composition_op(blend_mode.to_azure_composition_op()); draw_options.set_composition_op(blend_mode.to_azure_composition_op());
// If there is a blur expansion, shift the transform and update the size. // If there is a blur expansion, shift the transform and update the size.
@ -1024,7 +1024,7 @@ impl<'a> PaintContext<'a> {
// Draw the shadow, and blur if we need to. // Draw the shadow, and blur if we need to.
temporary_draw_target.draw_target.fill(&path, temporary_draw_target.draw_target.fill(&path,
&ColorPattern::new(color), &ColorPattern::new(color),
&DrawOptions::default()); &DrawOptions::new(1.0, CompositionOp::Over, AntialiasMode::None));
self.blur_if_necessary(temporary_draw_target, blur_radius); self.blur_if_necessary(temporary_draw_target, blur_radius);
// Undo the draw target's clip if we need to, and push back the stacking context clip. // Undo the draw target's clip if we need to, and push back the stacking context clip.
@ -1414,7 +1414,7 @@ impl TemporaryDrawTarget {
main_draw_target.draw_filter(&filter, main_draw_target.draw_filter(&filter,
&Rect(Point2D(0.0, 0.0), temporary_draw_target_size), &Rect(Point2D(0.0, 0.0), temporary_draw_target_size),
&self.offset, &self.offset,
DrawOptions::default()); DrawOptions::new(1.0, CompositionOp::Over, AntialiasMode::None));
main_draw_target.set_transform(&main_draw_target_transform); main_draw_target.set_transform(&main_draw_target_transform);
} }

View file

@ -41,7 +41,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "azure" name = "azure"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/servo/rust-azure#f1c5e98201e4c2d7684a388596979ce862788a9e" source = "git+https://github.com/servo/rust-azure#5b9f2dbe7517196a82ea3c9c4dc4cf9fbd7d0867"
dependencies = [ dependencies = [
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)", "core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)",
"core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics)", "core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics)",
@ -52,7 +52,7 @@ dependencies = [
"geom 0.1.0 (git+https://github.com/servo/rust-geom)", "geom 0.1.0 (git+https://github.com/servo/rust-geom)",
"libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"skia 0.0.20130412 (git+https://github.com/servo/skia)", "skia 0.0.20130412 (git+https://github.com/servo/skia)",
"xlib 0.1.0 (git+https://github.com/servo/rust-xlib)", "x11 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -479,6 +479,7 @@ dependencies = [
"layers 0.1.0 (git+https://github.com/servo/rust-layers)", "layers 0.1.0 (git+https://github.com/servo/rust-layers)",
"libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"msg 0.0.1", "msg 0.0.1",
"net 0.0.1",
"script_traits 0.0.1", "script_traits 0.0.1",
"time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
"url 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "url 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",

4
ports/cef/Cargo.lock generated
View file

@ -40,7 +40,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "azure" name = "azure"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/servo/rust-azure#f1c5e98201e4c2d7684a388596979ce862788a9e" source = "git+https://github.com/servo/rust-azure#5b9f2dbe7517196a82ea3c9c4dc4cf9fbd7d0867"
dependencies = [ dependencies = [
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)", "core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)",
"core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics)", "core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics)",
@ -51,7 +51,7 @@ dependencies = [
"geom 0.1.0 (git+https://github.com/servo/rust-geom)", "geom 0.1.0 (git+https://github.com/servo/rust-geom)",
"libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"skia 0.0.20130412 (git+https://github.com/servo/skia)", "skia 0.0.20130412 (git+https://github.com/servo/skia)",
"xlib 0.1.0 (git+https://github.com/servo/rust-xlib)", "x11 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]

4
ports/gonk/Cargo.lock generated
View file

@ -27,7 +27,7 @@ dependencies = [
[[package]] [[package]]
name = "azure" name = "azure"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/servo/rust-azure#f1c5e98201e4c2d7684a388596979ce862788a9e" source = "git+https://github.com/servo/rust-azure#5b9f2dbe7517196a82ea3c9c4dc4cf9fbd7d0867"
dependencies = [ dependencies = [
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)", "core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)",
"core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics)", "core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics)",
@ -38,7 +38,7 @@ dependencies = [
"geom 0.1.0 (git+https://github.com/servo/rust-geom)", "geom 0.1.0 (git+https://github.com/servo/rust-geom)",
"libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"skia 0.0.20130412 (git+https://github.com/servo/skia)", "skia 0.0.20130412 (git+https://github.com/servo/skia)",
"xlib 0.1.0 (git+https://github.com/servo/rust-xlib)", "x11 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]

View file

@ -0,0 +1,6 @@
[2d.path.arcTo.shape.curve1.html]
type: testharness
[arcTo() curves in the right kind of shape]
expected:
FAIL

View file

@ -0,0 +1,6 @@
[2d.path.arcTo.shape.curve2.html]
type: testharness
[arcTo() curves in the right kind of shape]
expected:
FAIL