mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
parent
145c89a2d4
commit
430a65be07
17 changed files with 12 additions and 927 deletions
44
Cargo.lock
generated
44
Cargo.lock
generated
|
@ -187,18 +187,6 @@ version = "0.1.7"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2"
|
||||
|
||||
[[package]]
|
||||
name = "azure"
|
||||
version = "0.37.0"
|
||||
source = "git+https://github.com/servo/rust-azure#1dbd223157997b5b5301e7da73bff37f928a7418"
|
||||
dependencies = [
|
||||
"cmake",
|
||||
"euclid",
|
||||
"libc",
|
||||
"servo-freetype-sys",
|
||||
"servo-skia",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "background_hang_monitor"
|
||||
version = "0.0.1"
|
||||
|
@ -489,7 +477,6 @@ dependencies = [
|
|||
name = "canvas"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"azure",
|
||||
"bitflags",
|
||||
"byteorder",
|
||||
"canvas_traits",
|
||||
|
@ -2093,16 +2080,6 @@ dependencies = [
|
|||
"gl_generator 0.11.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "glx"
|
||||
version = "0.2.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d56d59aa89ba084f04dd4767df10649c65d1ab180a9a0d1eabb9b1d5a28ab2bd"
|
||||
dependencies = [
|
||||
"gl_generator 0.11.0",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gobject-sys"
|
||||
version = "0.9.1"
|
||||
|
@ -5225,27 +5202,6 @@ dependencies = [
|
|||
"servo-media-streams",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "servo-skia"
|
||||
version = "0.30000023.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3cf31d622cdfc24317eb1caa1018294f8058eb8315c9ed79103487b9504ddadb"
|
||||
dependencies = [
|
||||
"cgl 0.3.2",
|
||||
"cmake",
|
||||
"euclid",
|
||||
"expat-sys",
|
||||
"gleam 0.7.0",
|
||||
"glutin",
|
||||
"glx",
|
||||
"io-surface",
|
||||
"libc",
|
||||
"servo-egl",
|
||||
"servo-fontconfig-sys",
|
||||
"servo-freetype-sys",
|
||||
"x11",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "servo_allocator"
|
||||
version = "0.0.1"
|
||||
|
|
|
@ -11,15 +11,12 @@ name = "canvas"
|
|||
path = "lib.rs"
|
||||
|
||||
[features]
|
||||
canvas2d-azure = ["azure"]
|
||||
canvas2d-raqote = ["raqote"]
|
||||
webgl_backtrace = ["canvas_traits/webgl_backtrace"]
|
||||
no-wgl = ["surfman/sm-no-wgl"]
|
||||
xr-profile = ["webxr-api/profile", "time"]
|
||||
|
||||
|
||||
[dependencies]
|
||||
azure = {git = "https://github.com/servo/rust-azure", optional = true}
|
||||
bitflags = "1.0"
|
||||
byteorder = "1"
|
||||
canvas_traits = {path = "../canvas_traits"}
|
||||
|
@ -33,7 +30,7 @@ half = "1"
|
|||
ipc-channel = "0.14"
|
||||
log = "0.4"
|
||||
num-traits = "0.2"
|
||||
raqote = {git = "https://github.com/jrmuizel/raqote", optional = true}
|
||||
raqote = {git = "https://github.com/jrmuizel/raqote"}
|
||||
time = { version = "0.1.0", optional = true }
|
||||
pixels = {path = "../pixels"}
|
||||
servo_config = {path = "../config"}
|
||||
|
|
|
@ -1,785 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use crate::canvas_data::{
|
||||
Backend, CanvasPaintState, Color, CompositionOp, DrawOptions, ExtendMode, Filter,
|
||||
GenericDrawTarget, GenericPathBuilder, GradientStop, GradientStops, Path, Pattern,
|
||||
SourceSurface, StrokeOptions, SurfaceFormat,
|
||||
};
|
||||
use crate::canvas_paint_thread::AntialiasMode;
|
||||
use azure::azure::{AzFloat, AzGradientStop, AzPoint};
|
||||
use azure::azure_hl;
|
||||
use azure::azure_hl::SurfacePattern;
|
||||
use azure::azure_hl::{BackendType, ColorPattern, DrawTarget};
|
||||
use azure::azure_hl::{CapStyle, JoinStyle};
|
||||
use azure::azure_hl::{LinearGradientPattern, RadialGradientPattern};
|
||||
use canvas_traits::canvas::*;
|
||||
use cssparser::RGBA;
|
||||
use euclid::default::{Point2D, Rect, Size2D, Transform2D, Vector2D};
|
||||
|
||||
use std::marker::PhantomData;
|
||||
|
||||
pub struct AzureBackend;
|
||||
|
||||
impl Backend for AzureBackend {
|
||||
fn get_composition_op(&self, opts: &DrawOptions) -> CompositionOp {
|
||||
CompositionOp::Azure(opts.as_azure().composition)
|
||||
}
|
||||
|
||||
fn need_to_draw_shadow(&self, color: &Color) -> bool {
|
||||
color.as_azure().a != 0.0f32
|
||||
}
|
||||
|
||||
fn size_from_pattern(&self, rect: &Rect<f32>, pattern: &Pattern) -> Option<Size2D<f32>> {
|
||||
match pattern {
|
||||
Pattern::Azure(azure_hl::Pattern::Surface(ref surface), _) => {
|
||||
let surface_size = surface.size();
|
||||
let size = match (surface.repeat_x, surface.repeat_y) {
|
||||
(true, true) => rect.size,
|
||||
(true, false) => Size2D::new(rect.size.width, surface_size.height as f32),
|
||||
(false, true) => Size2D::new(surface_size.width as f32, rect.size.height),
|
||||
(false, false) => {
|
||||
Size2D::new(surface_size.width as f32, surface_size.height as f32)
|
||||
},
|
||||
};
|
||||
Some(size)
|
||||
},
|
||||
Pattern::Azure(..) => None,
|
||||
}
|
||||
}
|
||||
|
||||
fn set_shadow_color<'a>(&mut self, color: RGBA, state: &mut CanvasPaintState<'a>) {
|
||||
state.shadow_color = Color::Azure(color.to_azure_style());
|
||||
}
|
||||
|
||||
fn set_fill_style<'a>(
|
||||
&mut self,
|
||||
style: FillOrStrokeStyle,
|
||||
state: &mut CanvasPaintState<'a>,
|
||||
drawtarget: &dyn GenericDrawTarget,
|
||||
) {
|
||||
if let Some(pattern) = style.to_azure_pattern(drawtarget) {
|
||||
state.fill_style = Pattern::Azure(pattern, PhantomData::default())
|
||||
}
|
||||
}
|
||||
|
||||
fn set_stroke_style<'a>(
|
||||
&mut self,
|
||||
style: FillOrStrokeStyle,
|
||||
state: &mut CanvasPaintState<'a>,
|
||||
drawtarget: &dyn GenericDrawTarget,
|
||||
) {
|
||||
if let Some(pattern) = style.to_azure_pattern(drawtarget) {
|
||||
state.stroke_style = Pattern::Azure(pattern, PhantomData::default())
|
||||
}
|
||||
}
|
||||
|
||||
fn set_global_composition<'a>(
|
||||
&mut self,
|
||||
op: CompositionOrBlending,
|
||||
state: &mut CanvasPaintState<'a>,
|
||||
) {
|
||||
state
|
||||
.draw_options
|
||||
.as_azure_mut()
|
||||
.set_composition_op(op.to_azure_style());
|
||||
}
|
||||
|
||||
fn create_drawtarget(&self, size: Size2D<u64>) -> Box<dyn GenericDrawTarget> {
|
||||
// FIXME(nox): Why is the size made of i32 values?
|
||||
Box::new(DrawTarget::new(
|
||||
BackendType::Skia,
|
||||
size.to_i32(),
|
||||
azure_hl::SurfaceFormat::B8G8R8A8,
|
||||
))
|
||||
}
|
||||
|
||||
fn recreate_paint_state<'a>(&self, state: &CanvasPaintState<'a>) -> CanvasPaintState<'a> {
|
||||
CanvasPaintState::new(AntialiasMode::from_azure(
|
||||
state.draw_options.as_azure().antialias,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> CanvasPaintState<'a> {
|
||||
pub fn new(antialias: AntialiasMode) -> CanvasPaintState<'a> {
|
||||
CanvasPaintState {
|
||||
draw_options: DrawOptions::Azure(azure_hl::DrawOptions::new(
|
||||
1.0,
|
||||
azure_hl::CompositionOp::Over,
|
||||
antialias.into_azure(),
|
||||
)),
|
||||
fill_style: Pattern::Azure(
|
||||
azure_hl::Pattern::Color(ColorPattern::new(azure_hl::Color::black())),
|
||||
PhantomData::default(),
|
||||
),
|
||||
stroke_style: Pattern::Azure(
|
||||
azure_hl::Pattern::Color(ColorPattern::new(azure_hl::Color::black())),
|
||||
PhantomData::default(),
|
||||
),
|
||||
stroke_opts: StrokeOptions::Azure(azure_hl::StrokeOptions::new(
|
||||
1.0,
|
||||
JoinStyle::MiterOrBevel,
|
||||
CapStyle::Butt,
|
||||
10.0,
|
||||
&[],
|
||||
)),
|
||||
transform: Transform2D::identity(),
|
||||
shadow_offset_x: 0.0,
|
||||
shadow_offset_y: 0.0,
|
||||
shadow_blur: 0.0,
|
||||
shadow_color: Color::Azure(azure_hl::Color::transparent()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl GenericPathBuilder for azure_hl::PathBuilder {
|
||||
fn arc(
|
||||
&mut self,
|
||||
origin: Point2D<f32>,
|
||||
radius: f32,
|
||||
start_angle: f32,
|
||||
end_angle: f32,
|
||||
anticlockwise: bool,
|
||||
) {
|
||||
azure_hl::PathBuilder::arc(
|
||||
self,
|
||||
origin as Point2D<AzFloat>,
|
||||
radius as AzFloat,
|
||||
start_angle as AzFloat,
|
||||
end_angle as AzFloat,
|
||||
anticlockwise,
|
||||
);
|
||||
}
|
||||
fn bezier_curve_to(
|
||||
&mut self,
|
||||
control_point1: &Point2D<f32>,
|
||||
control_point2: &Point2D<f32>,
|
||||
control_point3: &Point2D<f32>,
|
||||
) {
|
||||
azure_hl::PathBuilder::bezier_curve_to(
|
||||
self,
|
||||
control_point1 as &Point2D<AzFloat>,
|
||||
control_point2 as &Point2D<AzFloat>,
|
||||
control_point3 as &Point2D<AzFloat>,
|
||||
);
|
||||
}
|
||||
fn close(&mut self) {
|
||||
azure_hl::PathBuilder::close(self);
|
||||
}
|
||||
fn ellipse(
|
||||
&mut self,
|
||||
origin: Point2D<f32>,
|
||||
radius_x: f32,
|
||||
radius_y: f32,
|
||||
rotation_angle: f32,
|
||||
start_angle: f32,
|
||||
end_angle: f32,
|
||||
anticlockwise: bool,
|
||||
) {
|
||||
azure_hl::PathBuilder::ellipse(
|
||||
self,
|
||||
origin as Point2D<AzFloat>,
|
||||
radius_x as AzFloat,
|
||||
radius_y as AzFloat,
|
||||
rotation_angle as AzFloat,
|
||||
start_angle as AzFloat,
|
||||
end_angle as AzFloat,
|
||||
anticlockwise,
|
||||
);
|
||||
}
|
||||
fn get_current_point(&mut self) -> Option<Point2D<f32>> {
|
||||
let AzPoint { x, y } = azure_hl::PathBuilder::get_current_point(self);
|
||||
Some(Point2D::new(x as f32, y as f32))
|
||||
}
|
||||
fn line_to(&mut self, point: Point2D<f32>) {
|
||||
azure_hl::PathBuilder::line_to(self, point as Point2D<AzFloat>);
|
||||
}
|
||||
fn move_to(&mut self, point: Point2D<f32>) {
|
||||
azure_hl::PathBuilder::move_to(self, point as Point2D<AzFloat>);
|
||||
}
|
||||
fn quadratic_curve_to(&mut self, control_point: &Point2D<f32>, end_point: &Point2D<f32>) {
|
||||
azure_hl::PathBuilder::quadratic_curve_to(
|
||||
self,
|
||||
control_point as &Point2D<AzFloat>,
|
||||
end_point as &Point2D<AzFloat>,
|
||||
);
|
||||
}
|
||||
fn finish(&mut self) -> Path {
|
||||
Path::Azure(azure_hl::PathBuilder::finish(self))
|
||||
}
|
||||
}
|
||||
|
||||
impl GenericDrawTarget for azure_hl::DrawTarget {
|
||||
fn clear_rect(&mut self, rect: &Rect<f32>) {
|
||||
azure_hl::DrawTarget::clear_rect(self, rect as &Rect<AzFloat>);
|
||||
}
|
||||
|
||||
fn copy_surface(
|
||||
&mut self,
|
||||
surface: SourceSurface,
|
||||
source: Rect<i32>,
|
||||
destination: Point2D<i32>,
|
||||
) {
|
||||
azure_hl::DrawTarget::copy_surface(self, surface.into_azure(), source, destination);
|
||||
}
|
||||
|
||||
fn create_gradient_stops(
|
||||
&self,
|
||||
gradient_stops: Vec<GradientStop>,
|
||||
extend_mode: ExtendMode,
|
||||
) -> GradientStops {
|
||||
let gradient_stops: Vec<AzGradientStop> =
|
||||
gradient_stops.into_iter().map(|x| x.into_azure()).collect();
|
||||
GradientStops::Azure(self.create_gradient_stops(&gradient_stops, extend_mode.into_azure()))
|
||||
}
|
||||
|
||||
fn create_path_builder(&self) -> Box<dyn GenericPathBuilder> {
|
||||
Box::new(self.create_path_builder())
|
||||
}
|
||||
|
||||
fn create_similar_draw_target(
|
||||
&self,
|
||||
size: &Size2D<i32>,
|
||||
format: SurfaceFormat,
|
||||
) -> Box<dyn GenericDrawTarget> {
|
||||
Box::new(self.create_similar_draw_target(size, format.into_azure()))
|
||||
}
|
||||
fn create_source_surface_from_data(
|
||||
&self,
|
||||
data: &[u8],
|
||||
size: Size2D<i32>,
|
||||
stride: i32,
|
||||
) -> Option<SourceSurface> {
|
||||
self.create_source_surface_from_data(data, size, stride, azure_hl::SurfaceFormat::B8G8R8A8)
|
||||
.map(|s| SourceSurface::Azure(s))
|
||||
}
|
||||
fn draw_surface(
|
||||
&mut self,
|
||||
surface: SourceSurface,
|
||||
dest: Rect<f64>,
|
||||
source: Rect<f64>,
|
||||
filter: Filter,
|
||||
draw_options: &DrawOptions,
|
||||
) {
|
||||
let surf_options = azure_hl::DrawSurfaceOptions::new(filter.as_azure(), true);
|
||||
let draw_options = azure_hl::DrawOptions::new(
|
||||
draw_options.as_azure().alpha,
|
||||
draw_options.as_azure().composition,
|
||||
azure_hl::AntialiasMode::None,
|
||||
);
|
||||
azure_hl::DrawTarget::draw_surface(
|
||||
self,
|
||||
surface.into_azure(),
|
||||
dest.to_azure_style(),
|
||||
source.to_azure_style(),
|
||||
surf_options,
|
||||
draw_options,
|
||||
);
|
||||
}
|
||||
fn draw_surface_with_shadow(
|
||||
&self,
|
||||
surface: SourceSurface,
|
||||
dest: &Point2D<f32>,
|
||||
color: &Color,
|
||||
offset: &Vector2D<f32>,
|
||||
sigma: f32,
|
||||
operator: CompositionOp,
|
||||
) {
|
||||
self.draw_surface_with_shadow(
|
||||
surface.into_azure(),
|
||||
dest as &Point2D<AzFloat>,
|
||||
color.as_azure(),
|
||||
offset as &Vector2D<AzFloat>,
|
||||
sigma as AzFloat,
|
||||
operator.into_azure(),
|
||||
);
|
||||
}
|
||||
fn fill(&mut self, path: &Path, pattern: Pattern, draw_options: &DrawOptions) {
|
||||
azure_hl::DrawTarget::fill(
|
||||
self,
|
||||
path.as_azure(),
|
||||
pattern.as_azure().to_pattern_ref(),
|
||||
draw_options.as_azure(),
|
||||
);
|
||||
}
|
||||
fn fill_rect(
|
||||
&mut self,
|
||||
rect: &Rect<f32>,
|
||||
pattern: Pattern,
|
||||
draw_options: Option<&DrawOptions>,
|
||||
) {
|
||||
azure_hl::DrawTarget::fill_rect(
|
||||
self,
|
||||
rect as &Rect<AzFloat>,
|
||||
pattern.as_azure().to_pattern_ref(),
|
||||
draw_options.map(|x| x.as_azure()),
|
||||
);
|
||||
}
|
||||
fn get_format(&self) -> SurfaceFormat {
|
||||
SurfaceFormat::Azure(self.get_format())
|
||||
}
|
||||
fn get_size(&self) -> Size2D<i32> {
|
||||
let size = self.get_size();
|
||||
Size2D::new(size.width, size.height)
|
||||
}
|
||||
fn get_transform(&self) -> Transform2D<f32> {
|
||||
self.get_transform() as Transform2D<f32>
|
||||
}
|
||||
fn pop_clip(&mut self) {
|
||||
azure_hl::DrawTarget::pop_clip(self);
|
||||
}
|
||||
fn push_clip(&mut self, path: &Path) {
|
||||
azure_hl::DrawTarget::push_clip(self, path.as_azure());
|
||||
}
|
||||
fn set_transform(&mut self, matrix: &Transform2D<f32>) {
|
||||
azure_hl::DrawTarget::set_transform(self, matrix as &Transform2D<AzFloat>);
|
||||
}
|
||||
fn snapshot(&self) -> SourceSurface {
|
||||
SourceSurface::Azure(self.snapshot())
|
||||
}
|
||||
fn stroke(
|
||||
&mut self,
|
||||
path: &Path,
|
||||
pattern: Pattern,
|
||||
stroke_options: &StrokeOptions,
|
||||
draw_options: &DrawOptions,
|
||||
) {
|
||||
azure_hl::DrawTarget::stroke(
|
||||
self,
|
||||
path.as_azure(),
|
||||
pattern.as_azure().to_pattern_ref(),
|
||||
stroke_options.as_azure(),
|
||||
draw_options.as_azure(),
|
||||
);
|
||||
}
|
||||
fn stroke_line(
|
||||
&mut self,
|
||||
start: Point2D<f32>,
|
||||
end: Point2D<f32>,
|
||||
pattern: Pattern,
|
||||
stroke_options: &StrokeOptions,
|
||||
draw_options: &DrawOptions,
|
||||
) {
|
||||
let stroke_options = stroke_options.as_azure();
|
||||
let cap = match stroke_options.line_join {
|
||||
JoinStyle::Round => CapStyle::Round,
|
||||
_ => CapStyle::Butt,
|
||||
};
|
||||
|
||||
let stroke_opts = azure_hl::StrokeOptions::new(
|
||||
stroke_options.line_width,
|
||||
stroke_options.line_join,
|
||||
cap,
|
||||
stroke_options.miter_limit,
|
||||
stroke_options.mDashPattern,
|
||||
);
|
||||
|
||||
azure_hl::DrawTarget::stroke_line(
|
||||
self,
|
||||
start,
|
||||
end,
|
||||
pattern.as_azure().to_pattern_ref(),
|
||||
&stroke_opts,
|
||||
draw_options.as_azure(),
|
||||
);
|
||||
}
|
||||
fn stroke_rect(
|
||||
&mut self,
|
||||
rect: &Rect<f32>,
|
||||
pattern: Pattern,
|
||||
stroke_options: &StrokeOptions,
|
||||
draw_options: &DrawOptions,
|
||||
) {
|
||||
azure_hl::DrawTarget::stroke_rect(
|
||||
self,
|
||||
rect as &Rect<AzFloat>,
|
||||
pattern.as_azure().to_pattern_ref(),
|
||||
stroke_options.as_azure(),
|
||||
draw_options.as_azure(),
|
||||
);
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
fn snapshot_data(&self, f: &dyn Fn(&[u8]) -> Vec<u8>) -> Vec<u8> {
|
||||
unsafe { f(self.snapshot().get_data_surface().data()) }
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
fn snapshot_data_owned(&self) -> Vec<u8> {
|
||||
unsafe { self.snapshot().get_data_surface().data().into() }
|
||||
}
|
||||
}
|
||||
|
||||
impl AntialiasMode {
|
||||
fn into_azure(self) -> azure_hl::AntialiasMode {
|
||||
match self {
|
||||
AntialiasMode::Default => azure_hl::AntialiasMode::Default,
|
||||
AntialiasMode::None => azure_hl::AntialiasMode::None,
|
||||
}
|
||||
}
|
||||
|
||||
fn from_azure(val: azure_hl::AntialiasMode) -> AntialiasMode {
|
||||
match val {
|
||||
azure_hl::AntialiasMode::Default => AntialiasMode::Default,
|
||||
azure_hl::AntialiasMode::None => AntialiasMode::None,
|
||||
v => unimplemented!("{:?} is unsupported", v),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ExtendMode {
|
||||
fn into_azure(self) -> azure_hl::ExtendMode {
|
||||
match self {
|
||||
ExtendMode::Azure(m) => m,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl GradientStop {
|
||||
fn into_azure(self) -> AzGradientStop {
|
||||
match self {
|
||||
GradientStop::Azure(s) => s,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl GradientStops {
|
||||
fn into_azure(self) -> azure_hl::GradientStops {
|
||||
match self {
|
||||
GradientStops::Azure(s) => s,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Color {
|
||||
fn as_azure(&self) -> &azure_hl::Color {
|
||||
match self {
|
||||
Color::Azure(s) => s,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl CompositionOp {
|
||||
fn into_azure(self) -> azure_hl::CompositionOp {
|
||||
match self {
|
||||
CompositionOp::Azure(s) => s,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl SurfaceFormat {
|
||||
fn into_azure(self) -> azure_hl::SurfaceFormat {
|
||||
match self {
|
||||
SurfaceFormat::Azure(s) => s,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl SourceSurface {
|
||||
fn into_azure(self) -> azure_hl::SourceSurface {
|
||||
match self {
|
||||
SourceSurface::Azure(s) => s,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Path {
|
||||
fn as_azure(&self) -> &azure_hl::Path {
|
||||
match self {
|
||||
Path::Azure(p) => p,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Pattern<'_> {
|
||||
fn as_azure(&self) -> &azure_hl::Pattern {
|
||||
match self {
|
||||
Pattern::Azure(p, _) => p,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl DrawOptions {
|
||||
fn as_azure(&self) -> &azure_hl::DrawOptions {
|
||||
match self {
|
||||
DrawOptions::Azure(options) => options,
|
||||
}
|
||||
}
|
||||
fn as_azure_mut(&mut self) -> &mut azure_hl::DrawOptions {
|
||||
match self {
|
||||
DrawOptions::Azure(options) => options,
|
||||
}
|
||||
}
|
||||
pub fn set_alpha(&mut self, val: f32) {
|
||||
match self {
|
||||
DrawOptions::Azure(options) => options.alpha = val as AzFloat,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> StrokeOptions<'a> {
|
||||
pub fn as_azure(&self) -> &azure_hl::StrokeOptions<'a> {
|
||||
match self {
|
||||
StrokeOptions::Azure(options) => options,
|
||||
}
|
||||
}
|
||||
pub fn set_line_width(&mut self, val: f32) {
|
||||
match self {
|
||||
StrokeOptions::Azure(options) => options.line_width = val as AzFloat,
|
||||
}
|
||||
}
|
||||
pub fn set_miter_limit(&mut self, val: f32) {
|
||||
match self {
|
||||
StrokeOptions::Azure(options) => options.miter_limit = val as AzFloat,
|
||||
}
|
||||
}
|
||||
pub fn set_line_join(&mut self, val: LineJoinStyle) {
|
||||
match self {
|
||||
StrokeOptions::Azure(options) => options.line_join = val.to_azure_style(),
|
||||
}
|
||||
}
|
||||
pub fn set_line_cap(&mut self, val: LineCapStyle) {
|
||||
match self {
|
||||
StrokeOptions::Azure(options) => options.line_cap = val.to_azure_style(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub trait ToAzureStyle {
|
||||
type Target;
|
||||
fn to_azure_style(self) -> Self::Target;
|
||||
}
|
||||
|
||||
impl ToAzureStyle for Rect<f64> {
|
||||
type Target = Rect<f32>;
|
||||
|
||||
fn to_azure_style(self) -> Rect<f32> {
|
||||
Rect::new(
|
||||
Point2D::new(self.origin.x as f32, self.origin.y as f32),
|
||||
Size2D::new(self.size.width as f32, self.size.height as f32),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl ToAzureStyle for LineCapStyle {
|
||||
type Target = CapStyle;
|
||||
|
||||
fn to_azure_style(self) -> CapStyle {
|
||||
match self {
|
||||
LineCapStyle::Butt => CapStyle::Butt,
|
||||
LineCapStyle::Round => CapStyle::Round,
|
||||
LineCapStyle::Square => CapStyle::Square,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ToAzureStyle for LineJoinStyle {
|
||||
type Target = JoinStyle;
|
||||
|
||||
fn to_azure_style(self) -> JoinStyle {
|
||||
match self {
|
||||
LineJoinStyle::Round => JoinStyle::Round,
|
||||
LineJoinStyle::Bevel => JoinStyle::Bevel,
|
||||
LineJoinStyle::Miter => JoinStyle::Miter,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ToAzureStyle for CompositionStyle {
|
||||
type Target = azure_hl::CompositionOp;
|
||||
|
||||
fn to_azure_style(self) -> azure_hl::CompositionOp {
|
||||
match self {
|
||||
CompositionStyle::SrcIn => azure_hl::CompositionOp::In,
|
||||
CompositionStyle::SrcOut => azure_hl::CompositionOp::Out,
|
||||
CompositionStyle::SrcOver => azure_hl::CompositionOp::Over,
|
||||
CompositionStyle::SrcAtop => azure_hl::CompositionOp::Atop,
|
||||
CompositionStyle::DestIn => azure_hl::CompositionOp::DestIn,
|
||||
CompositionStyle::DestOut => azure_hl::CompositionOp::DestOut,
|
||||
CompositionStyle::DestOver => azure_hl::CompositionOp::DestOver,
|
||||
CompositionStyle::DestAtop => azure_hl::CompositionOp::DestAtop,
|
||||
CompositionStyle::Copy => azure_hl::CompositionOp::Source,
|
||||
CompositionStyle::Lighter => azure_hl::CompositionOp::Add,
|
||||
CompositionStyle::Xor => azure_hl::CompositionOp::Xor,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ToAzureStyle for BlendingStyle {
|
||||
type Target = azure_hl::CompositionOp;
|
||||
|
||||
fn to_azure_style(self) -> azure_hl::CompositionOp {
|
||||
match self {
|
||||
BlendingStyle::Multiply => azure_hl::CompositionOp::Multiply,
|
||||
BlendingStyle::Screen => azure_hl::CompositionOp::Screen,
|
||||
BlendingStyle::Overlay => azure_hl::CompositionOp::Overlay,
|
||||
BlendingStyle::Darken => azure_hl::CompositionOp::Darken,
|
||||
BlendingStyle::Lighten => azure_hl::CompositionOp::Lighten,
|
||||
BlendingStyle::ColorDodge => azure_hl::CompositionOp::ColorDodge,
|
||||
BlendingStyle::ColorBurn => azure_hl::CompositionOp::ColorBurn,
|
||||
BlendingStyle::HardLight => azure_hl::CompositionOp::HardLight,
|
||||
BlendingStyle::SoftLight => azure_hl::CompositionOp::SoftLight,
|
||||
BlendingStyle::Difference => azure_hl::CompositionOp::Difference,
|
||||
BlendingStyle::Exclusion => azure_hl::CompositionOp::Exclusion,
|
||||
BlendingStyle::Hue => azure_hl::CompositionOp::Hue,
|
||||
BlendingStyle::Saturation => azure_hl::CompositionOp::Saturation,
|
||||
BlendingStyle::Color => azure_hl::CompositionOp::Color,
|
||||
BlendingStyle::Luminosity => azure_hl::CompositionOp::Luminosity,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ToAzureStyle for CompositionOrBlending {
|
||||
type Target = azure_hl::CompositionOp;
|
||||
|
||||
fn to_azure_style(self) -> azure_hl::CompositionOp {
|
||||
match self {
|
||||
CompositionOrBlending::Composition(op) => op.to_azure_style(),
|
||||
CompositionOrBlending::Blending(op) => op.to_azure_style(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub trait ToAzurePattern {
|
||||
fn to_azure_pattern(&self, drawtarget: &dyn GenericDrawTarget) -> Option<azure_hl::Pattern>;
|
||||
}
|
||||
|
||||
impl ToAzurePattern for FillOrStrokeStyle {
|
||||
fn to_azure_pattern(&self, drawtarget: &dyn GenericDrawTarget) -> Option<azure_hl::Pattern> {
|
||||
Some(match *self {
|
||||
FillOrStrokeStyle::Color(ref color) => {
|
||||
azure_hl::Pattern::Color(ColorPattern::new(color.to_azure_style()))
|
||||
},
|
||||
FillOrStrokeStyle::LinearGradient(ref linear_gradient_style) => {
|
||||
let gradient_stops: Vec<GradientStop> = linear_gradient_style
|
||||
.stops
|
||||
.iter()
|
||||
.map(|s| {
|
||||
GradientStop::Azure(azure_hl::GradientStop {
|
||||
offset: s.offset as f32,
|
||||
color: s.color.to_azure_style(),
|
||||
})
|
||||
})
|
||||
.collect();
|
||||
|
||||
azure_hl::Pattern::LinearGradient(LinearGradientPattern::new(
|
||||
&Point2D::new(
|
||||
linear_gradient_style.x0 as f32,
|
||||
linear_gradient_style.y0 as f32,
|
||||
),
|
||||
&Point2D::new(
|
||||
linear_gradient_style.x1 as f32,
|
||||
linear_gradient_style.y1 as f32,
|
||||
),
|
||||
drawtarget
|
||||
.create_gradient_stops(
|
||||
gradient_stops,
|
||||
ExtendMode::Azure(azure_hl::ExtendMode::Clamp),
|
||||
)
|
||||
.into_azure(),
|
||||
&Transform2D::identity(),
|
||||
))
|
||||
},
|
||||
FillOrStrokeStyle::RadialGradient(ref radial_gradient_style) => {
|
||||
let gradient_stops: Vec<GradientStop> = radial_gradient_style
|
||||
.stops
|
||||
.iter()
|
||||
.map(|s| {
|
||||
GradientStop::Azure(azure_hl::GradientStop {
|
||||
offset: s.offset as f32,
|
||||
color: s.color.to_azure_style(),
|
||||
})
|
||||
})
|
||||
.collect();
|
||||
|
||||
azure_hl::Pattern::RadialGradient(RadialGradientPattern::new(
|
||||
&Point2D::new(
|
||||
radial_gradient_style.x0 as f32,
|
||||
radial_gradient_style.y0 as f32,
|
||||
),
|
||||
&Point2D::new(
|
||||
radial_gradient_style.x1 as f32,
|
||||
radial_gradient_style.y1 as f32,
|
||||
),
|
||||
radial_gradient_style.r0 as f32,
|
||||
radial_gradient_style.r1 as f32,
|
||||
drawtarget
|
||||
.create_gradient_stops(
|
||||
gradient_stops,
|
||||
ExtendMode::Azure(azure_hl::ExtendMode::Clamp),
|
||||
)
|
||||
.into_azure(),
|
||||
&Transform2D::identity(),
|
||||
))
|
||||
},
|
||||
FillOrStrokeStyle::Surface(ref surface_style) => {
|
||||
let source_surface = drawtarget
|
||||
.create_source_surface_from_data(
|
||||
&surface_style.surface_data,
|
||||
// FIXME(nox): Why are those i32 values?
|
||||
surface_style.surface_size.to_i32(),
|
||||
surface_style.surface_size.width as i32 * 4,
|
||||
)?
|
||||
.into_azure();
|
||||
azure_hl::Pattern::Surface(SurfacePattern::new(
|
||||
source_surface.azure_source_surface,
|
||||
surface_style.repeat_x,
|
||||
surface_style.repeat_y,
|
||||
&Transform2D::identity(),
|
||||
))
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl ToAzureStyle for RGBA {
|
||||
type Target = azure_hl::Color;
|
||||
|
||||
fn to_azure_style(self) -> azure_hl::Color {
|
||||
azure_hl::Color::rgba(
|
||||
self.red_f32() as f32,
|
||||
self.green_f32() as f32,
|
||||
self.blue_f32() as f32,
|
||||
self.alpha_f32() as f32,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl Pattern<'_> {
|
||||
pub fn is_zero_size_gradient(&self) -> bool {
|
||||
match *self {
|
||||
Pattern::Azure(azure_hl::Pattern::LinearGradient(ref gradient), _) => {
|
||||
gradient.is_zero_size()
|
||||
},
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Filter {
|
||||
fn as_azure(&self) -> azure_hl::Filter {
|
||||
match *self {
|
||||
Filter::Linear => azure_hl::Filter::Linear,
|
||||
Filter::Point => azure_hl::Filter::Point,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Path {
|
||||
pub fn transformed_copy_to_builder(
|
||||
&self,
|
||||
transform: &Transform2D<f32>,
|
||||
) -> Box<dyn GenericPathBuilder> {
|
||||
Box::new(self.as_azure().transformed_copy_to_builder(transform))
|
||||
}
|
||||
|
||||
pub fn contains_point(&self, x: f64, y: f64, path_transform: &Transform2D<f32>) -> bool {
|
||||
self.as_azure().contains_point(x, y, path_transform)
|
||||
}
|
||||
|
||||
pub fn copy_to_builder(&self) -> Box<dyn GenericPathBuilder> {
|
||||
Box::new(self.as_azure().copy_to_builder())
|
||||
}
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
fn main() {
|
||||
let azure = std::env::var_os("CARGO_FEATURE_CANVAS2D_AZURE").is_some();
|
||||
let raqote = std::env::var_os("CARGO_FEATURE_CANVAS2D_RAQOTE").is_some();
|
||||
|
||||
if !(azure || raqote) {
|
||||
error("Must enable one of the `canvas2d-azure` or `canvas2d-raqote` features.")
|
||||
}
|
||||
if azure && raqote {
|
||||
error("Must not enable both of the `canvas2d-azure` and `canvas2d-raqote` features.")
|
||||
}
|
||||
}
|
||||
|
||||
fn error(message: &str) {
|
||||
print!("\n\n Error: {}\n\n", message);
|
||||
std::process::exit(1)
|
||||
}
|
|
@ -23,6 +23,7 @@ use webrender_api::units::RectExt as RectExt_;
|
|||
/// further operations to it in device space. When it's time to
|
||||
/// draw the path, we convert it back to userspace and draw it
|
||||
/// with the correct transform applied.
|
||||
/// TODO: De-abstract now that Azure is removed?
|
||||
enum PathState {
|
||||
/// Path builder in user-space. If a transform has been applied
|
||||
/// but no further path operations have occurred, it is stored
|
||||
|
@ -80,8 +81,8 @@ pub trait Backend {
|
|||
fn size_from_pattern(&self, rect: &Rect<f32>, pattern: &Pattern) -> Option<Size2D<f32>>;
|
||||
}
|
||||
|
||||
/// A generic PathBuilder that abstracts the interface for
|
||||
/// azure's and raqote's PathBuilder.
|
||||
/// A generic PathBuilder that abstracts the interface for azure's and raqote's PathBuilder.
|
||||
/// TODO: De-abstract now that Azure is removed?
|
||||
pub trait GenericPathBuilder {
|
||||
fn arc(
|
||||
&mut self,
|
||||
|
@ -220,6 +221,7 @@ impl<'a> PathBuilderRef<'a> {
|
|||
// TODO(pylbrecht)
|
||||
// This defines required methods for DrawTarget of azure and raqote
|
||||
// The prototypes are derived from azure's methods.
|
||||
// TODO: De-abstract now that Azure is removed?
|
||||
pub trait GenericDrawTarget {
|
||||
fn clear_rect(&mut self, rect: &Rect<f32>);
|
||||
fn copy_surface(
|
||||
|
@ -299,93 +301,57 @@ pub trait GenericDrawTarget {
|
|||
|
||||
#[derive(Clone)]
|
||||
pub enum ExtendMode {
|
||||
#[cfg(feature = "canvas2d-azure")]
|
||||
Azure(azure::azure_hl::ExtendMode),
|
||||
#[cfg(feature = "canvas2d-raqote")]
|
||||
Raqote(()),
|
||||
}
|
||||
|
||||
pub enum GradientStop {
|
||||
#[cfg(feature = "canvas2d-azure")]
|
||||
Azure(azure::AzGradientStop),
|
||||
#[cfg(feature = "canvas2d-raqote")]
|
||||
Raqote(raqote::GradientStop),
|
||||
}
|
||||
|
||||
pub enum GradientStops {
|
||||
#[cfg(feature = "canvas2d-azure")]
|
||||
Azure(azure::azure_hl::GradientStops),
|
||||
#[cfg(feature = "canvas2d-raqote")]
|
||||
Raqote(Vec<raqote::GradientStop>),
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum Color {
|
||||
#[cfg(feature = "canvas2d-azure")]
|
||||
Azure(azure::azure_hl::Color),
|
||||
#[cfg(feature = "canvas2d-raqote")]
|
||||
Raqote(raqote::SolidSource),
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum CompositionOp {
|
||||
#[cfg(feature = "canvas2d-azure")]
|
||||
Azure(azure::azure_hl::CompositionOp),
|
||||
#[cfg(feature = "canvas2d-raqote")]
|
||||
Raqote(raqote::BlendMode),
|
||||
}
|
||||
|
||||
pub enum SurfaceFormat {
|
||||
#[cfg(feature = "canvas2d-azure")]
|
||||
Azure(azure::azure_hl::SurfaceFormat),
|
||||
#[cfg(feature = "canvas2d-raqote")]
|
||||
Raqote(()),
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum SourceSurface {
|
||||
#[cfg(feature = "canvas2d-azure")]
|
||||
Azure(azure::azure_hl::SourceSurface),
|
||||
#[cfg(feature = "canvas2d-raqote")]
|
||||
Raqote(Vec<u8>), // TODO: See if we can avoid the alloc (probably?)
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum Path {
|
||||
#[cfg(feature = "canvas2d-azure")]
|
||||
Azure(azure::azure_hl::Path),
|
||||
#[cfg(feature = "canvas2d-raqote")]
|
||||
Raqote(raqote::Path),
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum Pattern<'a> {
|
||||
#[cfg(feature = "canvas2d-azure")]
|
||||
Azure(azure::azure_hl::Pattern, PhantomData<&'a ()>),
|
||||
#[cfg(feature = "canvas2d-raqote")]
|
||||
Raqote(crate::raqote_backend::Pattern<'a>),
|
||||
}
|
||||
|
||||
pub enum DrawSurfaceOptions {
|
||||
#[cfg(feature = "canvas2d-azure")]
|
||||
Azure(azure::azure_hl::DrawSurfaceOptions),
|
||||
#[cfg(feature = "canvas2d-raqote")]
|
||||
Raqote(()),
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum DrawOptions {
|
||||
#[cfg(feature = "canvas2d-azure")]
|
||||
Azure(azure::azure_hl::DrawOptions),
|
||||
#[cfg(feature = "canvas2d-raqote")]
|
||||
Raqote(raqote::DrawOptions),
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum StrokeOptions<'a> {
|
||||
#[cfg(feature = "canvas2d-azure")]
|
||||
Azure(azure::azure_hl::StrokeOptions<'a>),
|
||||
#[cfg(feature = "canvas2d-raqote")]
|
||||
Raqote(raqote::StrokeStyle, PhantomData<&'a ()>),
|
||||
}
|
||||
|
||||
|
@ -410,12 +376,6 @@ pub struct CanvasData<'a> {
|
|||
pub canvas_id: CanvasId,
|
||||
}
|
||||
|
||||
#[cfg(feature = "canvas2d-azure")]
|
||||
fn create_backend() -> Box<dyn Backend> {
|
||||
Box::new(crate::azure_backend::AzureBackend)
|
||||
}
|
||||
|
||||
#[cfg(feature = "canvas2d-raqote")]
|
||||
fn create_backend() -> Box<dyn Backend> {
|
||||
Box::new(crate::raqote_backend::RaqoteBackend)
|
||||
}
|
||||
|
|
|
@ -9,10 +9,6 @@ extern crate bitflags;
|
|||
#[macro_use]
|
||||
extern crate log;
|
||||
|
||||
#[cfg(feature = "canvas2d-azure")]
|
||||
mod azure_backend;
|
||||
|
||||
#[cfg(feature = "canvas2d-raqote")]
|
||||
mod raqote_backend;
|
||||
|
||||
pub use webgl_mode::WebGLComm;
|
||||
|
|
|
@ -12,7 +12,7 @@ use webrender_api::NativeFontHandle;
|
|||
/// Platform specific font representation for Linux.
|
||||
/// The identifier is an absolute path, and the bytes
|
||||
/// field is the loaded data that can be passed to
|
||||
/// freetype and azure directly.
|
||||
/// freetype and Raqote directly.
|
||||
#[derive(Deserialize, Serialize)]
|
||||
pub struct FontTemplateData {
|
||||
// If you add members here, review the Debug impl below
|
||||
|
|
|
@ -12,8 +12,6 @@ path = "lib.rs"
|
|||
crate-type = ["rlib"]
|
||||
|
||||
[features]
|
||||
canvas2d-azure = ["canvas/canvas2d-azure"]
|
||||
canvas2d-raqote = ["canvas/canvas2d-raqote"]
|
||||
debugmozjs = ["script/debugmozjs"]
|
||||
egl = ["mozangle/egl"]
|
||||
energy-profiling = ["profile_traits/energy-profiling"]
|
||||
|
|
|
@ -105,7 +105,7 @@
|
|||
* <https://github.com/servo/ipc-channel/>: an IPC implementation
|
||||
* <https://github.com/PistonDevelopers/image/>: image decoders
|
||||
* <https://github.com/tomaka/glutin/>: cross-platform windowing and input
|
||||
* <https://github.com/servo/rust-azure/>: bindings to Moz2D/Azure (cross-platform 2D rendering library)
|
||||
* <https://github.com/jrmuizel/raqote>: a pure Rust 2D Graphics Library
|
||||
* <https://github.com/servo/rust-cssparser/>: a CSS parser
|
||||
* <https://github.com/servo/rust-selectors/>: a CSS selector matching library
|
||||
* <https://github.com/cyderize/rust-websocket/>: a WebSocket protocol implementation
|
||||
|
|
|
@ -27,8 +27,6 @@ OriginalFilename = "servo.exe"
|
|||
ProductName = "Servo"
|
||||
|
||||
[features]
|
||||
canvas2d-azure = ["libservo/canvas2d-azure"]
|
||||
canvas2d-raqote = ["libservo/canvas2d-raqote"]
|
||||
default = ["webdriver", "max_log_level"]
|
||||
egl = ["libservo/egl"]
|
||||
energy-profiling = ["libservo/energy-profiling"]
|
||||
|
|
|
@ -13,8 +13,6 @@ test = false
|
|||
bench = false
|
||||
|
||||
[features]
|
||||
canvas2d-azure = ["simpleservo/canvas2d-azure"]
|
||||
canvas2d-raqote = ["simpleservo/canvas2d-raqote"]
|
||||
egl = ["simpleservo/egl"]
|
||||
layout-2013 = ["simpleservo/layout-2013"]
|
||||
layout-2020 = ["simpleservo/layout-2020"]
|
||||
|
|
|
@ -31,8 +31,6 @@ libloading = "0.5"
|
|||
gl_generator = "0.11"
|
||||
|
||||
[features]
|
||||
canvas2d-azure = ["libservo/canvas2d-azure"]
|
||||
canvas2d-raqote = ["libservo/canvas2d-raqote"]
|
||||
default = ["webdriver", "max_log_level"]
|
||||
debugmozjs = ["libservo/debugmozjs"]
|
||||
media-dummy = ["libservo/media-dummy"]
|
||||
|
|
|
@ -27,8 +27,6 @@ winapi = {version = "0.3", features = ["wingdi", "winuser", "winnt", "winbase",
|
|||
cbindgen = "0.9"
|
||||
|
||||
[features]
|
||||
canvas2d-azure = ["simpleservo/canvas2d-azure"]
|
||||
canvas2d-raqote = ["simpleservo/canvas2d-raqote"]
|
||||
debugmozjs = ["simpleservo/debugmozjs"]
|
||||
default = ["webdriver", "max_log_level"]
|
||||
media-dummy = ["simpleservo/media-dummy"]
|
||||
|
|
|
@ -27,8 +27,6 @@ simpleservo = { path = "../api" }
|
|||
cc = "1.0"
|
||||
|
||||
[features]
|
||||
canvas2d-azure = ["simpleservo/canvas2d-azure"]
|
||||
canvas2d-raqote = ["simpleservo/canvas2d-raqote"]
|
||||
debugmozjs = ["simpleservo/debugmozjs"]
|
||||
default = ["webdriver", "max_log_level"]
|
||||
media-dummy = ["simpleservo/media-dummy"]
|
||||
|
|
|
@ -841,7 +841,6 @@ install them, let us know by filing a bug!")
|
|||
action='store_true',
|
||||
help='Build with frame pointer enabled, used by the background hang monitor.',
|
||||
),
|
||||
CommandArgument('--with-raqote', default=None, action='store_true'),
|
||||
CommandArgument('--with-layout-2020', default=None, action='store_true'),
|
||||
CommandArgument('--with-layout-2013', default=None, action='store_true'),
|
||||
CommandArgument('--without-wgl', default=None, action='store_true'),
|
||||
|
@ -882,7 +881,7 @@ install them, let us know by filing a bug!")
|
|||
env=None, verbose=False,
|
||||
target=None, android=False, magicleap=False, libsimpleservo=False,
|
||||
features=None, debug_mozjs=False, with_debug_assertions=False,
|
||||
with_frame_pointer=False, with_raqote=False, without_wgl=False,
|
||||
with_frame_pointer=False, without_wgl=False,
|
||||
with_layout_2020=False, with_layout_2013=False,
|
||||
uwp=False, media_stack=None,
|
||||
):
|
||||
|
@ -913,16 +912,11 @@ install them, let us know by filing a bug!")
|
|||
if not magicleap:
|
||||
features.append("native-bluetooth")
|
||||
if uwp:
|
||||
features.append("canvas2d-raqote")
|
||||
features.append("no-wgl")
|
||||
features.append("uwp")
|
||||
else:
|
||||
# Non-UWP builds provide their own libEGL via mozangle.
|
||||
features.append("egl")
|
||||
if with_raqote and "canvas2d-azure" not in features:
|
||||
features.append("canvas2d-raqote")
|
||||
elif "canvas2d-azure" not in features:
|
||||
features.append("canvas2d-raqote")
|
||||
if with_layout_2020 or (self.config["build"]["layout-2020"] and not with_layout_2013):
|
||||
features.append("layout-2020")
|
||||
elif "layout-2020" not in features:
|
||||
|
|
|
@ -64,7 +64,6 @@ licenses_dep_toml = [
|
|||
'name = "dylib"',
|
||||
'name = "ipc-channel"',
|
||||
'name = "mozjs_sys"',
|
||||
'name = "azure"',
|
||||
'name = "freetype"',
|
||||
'name = "js"',
|
||||
'name = "servo-freetype-sys"',
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use app_units::Au;
|
||||
use azure::azure_hl::{ AntialiasMode, Color, ColorPattern, CompositionOp };
|
||||
use azure::azure_hl::{AntialiasMode, Color,
|
||||
use raqote::{GradientStop, Source, SolidSource};
|
||||
use raqote::{Source, SolidSource},
|
||||
ColorPattern, CompositionOp};
|
||||
use euclid::Size2D;
|
||||
use azure::azure::AzIntSize;
|
||||
use azure::azure::{AzIntSize};
|
||||
use raqote::Gradient;
|
||||
use raqote::{Gradient};
|
||||
|
||||
|
||||
mod paint_context;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue