Update euclid, azure, skia, offscreen_gl_context, plane-split, webrender

This commit is contained in:
Simon Sapin 2017-12-07 23:18:35 +01:00
parent 76270ad6c1
commit e17697fb0e
47 changed files with 196 additions and 211 deletions

View file

@ -48,7 +48,7 @@ use dom::bindings::str::{DOMString, USVString};
use dom::bindings::utils::WindowProxyHandler;
use dom::document::PendingRestyle;
use encoding_rs::Encoding;
use euclid::{Transform2D, Transform3D, Point2D, Vector2D, Rect, TypedSize2D, ScaleFactor};
use euclid::{Transform2D, Transform3D, Point2D, Vector2D, Rect, TypedSize2D, TypedScale};
use euclid::Length as EuclidLength;
use html5ever::{Prefix, LocalName, Namespace, QualName};
use html5ever::buffer_queue::BufferQueue;
@ -526,7 +526,7 @@ unsafe impl JSTraceable for Point2D<f32> {
}
}
unsafe impl<T, U> JSTraceable for ScaleFactor<f32, T, U> {
unsafe impl<T, U> JSTraceable for TypedScale<f32, T, U> {
#[inline]
unsafe fn trace(&self, _trc: *mut JSTracer) {
// Do nothing

View file

@ -14,7 +14,7 @@ use dom::dommatrix::DOMMatrix;
use dom::dompoint::DOMPoint;
use dom::globalscope::GlobalScope;
use dom_struct::dom_struct;
use euclid::{Transform3D, Radians};
use euclid::{Transform3D, Angle};
use std::cell::{Cell, Ref};
use std::f64;
@ -256,19 +256,19 @@ impl DOMMatrixReadOnly {
}
if rotZ != 0.0 {
// Step 5.
let rotation = Transform3D::create_rotation(0.0, 0.0, 1.0, Radians::new(rotZ.to_radians()));
let rotation = Transform3D::create_rotation(0.0, 0.0, 1.0, Angle::radians(rotZ.to_radians()));
let mut matrix = self.matrix.borrow_mut();
*matrix = rotation.post_mul(&matrix);
}
if rotY != 0.0 {
// Step 6.
let rotation = Transform3D::create_rotation(0.0, 1.0, 0.0, Radians::new(rotY.to_radians()));
let rotation = Transform3D::create_rotation(0.0, 1.0, 0.0, Angle::radians(rotY.to_radians()));
let mut matrix = self.matrix.borrow_mut();
*matrix = rotation.post_mul(&matrix);
}
if rotX != 0.0 {
// Step 7.
let rotation = Transform3D::create_rotation(1.0, 0.0, 0.0, Radians::new(rotX.to_radians()));
let rotation = Transform3D::create_rotation(1.0, 0.0, 0.0, Angle::radians(rotX.to_radians()));
let mut matrix = self.matrix.borrow_mut();
*matrix = rotation.post_mul(&matrix);
}
@ -280,7 +280,7 @@ impl DOMMatrixReadOnly {
// don't do anything when the rotation angle is zero or undefined
if y != 0.0 || x < 0.0 {
// Step 1.
let rotZ = Radians::new(f64::atan2(y, x));
let rotZ = Angle::radians(f64::atan2(y, x));
let rotation = Transform3D::create_rotation(0.0, 0.0, 1.0, rotZ);
let mut matrix = self.matrix.borrow_mut();
*matrix = rotation.post_mul(&matrix);
@ -292,7 +292,7 @@ impl DOMMatrixReadOnly {
pub fn rotate_axis_angle_self(&self, x: f64, y: f64, z: f64, angle: f64) {
// Step 1.
let (norm_x, norm_y, norm_z) = normalize_point(x, y, z);
let rotation = Transform3D::create_rotation(norm_x, norm_y, norm_z, Radians::new(angle.to_radians()));
let rotation = Transform3D::create_rotation(norm_x, norm_y, norm_z, Angle::radians(angle.to_radians()));
let mut matrix = self.matrix.borrow_mut();
*matrix = rotation.post_mul(&matrix);
// Step 2.
@ -305,7 +305,7 @@ impl DOMMatrixReadOnly {
// https://drafts.fxtf.org/geometry-1/#dom-dommatrix-skewxself
pub fn skew_x_self(&self, sx: f64) {
// Step 1.
let skew = Transform3D::create_skew(Radians::new(sx.to_radians()), Radians::new(0.0));
let skew = Transform3D::create_skew(Angle::radians(sx.to_radians()), Angle::radians(0.0));
let mut matrix = self.matrix.borrow_mut();
*matrix = skew.post_mul(&matrix);
// Step 2 in DOMMatrix.SkewXSelf
@ -314,7 +314,7 @@ impl DOMMatrixReadOnly {
// https://drafts.fxtf.org/geometry-1/#dom-dommatrix-skewyself
pub fn skew_y_self(&self, sy: f64) {
// Step 1.
let skew = Transform3D::create_skew(Radians::new(0.0), Radians::new(sy.to_radians()));
let skew = Transform3D::create_skew(Angle::radians(0.0), Angle::radians(sy.to_radians()));
let mut matrix = self.matrix.borrow_mut();
*matrix = skew.post_mul(&matrix);
// Step 2 in DOMMatrix.SkewYSelf

View file

@ -26,8 +26,8 @@ use dom::canvasrenderingcontext2d::CanvasRenderingContext2D;
use dom::paintworkletglobalscope::PaintWorkletGlobalScope;
use dom::workletglobalscope::WorkletGlobalScope;
use dom_struct::dom_struct;
use euclid::ScaleFactor;
use euclid::Size2D;
use euclid::TypedScale;
use euclid::TypedSize2D;
use ipc_channel::ipc::IpcSender;
use servo_url::ServoUrl;
@ -38,7 +38,7 @@ use style_traits::DevicePixel;
#[dom_struct]
pub struct PaintRenderingContext2D {
context: CanvasRenderingContext2D,
device_pixel_ratio: Cell<ScaleFactor<f32, CSSPixel, DevicePixel>>,
device_pixel_ratio: Cell<TypedScale<f32, CSSPixel, DevicePixel>>,
}
impl PaintRenderingContext2D {
@ -48,7 +48,7 @@ impl PaintRenderingContext2D {
let base_url = global.upcast::<WorkletGlobalScope>().base_url();
PaintRenderingContext2D {
context: CanvasRenderingContext2D::new_inherited(global.upcast(), None, image_cache, base_url, size),
device_pixel_ratio: Cell::new(ScaleFactor::new(1.0)),
device_pixel_ratio: Cell::new(TypedScale::new(1.0)),
}
}
@ -69,7 +69,7 @@ impl PaintRenderingContext2D {
pub fn set_bitmap_dimensions(&self,
size: TypedSize2D<f32, CSSPixel>,
device_pixel_ratio: ScaleFactor<f32, CSSPixel, DevicePixel>)
device_pixel_ratio: TypedScale<f32, CSSPixel, DevicePixel>)
{
let size = size * device_pixel_ratio;
self.device_pixel_ratio.set(device_pixel_ratio);

View file

@ -24,7 +24,7 @@ use dom::workletglobalscope::WorkletGlobalScope;
use dom::workletglobalscope::WorkletGlobalScopeInit;
use dom::workletglobalscope::WorkletTask;
use dom_struct::dom_struct;
use euclid::ScaleFactor;
use euclid::TypedScale;
use euclid::TypedSize2D;
use ipc_channel::ipc;
use js::jsapi::Call;
@ -79,7 +79,7 @@ pub struct PaintWorkletGlobalScope {
/// The most recent size the worklet was drawn at
cached_size: Cell<TypedSize2D<f32, CSSPixel>>,
/// The most recent device pixel ratio the worklet was drawn at
cached_device_pixel_ratio: Cell<ScaleFactor<f32, CSSPixel, DevicePixel>>,
cached_device_pixel_ratio: Cell<TypedScale<f32, CSSPixel, DevicePixel>>,
/// The most recent properties the worklet was drawn at
cached_properties: DomRefCell<Vec<(Atom, String)>>,
/// The most recent arguments the worklet was drawn at
@ -104,7 +104,7 @@ impl PaintWorkletGlobalScope {
paint_class_instances: Default::default(),
cached_name: DomRefCell::new(Atom::from("")),
cached_size: Cell::new(TypedSize2D::zero()),
cached_device_pixel_ratio: Cell::new(ScaleFactor::new(1.0)),
cached_device_pixel_ratio: Cell::new(TypedScale::new(1.0)),
cached_properties: Default::default(),
cached_arguments: Default::default(),
cached_result: DomRefCell::new(DrawAPaintImageResult {
@ -173,7 +173,7 @@ impl PaintWorkletGlobalScope {
fn draw_a_paint_image(&self,
name: &Atom,
size_in_px: TypedSize2D<f32, CSSPixel>,
device_pixel_ratio: ScaleFactor<f32, CSSPixel, DevicePixel>,
device_pixel_ratio: TypedScale<f32, CSSPixel, DevicePixel>,
properties: &StylePropertyMapReadOnly,
arguments: &[String])
-> DrawAPaintImageResult
@ -193,7 +193,7 @@ impl PaintWorkletGlobalScope {
name: &Atom,
size_in_px: TypedSize2D<f32, CSSPixel>,
size_in_dpx: TypedSize2D<u32, DevicePixel>,
device_pixel_ratio: ScaleFactor<f32, CSSPixel, DevicePixel>,
device_pixel_ratio: TypedScale<f32, CSSPixel, DevicePixel>,
properties: &StylePropertyMapReadOnly,
arguments: &[String])
-> DrawAPaintImageResult
@ -340,7 +340,7 @@ impl PaintWorkletGlobalScope {
impl Painter for WorkletPainter {
fn draw_a_paint_image(&self,
size: TypedSize2D<f32, CSSPixel>,
device_pixel_ratio: ScaleFactor<f32, CSSPixel, DevicePixel>,
device_pixel_ratio: TypedScale<f32, CSSPixel, DevicePixel>,
properties: Vec<(Atom, String)>,
arguments: Vec<String>)
-> DrawAPaintImageResult {
@ -451,7 +451,7 @@ impl PaintWorkletGlobalScopeMethods for PaintWorkletGlobalScope {
pub enum PaintWorkletTask {
DrawAPaintImage(Atom,
TypedSize2D<f32, CSSPixel>,
ScaleFactor<f32, CSSPixel, DevicePixel>,
TypedScale<f32, CSSPixel, DevicePixel>,
Vec<(Atom, String)>,
Vec<String>,
Sender<DrawAPaintImageResult>),