Bug 1656236 - Update to euclid 0.22. r=kvark

Differential Revision: https://phabricator.services.mozilla.com/D85549
This commit is contained in:
Nicolas Silva 2020-08-05 14:43:44 +00:00
Родитель 0155156dc7
Коммит 31d1e467eb
79 изменённых файлов: 218 добавлений и 230 удалений

Просмотреть файл

@ -12,7 +12,7 @@ dirs = "2"
rayon = "1"
num_cpus = "1.7.0"
tracy-rs = "0.1"
euclid = { version = "0.20.14", features = ["serde"] }
euclid = { version = "0.22.0", features = ["serde"] }
app_units = "0.7"
gleam = "0.12.0"
log = "0.4"

Просмотреть файл

@ -85,7 +85,7 @@ impl SwTile {
} else {
self.valid_rect.translate(origin.to_vector())
};
let device_rect = transform.transform_rect(&bounds.to_f32().cast_unit()).unwrap().round_out().to_i32();
let device_rect = transform.outer_transformed_rect(&bounds.to_f32().cast_unit()).unwrap().round_out().to_i32();
device_rect.cast_unit().intersection(clip_rect)
}
@ -112,7 +112,7 @@ impl SwTile {
clip_rect: &DeviceIntRect,
) -> Option<(DeviceIntRect, DeviceIntRect)> {
let valid = self.valid_rect.translate(self.origin(surface).to_vector());
let valid = transform.transform_rect(&valid.to_f32().cast_unit()).unwrap().round_out().to_i32();
let valid = transform.outer_transformed_rect(&valid.to_f32().cast_unit()).unwrap().round_out().to_i32();
valid.cast_unit().intersection(clip_rect).map(|r| (r.translate(-valid.origin.to_vector().cast_unit()), r))
}
}

28
gfx/wr/Cargo.lock сгенерированный
Просмотреть файл

@ -469,7 +469,7 @@ dependencies = [
name = "direct-composition"
version = "0.1.0"
dependencies = [
"euclid 0.20.10 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
"mozangle 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"webrender 0.61.0",
@ -522,7 +522,7 @@ dependencies = [
[[package]]
name = "euclid"
version = "0.20.10"
version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1151,7 +1151,7 @@ dependencies = [
name = "peek-poke"
version = "0.2.0"
dependencies = [
"euclid 0.20.10 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
"peek-poke-derive 0.2.1",
]
@ -1178,11 +1178,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "plane-split"
version = "0.15.0"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"binary-space-partition 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.20.10 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1627,7 +1627,7 @@ dependencies = [
name = "tileview"
version = "0.1.0"
dependencies = [
"euclid 0.20.10 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ron 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)",
"webrender 0.61.0",
@ -1805,7 +1805,7 @@ dependencies = [
"core-text 19.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cstr 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"dwrote 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.20.10 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
"freetype 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1817,7 +1817,7 @@ dependencies = [
"malloc_size_of_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"mozangle 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"plane-split 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
"plane-split 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)",
"png 0.16.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"rayon 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1842,7 +1842,7 @@ dependencies = [
"app_units 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.20.10 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glutin 0.21.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rayon 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1861,7 +1861,7 @@ dependencies = [
"core-graphics 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam-channel 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"derive_more 0.99.5 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.20.10 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
"malloc_size_of_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"peek-poke 0.2.0",
"serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1954,7 +1954,7 @@ name = "wr_malloc_size_of"
version = "0.0.1"
dependencies = [
"app_units 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.20.10 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -1972,7 +1972,7 @@ dependencies = [
"crossbeam 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
"dwrote 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.20.10 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
"font-loader 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glutin 0.21.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2113,7 +2113,7 @@ dependencies = [
"checksum dwrote 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "439a1c2ba5611ad3ed731280541d36d2e9c4ac5e7fb818a27b604bdc5a6aa65b"
"checksum either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3"
"checksum env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)" = "15b0a4d2e39f8420210be8b27eeda28029729e2fd4291019455016c348240c38"
"checksum euclid 0.20.10 (registry+https://github.com/rust-lang/crates.io-index)" = "0c6a5b0c779cd0b744c73a1d2083faf181080d696903cdad99a3b03d015d7030"
"checksum euclid 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7ab0e07e345fb061928646949fdf5fb888e5d75a57385e7f5856e45be289e745"
"checksum expat-sys 2.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "658f19728920138342f68408b7cf7644d90d4784353d8ebc32e7e8663dbe45fa"
"checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed"
"checksum font-loader 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c49d6b4c11dca1a1dd931a34a9f397e2da91abe3de4110505f3530a80e560b52"
@ -2188,7 +2188,7 @@ dependencies = [
"checksum parking_lot_core 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b"
"checksum percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
"checksum pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)" = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677"
"checksum plane-split 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ffe16a646a08f4b4dd74035b9ff8e378eb1a4012a74f14f5889e7001cdbece33"
"checksum plane-split 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2211e7ccc9b6260779dd9bad59f7b10889d6361974623b9e405afd7e7e764654"
"checksum png 0.16.2 (registry+https://github.com/rust-lang/crates.io-index)" = "910f09135b1ed14bb16be445a8c23ddf0777eca485fbfc7cee00d81fecab158a"
"checksum ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b"
"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"

Просмотреть файл

@ -6,7 +6,7 @@ license = "MPL-2.0"
edition = "2018"
[target.'cfg(windows)'.dependencies]
euclid = "0.20"
euclid = "0.22"
gleam = "0.12"
mozangle = {version = "0.3.1", features = ["egl"]}
webrender = {path = "../webrender"}

Просмотреть файл

@ -60,7 +60,7 @@ debug = ["webrender/capture", "webrender/debugger", "webrender/profiler"]
[dependencies]
app_units = "0.7"
env_logger = "0.5"
euclid = "0.20"
euclid = "0.22"
gleam = "0.12"
glutin = "0.21"
rayon = "1"

Просмотреть файл

@ -165,9 +165,9 @@ impl Example for App {
self.angle0 += delta_angle * 0.1;
self.angle1 += delta_angle * 0.2;
self.angle2 -= delta_angle * 0.15;
let xf0 = LayoutTransform::create_rotation(0.0, 0.0, 1.0, Angle::radians(self.angle0));
let xf1 = LayoutTransform::create_rotation(0.0, 0.0, 1.0, Angle::radians(self.angle1));
let xf2 = LayoutTransform::create_rotation(0.0, 0.0, 1.0, Angle::radians(self.angle2));
let xf0 = LayoutTransform::rotation(0.0, 0.0, 1.0, Angle::radians(self.angle0));
let xf1 = LayoutTransform::rotation(0.0, 0.0, 1.0, Angle::radians(self.angle1));
let xf2 = LayoutTransform::rotation(0.0, 0.0, 1.0, Angle::radians(self.angle2));
let mut txn = Transaction::new();
txn.update_dynamic_properties(
DynamicProperties {

Просмотреть файл

@ -8,7 +8,7 @@ license = "MIT/Apache-2.0"
edition = "2018"
[dependencies]
euclid = { version = "0.20.0", optional = true }
euclid = { version = "0.22.0", optional = true }
peek-poke-derive = { version = "0.2", path = "./peek-poke-derive", optional = true }
[features]

Просмотреть файл

@ -12,4 +12,4 @@ ron = "0.5"
serde = {version = "1.0.88", features = ["derive"] }
webrender = {path = "../webrender", features=["capture","replay","debugger","png","profiler","no_static_freetype", "leak_checks"]}
webrender_api = {path = "../webrender_api", features=["serialize","deserialize"]}
euclid = { version = "0.20.0", features = ["serde"] }
euclid = { version = "0.22.0", features = ["serde"] }

Просмотреть файл

@ -73,7 +73,7 @@ fn tile_node_to_svg(node: &TileNode,
{
match &node.kind {
TileNodeKind::Leaf { .. } => {
let rect_world = transform.transform_rect(&node.rect.to_rect()).unwrap();
let rect_world = transform.outer_transformed_rect(&node.rect.to_rect()).unwrap();
format!("<rect x=\"{:.2}\" y=\"{:.2}\" width=\"{:.2}\" height=\"{:.2}\" />\n",
rect_world.origin.x * svg_settings.scale + svg_settings.x,
rect_world.origin.y * svg_settings.scale + svg_settings.y,
@ -296,7 +296,7 @@ fn tile_to_svg(key: TileOffset,
origin: tile.rect.origin,
size: PictureSize::new(1.0, 1.0)
};
let rect_visual_id_world = slice.transform.transform_rect(&rect_visual_id).unwrap();
let rect_visual_id_world = slice.transform.outer_transformed_rect(&rect_visual_id).unwrap();
svg += &format!("\n<text class=\"svg_tile_visual_id\" x=\"{}\" y=\"{}\">{},{} ({})</text>",
rect_visual_id_world.origin.x * svg_settings.scale + svg_settings.x,
(rect_visual_id_world.origin.y + 110.0) * svg_settings.scale + svg_settings.y,
@ -312,7 +312,7 @@ fn tile_to_svg(key: TileOffset,
origin: PicturePoint::new(rect.min.x, rect.min.y),
size: PictureSize::new(rect.max.x - rect.min.x, rect.max.y - rect.min.y),
};
let rect_world = slice.transform.transform_rect(&rect_pixel).unwrap();
let rect_world = slice.transform.outer_transformed_rect(&rect_pixel).unwrap();
let style =
if let Some(prev_tile) = prev_tile {

Просмотреть файл

@ -32,7 +32,7 @@ bitflags = "1.2"
byteorder = "1.0"
cfg-if = "0.1.2"
cstr = "0.1.2"
euclid = { version = "0.20.0", features = ["serde"] }
euclid = { version = "0.22.0", features = ["serde"] }
fxhash = "0.2.1"
gleam = "0.12.1"
image_loader = { optional = true, version = "0.23", package = "image", default-features = false, features = ["png"] }
@ -40,7 +40,7 @@ lazy_static = "1"
log = "0.4"
malloc_size_of_derive = "0.1"
num-traits = "0.2"
plane-split = "0.15"
plane-split = "0.17"
png = { optional = true, version = "0.16" }
rayon = "1"
ron = { optional = true, version = "0.5" }

Просмотреть файл

@ -1190,7 +1190,7 @@ impl BatchBuilder {
root_spatial_node_index,
).into_transform()
.with_destination::<WorldPixel>()
.post_transform(&euclid::Transform3D::from_scale(ctx.global_device_pixel_scale));
.then(&euclid::Transform3D::from_scale(ctx.global_device_pixel_scale));
let glyph_translation = DeviceVector2D::new(glyph_transform.m41, glyph_transform.m42);
@ -1249,9 +1249,7 @@ impl BatchBuilder {
let intersected = match pic_bounding_rect {
// The text run may have been clipped, for example if part of it is offscreen.
// So intersect our result with the original bounding rect.
Some(rect) => rect
.intersection(bounding_rect)
.unwrap_or_else(PictureRect::zero),
Some(rect) => rect.intersection(bounding_rect).unwrap_or_else(PictureRect::zero),
// If space mapping went off the rails, fall back to the old behavior.
//TODO: consider skipping the glyph run completely in this case.
None => *bounding_rect,
@ -2484,14 +2482,14 @@ impl BatchBuilder {
let specific_resource_address = cache_item.uv_rect_handle.as_int(gpu_cache);
prim_header.specific_prim_address = gpu_cache.get_address(&ctx.globals.default_image_handle);
let segment_local_clip_rect = prim_header.local_clip_rect.intersection(&segment.local_rect);
if segment_local_clip_rect.is_none() {
continue;
}
let segment_local_clip_rect = match prim_header.local_clip_rect.intersection(&segment.local_rect) {
Some(rect) => rect,
None => { continue; }
};
let segment_prim_header = PrimitiveHeader {
local_rect: segment.local_rect,
local_clip_rect: segment_local_clip_rect.unwrap(),
local_clip_rect: segment_local_clip_rect,
specific_prim_address: prim_header.specific_prim_address,
transform_id: prim_header.transform_id,
};

Просмотреть файл

@ -1067,12 +1067,12 @@ fn add_corner_segment(
return;
}
let segment_rect = image_rect.intersection(&non_overlapping_rect)
.unwrap_or_else(LayoutRect::zero);
if segment_rect.size.width <= 0. || segment_rect.size.height <= 0. {
return;
}
let segment_rect = match image_rect.intersection(&non_overlapping_rect) {
Some(rect) => rect,
None => {
return;
}
};
let texture_rect = segment_rect
.translate(-image_rect.origin.to_vector())

Просмотреть файл

@ -3,8 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use api::{ColorF, YuvColorSpace, YuvFormat, ImageRendering, ExternalImageId};
use api::units::{DeviceRect, DeviceIntSize, DeviceIntRect, DeviceIntPoint, WorldRect};
use api::units::{DevicePixelScale, DevicePoint, PictureRect, TexelRect, DevicePixel};
use api::units::*;
use crate::batch::{resolve_image, get_buffer_kind};
use euclid::Transform3D;
use crate::gpu_cache::GpuCache;
@ -572,7 +571,7 @@ impl CompositeState {
surface_id: tile_cache.native_surface.as_ref().map(|s| s.opaque),
offset: tile_cache.device_position,
clip_rect: device_clip_rect,
transform: CompositorSurfaceTransform::create_translation(tile_cache.device_position.x,
transform: CompositorSurfaceTransform::translation(tile_cache.device_position.x,
tile_cache.device_position.y,
0.0),
image_dependencies: [ImageDependency::INVALID; 3],
@ -746,7 +745,7 @@ impl CompositeState {
surface_id: tile_cache.native_surface.as_ref().map(|s| s.alpha),
offset: tile_cache.device_position,
clip_rect: device_clip_rect,
transform: CompositorSurfaceTransform::create_translation(tile_cache.device_position.x,
transform: CompositorSurfaceTransform::translation(tile_cache.device_position.x,
tile_cache.device_position.y,
0.0),
image_dependencies: [ImageDependency::INVALID; 3],

Просмотреть файл

@ -2781,7 +2781,7 @@ impl Device {
debug_assert!(self.shader_is_ready);
self.gl
.uniform_matrix_4fv(program.u_transform, false, &transform.to_row_major_array());
.uniform_matrix_4fv(program.u_transform, false, &transform.to_array());
}
pub fn switch_mode(&self, mode: i32) {

Просмотреть файл

@ -245,7 +245,7 @@ impl<Src, Dst> From<CoordinateSpaceMapping<Src, Dst>> for TransformKey {
CoordinateSpaceMapping::Transform(ref m) => {
TransformKey::Transform {
m: MatrixKey {
m: m.to_row_major_array(),
m: m.to_array(),
},
}
}
@ -974,7 +974,7 @@ impl Tile {
/// Print debug information about this tile to a tree printer.
fn print(&self, pt: &mut dyn PrintTreePrinter) {
pt.new_level(format!("Tile {:?}", self.id));
pt.add_item(format!("local_tile_rect: {}", self.local_tile_rect));
pt.add_item(format!("local_tile_rect: {:?}", self.local_tile_rect));
pt.add_item(format!("fract_offset: {:?}", self.fract_offset));
pt.add_item(format!("background_color: {:?}", self.background_color));
pt.add_item(format!("invalidation_reason: {:?}", self.invalidation_reason));
@ -3076,7 +3076,7 @@ impl TileCacheInstance {
);
let prim_origin = Vector3D::new(local_prim_rect.origin.x, local_prim_rect.origin.y, 0.0);
let world_to_device_scale = Transform3D::from_scale(frame_context.global_device_pixel_scale);
let transform = surface_to_world_mapper.get_transform().pre_translate(prim_origin).post_transform(&world_to_device_scale);
let transform = surface_to_world_mapper.get_transform().pre_translate(prim_origin).then(&world_to_device_scale);
(local_prim_rect.cast_unit(), transform)
}
@ -3245,7 +3245,7 @@ impl TileCacheInstance {
};
// If the rect is invalid, no need to create dependencies.
if prim_rect.size.is_empty_or_negative() {
if prim_rect.size.is_empty() {
return None;
}

Просмотреть файл

@ -1798,7 +1798,7 @@ fn get_clipped_device_rect(
) -> Option<DeviceRect> {
let unclipped_raster_rect = {
let world_rect = *unclipped * Scale::new(1.0);
let raster_rect = world_rect * device_pixel_scale.inv();
let raster_rect = world_rect * device_pixel_scale.inverse();
raster_rect.cast_unit()
};

Просмотреть файл

@ -520,7 +520,7 @@ impl Document {
}
fn has_pixels(&self) -> bool {
!self.view.scene.device_rect.size.is_empty_or_negative()
!self.view.scene.device_rect.size.is_empty()
}
fn process_frame_msg(

Просмотреть файл

@ -258,7 +258,7 @@ impl<T: RenderTarget> RenderTargetList<T> {
}
};
if alloc_size.is_empty_or_negative() && self.targets.is_empty() {
if alloc_size.is_empty() && self.targets.is_empty() {
// push an unused target here, only if we don't have any
self.targets.push(T::new(self.screen_size, self.gpu_supports_fast_clears));
}

Просмотреть файл

@ -573,7 +573,7 @@ pub fn dump_render_tasks_as_svg(
let saved = if task.saved_index.is_some() { " (Saved)" } else { "" };
let label = text(tx, ty, format!("{}{}", task.kind.as_str(), saved));
let size = text(tx, ty + 12.0, format!("{}", task.location.size()));
let size = text(tx, ty + 12.0, format!("{:?}", task.location.size()));
nodes[task_index] = Some(Node { rect, label, size });

Просмотреть файл

@ -492,7 +492,7 @@ impl<'a> SceneBuilder<'a> {
match rotation {
Rotation::Degree0 |
Rotation::Degree180 => {
LayoutTransform::create_scale(
LayoutTransform::scale(
content_size.width / scale_from.width,
content_size.height / scale_from.height,
1.0
@ -500,7 +500,7 @@ impl<'a> SceneBuilder<'a> {
},
Rotation::Degree90 |
Rotation::Degree270 => {
LayoutTransform::create_scale(
LayoutTransform::scale(
content_size.height / scale_from.width,
content_size.width / scale_from.height,
1.0
@ -515,12 +515,12 @@ impl<'a> SceneBuilder<'a> {
if vertical_flip {
let content_size = &self.iframe_size.last().unwrap();
transform = transform
.post_translate(LayoutVector3D::new(0.0, content_size.height, 0.0))
.then_translate(LayoutVector3D::new(0.0, content_size.height, 0.0))
.pre_scale(1.0, -1.0, 1.0);
}
let rotate = rotation.to_matrix(**content_size);
let transform = transform.post_transform(&rotate);
let transform = transform.then(&rotate);
PropertyBinding::Value(transform)
},

Просмотреть файл

@ -410,7 +410,7 @@ impl SpatialNode {
// perspective matrix using the scroll offset.
source_transform
.pre_translate(scroll_offset)
.post_translate(-scroll_offset)
.then_translate(-scroll_offset)
}
ReferenceFrameKind::Perspective { scrolling_relative_to: None } |
ReferenceFrameKind::Transform | ReferenceFrameKind::Zoom => source_transform,
@ -425,7 +425,7 @@ impl SpatialNode {
// between our reference frame and this node. Finally, we also include
// whatever local transformation this reference frame provides.
let relative_transform = resolved_transform
.post_translate(snap_offset(state.parent_accumulated_scroll_offset, state.coordinate_system_relative_scale_offset.scale, global_device_pixel_scale))
.then_translate(snap_offset(state.parent_accumulated_scroll_offset, state.coordinate_system_relative_scale_offset.scale, global_device_pixel_scale))
.to_transform()
.with_destination::<LayoutPixel>();
@ -462,9 +462,9 @@ impl SpatialNode {
if reset_cs_id {
// If we break 2D axis alignment or have a perspective component, we need to start a
// new incompatible coordinate system with which we cannot share clips without masking.
let transform = state.coordinate_system_relative_scale_offset
.to_transform()
.pre_transform(&relative_transform);
let transform = relative_transform.then(
&state.coordinate_system_relative_scale_offset.to_transform()
);
// Push that new coordinate system and record the new id.
let coord_system = {
@ -473,7 +473,7 @@ impl SpatialNode {
if parent_system.should_flatten {
cur_transform.flatten_z_output();
}
let world_transform = cur_transform.post_transform(&parent_system.world_transform);
let world_transform = cur_transform.then(&parent_system.world_transform);
let determinant = world_transform.determinant();
info.invertible = determinant != 0.0 && !determinant.is_nan();
@ -977,7 +977,7 @@ fn test_cst_perspective_relative_scroll() {
let mut cst = SpatialTree::new();
let pipeline_id = PipelineId::dummy();
let ext_scroll_id = ExternalScrollId(1, pipeline_id);
let transform = LayoutTransform::create_perspective(100.0);
let transform = LayoutTransform::perspective(100.0);
let root = cst.add_reference_frame(
None,

Просмотреть файл

@ -289,16 +289,16 @@ impl SpatialTree {
let child_cs = &self.coord_systems[child.coordinate_system_id.0 as usize];
let child_transform = child.content_transform
.to_transform::<LayoutPixel, LayoutPixel>()
.post_transform(&child_cs.world_transform);
.then(&child_cs.world_transform);
let parent_cs = &self.coord_systems[parent.coordinate_system_id.0 as usize];
let parent_transform = parent.content_transform
.to_transform()
.post_transform(&parent_cs.world_transform);
.then(&parent_cs.world_transform);
let result = parent_transform
.inverse()
.unwrap_or_default()
.post_transform(&child_transform)
.then(&child_transform)
.with_source::<LayoutPixel>()
.with_destination::<LayoutPixel>();
return CoordinateSpaceMapping::Transform(result);
@ -319,10 +319,10 @@ impl SpatialTree {
}
coordinate_system_id = coord_system.parent.expect("invalid parent!");
transform = transform.post_transform(&coord_system.transform);
transform = transform.then(&coord_system.transform);
}
transform = transform.post_transform(
transform = transform.then(
&parent.content_transform
.inverse()
.to_transform(),
@ -352,7 +352,7 @@ impl SpatialTree {
};
let transform = scale_offset
.to_transform()
.post_transform(&system.world_transform);
.then(&system.world_transform);
CoordinateSpaceMapping::Transform(transform)
}
@ -827,21 +827,21 @@ fn test_cst_simple_translation() {
let child1 = add_reference_frame(
&mut cst,
Some(root),
LayoutTransform::create_translation(100.0, 0.0, 0.0),
LayoutTransform::translation(100.0, 0.0, 0.0),
LayoutVector2D::zero(),
);
let child2 = add_reference_frame(
&mut cst,
Some(child1),
LayoutTransform::create_translation(0.0, 50.0, 0.0),
LayoutTransform::translation(0.0, 50.0, 0.0),
LayoutVector2D::zero(),
);
let child3 = add_reference_frame(
&mut cst,
Some(child2),
LayoutTransform::create_translation(200.0, 200.0, 0.0),
LayoutTransform::translation(200.0, 200.0, 0.0),
LayoutVector2D::zero(),
);
@ -869,21 +869,21 @@ fn test_cst_simple_scale() {
let child1 = add_reference_frame(
&mut cst,
Some(root),
LayoutTransform::create_scale(4.0, 1.0, 1.0),
LayoutTransform::scale(4.0, 1.0, 1.0),
LayoutVector2D::zero(),
);
let child2 = add_reference_frame(
&mut cst,
Some(child1),
LayoutTransform::create_scale(1.0, 2.0, 1.0),
LayoutTransform::scale(1.0, 2.0, 1.0),
LayoutVector2D::zero(),
);
let child3 = add_reference_frame(
&mut cst,
Some(child2),
LayoutTransform::create_scale(2.0, 2.0, 1.0),
LayoutTransform::scale(2.0, 2.0, 1.0),
LayoutVector2D::zero(),
);
@ -912,28 +912,28 @@ fn test_cst_scale_translation() {
let child1 = add_reference_frame(
&mut cst,
Some(root),
LayoutTransform::create_translation(100.0, 50.0, 0.0),
LayoutTransform::translation(100.0, 50.0, 0.0),
LayoutVector2D::zero(),
);
let child2 = add_reference_frame(
&mut cst,
Some(child1),
LayoutTransform::create_scale(2.0, 4.0, 1.0),
LayoutTransform::scale(2.0, 4.0, 1.0),
LayoutVector2D::zero(),
);
let child3 = add_reference_frame(
&mut cst,
Some(child2),
LayoutTransform::create_translation(200.0, -100.0, 0.0),
LayoutTransform::translation(200.0, -100.0, 0.0),
LayoutVector2D::zero(),
);
let child4 = add_reference_frame(
&mut cst,
Some(child3),
LayoutTransform::create_scale(3.0, 2.0, 1.0),
LayoutTransform::scale(3.0, 2.0, 1.0),
LayoutVector2D::zero(),
);
@ -967,7 +967,7 @@ fn test_cst_translation_rotate() {
let child1 = add_reference_frame(
&mut cst,
Some(root),
LayoutTransform::create_rotation(0.0, 0.0, 1.0, Angle::degrees(90.0)),
LayoutTransform::rotation(0.0, 0.0, 1.0, Angle::degrees(-90.0)),
LayoutVector2D::zero(),
);

Просмотреть файл

@ -1206,7 +1206,7 @@ impl TextureCache {
&mut self,
params: &CacheAllocParams,
) -> CacheEntry {
assert!(!params.descriptor.size.is_empty_or_negative());
assert!(!params.descriptor.size.is_empty());
// If this image doesn't qualify to go in the shared (batching) cache,
// allocate a standalone entry.

Просмотреть файл

@ -284,7 +284,7 @@ impl ScaleOffset {
}
pub fn to_transform<F, T>(&self) -> Transform3D<f32, F, T> {
Transform3D::row_major(
Transform3D::new(
self.scale.x,
0.0,
0.0,
@ -387,13 +387,10 @@ impl<Src, Dst> MatrixHelpers<Src, Dst> for Transform3D<f32, Src, Dst> {
fn inverse_project(&self, target: &Point2D<f32, Dst>) -> Option<Point2D<f32, Src>> {
let m: Transform2D<f32, Src, Dst>;
m = Transform2D::column_major(
self.m11 - target.x * self.m14,
self.m21 - target.x * self.m24,
self.m41 - target.x * self.m44,
self.m12 - target.y * self.m14,
self.m22 - target.y * self.m24,
self.m42 - target.y * self.m44,
m = Transform2D::new(
self.m11 - target.x * self.m14, self.m12 - target.y * self.m14,
self.m21 - target.x * self.m24, self.m22 - target.y * self.m24,
self.m41 - target.x * self.m44, self.m42 - target.y * self.m44,
);
m.inverse().map(|inv| Point2D::new(inv.m31, inv.m32))
}
@ -476,10 +473,12 @@ impl<Src, Dst> MatrixHelpers<Src, Dst> for Transform3D<f32, Src, Dst> {
}
fn cast_unit<NewSrc, NewDst>(&self) -> Transform3D<f32, NewSrc, NewDst> {
Transform3D::row_major(self.m11, self.m12, self.m13, self.m14,
self.m21, self.m22, self.m23, self.m24,
self.m31, self.m32, self.m33, self.m34,
self.m41, self.m42, self.m43, self.m44)
Transform3D::new(
self.m11, self.m12, self.m13, self.m14,
self.m21, self.m22, self.m23, self.m24,
self.m31, self.m32, self.m33, self.m34,
self.m41, self.m42, self.m43, self.m44,
)
}
}
@ -606,6 +605,9 @@ pub fn extract_inner_rect_safe<U>(
extract_inner_rect_impl(rect, radii, 1.0)
}
#[cfg(test)]
use euclid::vec3;
#[cfg(test)]
pub mod test {
use super::*;
@ -619,7 +621,7 @@ pub mod test {
let p0 = Point2D::new(1.0, 2.0);
// an identical transform doesn't need any inverse projection
assert_eq!(m0.inverse_project(&p0), Some(p0));
let m1 = Transform3D::create_rotation(0.0, 1.0, 0.0, Angle::radians(PI / 3.0));
let m1 = Transform3D::rotation(0.0, 1.0, 0.0, Angle::radians(-PI / 3.0));
// rotation by 60 degrees would imply scaling of X component by a factor of 2
assert_eq!(m1.inverse_project(&p0), Some(Point2D::new(2.0, 2.0)));
}
@ -632,18 +634,18 @@ pub mod test {
#[test]
fn scale_offset_convert() {
let xref = LayoutTransform::create_translation(130.0, 200.0, 0.0);
let xref = LayoutTransform::translation(130.0, 200.0, 0.0);
validate_convert(&xref);
let xref = LayoutTransform::create_scale(13.0, 8.0, 1.0);
let xref = LayoutTransform::scale(13.0, 8.0, 1.0);
validate_convert(&xref);
let xref = LayoutTransform::create_scale(0.5, 0.5, 1.0)
let xref = LayoutTransform::scale(0.5, 0.5, 1.0)
.pre_translate(LayoutVector3D::new(124.0, 38.0, 0.0));
validate_convert(&xref);
let xref = LayoutTransform::create_translation(50.0, 240.0, 0.0)
.pre_transform(&LayoutTransform::create_scale(30.0, 11.0, 1.0));
let xref = LayoutTransform::scale(30.0, 11.0, 1.0)
.then_translate(vec3(50.0, 240.0, 0.0));
validate_convert(&xref);
}
@ -660,23 +662,24 @@ pub mod test {
#[test]
fn scale_offset_inverse() {
let xref = LayoutTransform::create_translation(130.0, 200.0, 0.0);
let xref = LayoutTransform::translation(130.0, 200.0, 0.0);
validate_inverse(&xref);
let xref = LayoutTransform::create_scale(13.0, 8.0, 1.0);
let xref = LayoutTransform::scale(13.0, 8.0, 1.0);
validate_inverse(&xref);
let xref = LayoutTransform::create_scale(0.5, 0.5, 1.0)
.pre_translate(LayoutVector3D::new(124.0, 38.0, 0.0));
let xref = LayoutTransform::translation(124.0, 38.0, 0.0).
then_scale(0.5, 0.5, 1.0);
validate_inverse(&xref);
let xref = LayoutTransform::create_translation(50.0, 240.0, 0.0)
.pre_transform(&LayoutTransform::create_scale(30.0, 11.0, 1.0));
let xref = LayoutTransform::scale(30.0, 11.0, 1.0)
.then_translate(vec3(50.0, 240.0, 0.0));
validate_inverse(&xref);
}
fn validate_accumulate(x0: &LayoutTransform, x1: &LayoutTransform) {
let x = x0.pre_transform(x1);
let x = x1.then(&x0);
let s0 = ScaleOffset::from_transform(x0).unwrap();
let s1 = ScaleOffset::from_transform(x1).unwrap();
@ -688,8 +691,8 @@ pub mod test {
#[test]
fn scale_offset_accumulate() {
let x0 = LayoutTransform::create_translation(130.0, 200.0, 0.0);
let x1 = LayoutTransform::create_scale(7.0, 3.0, 1.0);
let x0 = LayoutTransform::translation(130.0, 200.0, 0.0);
let x1 = LayoutTransform::scale(7.0, 3.0, 1.0);
validate_accumulate(&x0, &x1);
}
@ -798,7 +801,7 @@ impl<Src, Dst> FastTransform<Src, Dst> {
pub fn to_transform(&self) -> Cow<Transform3D<f32, Src, Dst>> {
match *self {
FastTransform::Offset(offset) => Cow::Owned(
Transform3D::create_translation(offset.x, offset.y, 0.0)
Transform3D::translation(offset.x, offset.y, 0.0)
),
FastTransform::Transform { ref transform, .. } => Cow::Borrowed(transform),
}
@ -817,7 +820,7 @@ impl<Src, Dst> FastTransform<Src, Dst> {
}
}
pub fn post_transform<NewDst>(&self, other: &FastTransform<Dst, NewDst>) -> FastTransform<Src, NewDst> {
pub fn then<NewDst>(&self, other: &FastTransform<Dst, NewDst>) -> FastTransform<Src, NewDst> {
match *self {
FastTransform::Offset(offset) => match *other {
FastTransform::Offset(other_offset) => {
@ -835,15 +838,15 @@ impl<Src, Dst> FastTransform<Src, Dst> {
FastTransform::Offset(other_offset) => {
FastTransform::with_transform(
transform
.post_translate(other_offset.to_3d())
.then_translate(other_offset.to_3d())
.with_destination::<NewDst>()
)
}
FastTransform::Transform { transform: ref other_transform, inverse: ref other_inverse, is_2d: other_is_2d } => {
FastTransform::Transform {
transform: transform.post_transform(other_transform),
transform: transform.then(other_transform),
inverse: inverse.as_ref().and_then(|self_inv|
other_inverse.as_ref().map(|other_inv| self_inv.pre_transform(other_inv))
other_inverse.as_ref().map(|other_inv| other_inv.then(self_inv))
),
is_2d: is_2d & other_is_2d,
}
@ -856,7 +859,7 @@ impl<Src, Dst> FastTransform<Src, Dst> {
&self,
other: &FastTransform<NewSrc, Src>
) -> FastTransform<NewSrc, Dst> {
other.post_transform(self)
other.then(self)
}
pub fn pre_translate(&self, other_offset: Vector2D<f32, Src>) -> Self {
@ -868,13 +871,13 @@ impl<Src, Dst> FastTransform<Src, Dst> {
}
}
pub fn post_translate(&self, other_offset: Vector2D<f32, Dst>) -> Self {
pub fn then_translate(&self, other_offset: Vector2D<f32, Dst>) -> Self {
match *self {
FastTransform::Offset(offset) => {
FastTransform::Offset(offset + other_offset * Scale::<_, _, Src>::new(1.0))
}
FastTransform::Transform { ref transform, .. } => {
let transform = transform.post_translate(other_offset.to_3d());
let transform = transform.then_translate(other_offset.to_3d());
FastTransform::with_transform(transform)
}
}

Просмотреть файл

@ -476,7 +476,7 @@ pub fn update_primitive_visibility(
prim_instance.clip_set.local_clip_rect
};
if combined_local_clip_rect.size.is_empty_or_negative() {
if combined_local_clip_rect.size.is_empty() {
if prim_instance.is_chased() {
println!("\tculled for zero local clip rectangle");
}

Просмотреть файл

@ -18,7 +18,7 @@ app_units = "0.7"
bitflags = "1.2"
byteorder = "1.2.1"
derive_more = "0.99"
euclid = { version = "0.20.0", features = ["serde"] }
euclid = { version = "0.22.0", features = ["serde"] }
malloc_size_of_derive = "0.1"
serde = { version = "1.0", features = ["rc"] }
serde_derive = "1.0"

Просмотреть файл

@ -740,23 +740,23 @@ impl Rotation {
) -> LayoutTransform {
let (shift_center_to_origin, angle) = match self {
Rotation::Degree0 => {
(LayoutTransform::create_translation(-size.width / 2., -size.height / 2., 0.), Angle::degrees(0.))
(LayoutTransform::translation(-size.width / 2., -size.height / 2., 0.), Angle::degrees(0.))
},
Rotation::Degree90 => {
(LayoutTransform::create_translation(-size.height / 2., -size.width / 2., 0.), Angle::degrees(90.))
(LayoutTransform::translation(-size.height / 2., -size.width / 2., 0.), Angle::degrees(90.))
},
Rotation::Degree180 => {
(LayoutTransform::create_translation(-size.width / 2., -size.height / 2., 0.), Angle::degrees(180.))
(LayoutTransform::translation(-size.width / 2., -size.height / 2., 0.), Angle::degrees(180.))
},
Rotation::Degree270 => {
(LayoutTransform::create_translation(-size.height / 2., -size.width / 2., 0.), Angle::degrees(270.))
(LayoutTransform::translation(-size.height / 2., -size.width / 2., 0.), Angle::degrees(270.))
},
};
let shift_origin_to_center = LayoutTransform::create_translation(size.width / 2., size.height / 2., 0.);
let shift_origin_to_center = LayoutTransform::translation(size.width / 2., size.height / 2., 0.);
LayoutTransform::create_rotation(0., 0., -1.0, angle)
.pre_transform(&shift_center_to_origin)
.post_transform(&shift_origin_to_center)
shift_center_to_origin
.then(&LayoutTransform::rotation(0., 0., -1.0, angle))
.then(&shift_origin_to_center)
}
}

Просмотреть файл

@ -516,8 +516,9 @@ where
match (*self, *other) {
(All, rect) | (rect, All) => rect,
(Partial(rect1), Partial(rect2)) => Partial(rect1.intersection(&rect2)
.unwrap_or_else(Rect::zero))
(Partial(rect1), Partial(rect2)) => {
Partial(rect1.intersection(&rect2).unwrap_or_else(Rect::zero))
}
}
}
@ -526,9 +527,10 @@ where
use crate::DirtyRect::*;
match *self {
All => *rect,
Partial(dirty_rect) => dirty_rect.intersection(rect)
.unwrap_or_else(Rect::zero),
All => *rect,
Partial(dirty_rect) => {
dirty_rect.intersection(rect).unwrap_or_else(Rect::zero)
}
}
}
}

Просмотреть файл

@ -592,13 +592,12 @@ pub fn compute_valid_tiles_if_bounds_change(
new_rect: &DeviceIntRect,
tile_size: u16,
) -> Option<TileRange> {
let intersection = prev_rect.intersection(new_rect);
if intersection.is_none() {
return Some(TileRange::zero());
}
let intersection = intersection.unwrap_or_else(DeviceIntRect::zero);
let intersection = match prev_rect.intersection(new_rect) {
Some(rect) => rect,
None => {
return Some(TileRange::zero());
}
};
let left = prev_rect.min_x() != new_rect.min_x();
let right = prev_rect.max_x() != new_rect.max_x();

Просмотреть файл

@ -291,13 +291,12 @@ fn compute_valid_tiles_if_bounds_change(
new_rect: &DeviceIntRect,
tile_size: u16,
) -> Option<TileRange> {
let intersection = prev_rect.intersection(new_rect);
if intersection.is_none() {
return Some(TileRange::zero());
}
let intersection = intersection.unwrap_or_else(DeviceIntRect::zero);
let intersection = match prev_rect.intersection(new_rect) {
Some(rect) => rect,
None => {
return Some(TileRange::zero());
}
};
let left = prev_rect.min_x() != new_rect.min_x();
let right = prev_rect.max_x() != new_rect.max_x();

Просмотреть файл

@ -11,4 +11,4 @@ path = "lib.rs"
[dependencies]
app_units = "0.7"
euclid = "0.20"
euclid = "0.22"

Просмотреть файл

@ -11,7 +11,7 @@ base64 = "0.10"
bincode = "1.0"
byteorder = "1.0"
env_logger = { version = "0.5", optional = true }
euclid = "0.20"
euclid = "0.22"
gleam = "0.12"
glutin = "0.21"
app_units = "0.7"

Просмотреть файл

@ -6,7 +6,7 @@
root:
items:
- type: stacking-context
transform: rotate-z(45) rotate-x(60)
transform: rotate-z(-45) rotate-x(-60)
transform-origin: 300 300
items:
- type: box-shadow

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 13 KiB

После

Ширина:  |  Высота:  |  Размер: 13 KiB

Просмотреть файл

@ -6,7 +6,7 @@ root:
bounds: [0, 0, 0, 0]
"clip-rect": [0, 0, 0, 0]
type: "stacking-context"
transform: rotate(45) translate(200, 0)
transform: rotate(-45) translate(200, 0)
items:
-
bounds: [0, 0, 300, 300]
@ -23,7 +23,7 @@ root:
"clip-rect": [0, 0, 0, 0]
clip-and-scroll: 5
type: "stacking-context"
transform: rotate(-45) translate(-300, 0)
transform: rotate(45) translate(-300, 0)
items:
-
bounds: [0, 0, 1598, 1200]

Просмотреть файл

@ -14,7 +14,7 @@ root:
-
bounds: [0, 0, 0, 0]
type: "stacking-context"
transform: rotate(15) translate(200, 0)
transform: rotate(-15) translate(200, 0)
items:
-
bounds: [0, 0, 1000, 1000]

Просмотреть файл

@ -30,7 +30,7 @@ root:
-
bounds: [0, 0, 200, 200]
type: stacking-context
transform: rotate(90)
transform: rotate(-90)
items:
- type: clip
id: 3

Просмотреть файл

@ -1,4 +1,4 @@
platform(linux,mac) == border-with-rounded-clip.yaml border-with-rounded-clip.png
platform(linux,mac) == border-with-rounded-clip.yaml border-with-rounded-clip.png
== clip-mode.yaml clip-mode.png
== clip-ellipse.yaml clip-ellipse.png
platform(linux,mac) == clip-45-degree-rotation.yaml clip-45-degree-rotation-ref.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 59 KiB

После

Ширина:  |  Высота:  |  Размер: 59 KiB

Просмотреть файл

@ -14,7 +14,7 @@ root:
bounds: 0 0 256 256
- type: stacking-context
bounds: 50 50 0 0
transform: ["rotate-y(50)", "rotate-z(45)"]
transform: ["rotate-y(-50)", "rotate-z(-45)"]
items:
- type: clip
id: 2

Просмотреть файл

@ -8,7 +8,7 @@ root:
clip-rect: 10 0 300 300
- type: stacking-context
bounds: 30 30 0 0
transform: rotate-z(45)
transform: rotate-z(-45)
filters: drop-shadow([15, 0], 0, red)
clip-node: 2
items:

Просмотреть файл

@ -13,7 +13,7 @@ root:
items:
- type: stacking-context
bounds: [50, -10, 200, 100]
transform: rotate-z(90)
transform: rotate-z(-90)
items:
-
bounds: [0, 0, 500, 150]
@ -26,7 +26,7 @@ root:
- type: stacking-context
bounds: [150, 35, 200, 100]
filters: drop-shadow([200, 10], 5, red)
transform: rotate-z(90)
transform: rotate-z(-90)
items:
-
bounds: [0, 0, 500, 150]

Просмотреть файл

@ -3,7 +3,7 @@ root:
items:
- type: stacking-context
bounds: [0, 100, 300, 300]
transform: scale-x(0.1) rotate-z(45)
transform: scale-x(0.1) rotate-z(-45)
filter-primitives:
- type: blur
width: 10

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 13 KiB

После

Ширина:  |  Высота:  |  Размер: 13 KiB

Просмотреть файл

@ -8,7 +8,7 @@ root:
items:
- type: "stacking-context"
transform-origin: 0 250
transform: rotate-x(15)
transform: rotate-x(-15)
filter-primitives:
- type: drop-shadow
color: red

Просмотреть файл

@ -9,7 +9,7 @@ root:
items:
- type: stacking-context
bounds: [0, 0, 600, 600]
transform: rotate-x(60.0)
transform: rotate-x(-60.0)
items:
- type: rect
bounds: [000, 0, 600, 600]

Двоичные данные
gfx/wr/wrench/reftests/split/same-plane.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 4.2 KiB

После

Ширина:  |  Высота:  |  Размер: 4.2 KiB

Просмотреть файл

@ -7,7 +7,7 @@ root:
items:
- type: "stacking-context"
transform-style: preserve-3d
transform: rotate-y(30) rotate-x(75) translate(-100, 100, 0)
transform: rotate-y(-30) rotate-x(-75) translate(-100, 100, 0)
items:
- type: "stacking-context"
perspective: 400
@ -25,7 +25,7 @@ root:
color: 255 0 0 1.0000
- type: stacking-context
bounds: [0, 0, 600, 600]
transform: rotate-z(90)
transform: rotate-z(-90)
items:
-
bounds: [0, 200, 150, 200]

Просмотреть файл

@ -10,14 +10,14 @@ root:
items:
- type: stacking-context
bounds: [0, 0, 600, 600]
transform: rotate-y(60.0)
transform: rotate-y(-60.0)
items:
- type: rect
bounds: [0, 0, 600, 600]
color: [255, 0, 0, 0.5]
- type: stacking-context
bounds: [0, 0, 600, 600]
transform: rotate-y(-60.0)
transform: rotate-y(60.0)
items:
- type: rect
bounds: [0, 0, 600, 600]

Просмотреть файл

@ -10,7 +10,7 @@ root:
bounds: 0 0 100 100
color: red
- type: stacking-context
transform: rotate-y(0.1)
transform: rotate-y(-0.1)
bounds: 0 0 100 100
items:
- type: rect

Просмотреть файл

@ -2,7 +2,7 @@ root:
items:
- type: stacking-context
bounds: [0, 0, 660, 210]
transform: scale(1.5, 2.5) rotate(10)
transform: scale(1.5, 2.5) rotate(-10)
items:
- text: "a Bcd Efgh Ijklm Nopqrs Tuvwxyz"
origin: 20 50

Просмотреть файл

@ -1,7 +1,7 @@
root:
items:
- type: stacking-context
transform: scale(5.0) rotate(45)
transform: scale(5.0) rotate(-45)
transform-origin: 300 300
raster-space: local(1.0)
items:
@ -10,7 +10,7 @@ root:
size: 20
font: "FreeSans.ttf"
- type: stacking-context
transform: scale(5.0) rotate(45)
transform: scale(5.0) rotate(-45)
transform-origin: 0 400
items:
- text: "Screen"
@ -18,7 +18,7 @@ root:
size: 20
font: "FreeSans.ttf"
- type: stacking-context
transform: scale(5.0) rotate(45)
transform: scale(5.0) rotate(-45)
transform-origin: -80 240
raster-space: local(5.0)
items:

Просмотреть файл

@ -3,7 +3,7 @@
root:
items:
- type: stacking-context
transform: rotate(30)
transform: rotate(-30)
transform-origin: 80 80
items:
-
@ -38,7 +38,7 @@ root:
items:
- type: "stacking-context"
transform-origin: 235 235
transform: rotate-x(15)
transform: rotate-x(-15)
items:
-
type: "shadow"

Просмотреть файл

@ -2,7 +2,7 @@ root:
items:
- type: stacking-context
bounds: [0, 0, 430, 330]
transform: rotate(30)
transform: rotate(-30)
items:
- text: "a Bcd Efgh Ijklm Nopqrs Tuvwxyz"
origin: 50 200

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 27 KiB

После

Ширина:  |  Высота:  |  Размер: 27 KiB

Просмотреть файл

@ -3,7 +3,7 @@ root:
items:
- type: stacking-context
bounds: [50, 50, 100, 100]
transform: rotate(30)
transform: rotate(-30)
items:
- type: border
bounds: [ 10, 10, 100, 100 ]

Просмотреть файл

@ -9,7 +9,7 @@ root:
items:
-
type: "stacking-context"
transform: rotate-x(45) translate(100, 100, 0)
transform: rotate-x(-45) translate(100, 100, 0)
"transform-style": "preserve-3d"
items:
-

Просмотреть файл

@ -6,7 +6,7 @@ root:
perspective: 20
items:
- type: stacking-context
transform: rotate-z(45) rotate-x(45)
transform: rotate-z(-45) rotate-x(-45)
filters: drop-shadow([0, 0], 10000, blue)
items:
- type: rect

Двоичные данные
gfx/wr/wrench/reftests/transforms/local-clip.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 2.1 KiB

После

Ширина:  |  Высота:  |  Размер: 2.1 KiB

Просмотреть файл

@ -11,7 +11,7 @@ root:
bounds: [0, 0, 0, 0]
"clip-and-scroll": 3
type: "stacking-context"
transform: rotate(45) translate(200, 200)
transform: rotate(-45) translate(200, 200)
items:
-
bounds: [0, 0, 100, 100]

Просмотреть файл

@ -10,7 +10,7 @@ root:
-
bounds: [0, 0, 1000, 1000]
type: "stacking-context"
transform: rotate-x(-30)
transform: rotate-x(30)
items:
-
bounds: [350, 200, 260, 300]

Просмотреть файл

@ -9,7 +9,7 @@ root:
-
bounds: [128, 128, 256, 256]
type: "stacking-context"
transform: rotate-x(60) rotate-y(120)
transform: rotate-x(-60) rotate-y(-120)
items:
-
bounds: [128, 128, 256, 256]

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 16 KiB

После

Ширина:  |  Высота:  |  Размер: 16 KiB

Просмотреть файл

@ -17,7 +17,7 @@ root:
items:
-
type: "stacking-context"
transform: rotate-x(10)
transform: rotate-x(-10)
transform-origin: 300 300
filters: identity
items:

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 2.2 KiB

После

Ширина:  |  Высота:  |  Размер: 2.2 KiB

Просмотреть файл

@ -14,7 +14,7 @@ root:
-
type: "stacking-context"
bounds: [0, 0, 250, 100]
transform: rotate-y(-54)
transform: rotate-y(54)
items:
-
bounds: [0, 0, 128, 128]

Просмотреть файл

@ -9,7 +9,7 @@ root:
-
bounds: [0, 0, 1000, 1000]
type: "stacking-context"
transform: rotate-x(45)
transform: rotate-x(-45)
items:
-
bounds: [350, 400, 260, 260]

Просмотреть файл

@ -3,7 +3,7 @@ root:
items:
- type: stacking-context
bounds: [50, 50, 100, 100]
transform: rotate(30)
transform: rotate(-30)
items:
- type: rect
bounds: [ 10, 10, 80, 80 ]

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 7.2 KiB

После

Ширина:  |  Высота:  |  Размер: 7.2 KiB

Просмотреть файл

@ -14,4 +14,4 @@ root:
bounds: 20 20 200 200
color: blue
type: stacking-context
transform: rotate(33)
transform: rotate(-33)

Просмотреть файл

@ -14,4 +14,4 @@ root:
bounds: 20 20 100 100
color: blue
type: stacking-context
transform: rotate(30)
transform: rotate(-30)

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 7.3 KiB

После

Ширина:  |  Высота:  |  Размер: 7.3 KiB

Просмотреть файл

@ -44,7 +44,7 @@ root:
"backface-visible": true
type: "stacking-context"
"scroll-policy": scrollable
transform: rotate-z(1)
transform: rotate-z(-1)
"transform-style": flat
items:
-

Просмотреть файл

@ -10,13 +10,13 @@ root:
items:
- type: "stacking-context"
transform-origin: 235 235
transform: rotate-x(15)
transform: rotate-x(-15)
items:
- image: checkerboard(2, 16, 16)
bounds: [100, 100, 260, 260]
- type: "stacking-context"
transform-origin: 635 235
transform: rotate-z(45)
transform: rotate-z(-45)
items:
- image: checkerboard(2, 16, 16)
bounds: [500, 100, 260, 260]

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 72 KiB

После

Ширина:  |  Высота:  |  Размер: 72 KiB

Просмотреть файл

@ -9,14 +9,14 @@ root:
items:
- type: "stacking-context"
transform-origin: 235 235
transform: rotate-x(15)
transform: rotate-x(-15)
filters: identity
items:
- image: checkerboard(2, 16, 16)
bounds: [100, 100, 260, 260]
- type: "stacking-context"
transform-origin: 635 235
transform: rotate-z(45)
transform: rotate-z(-45)
items:
- image: checkerboard(2, 16, 16)
bounds: [500, 100, 260, 260]

Просмотреть файл

@ -6,14 +6,14 @@ root:
items:
- type: "stacking-context"
transform-origin: 235 235
transform: rotate-x(15)
transform: rotate-x(-15)
filters: blur(3, 3)
items:
- image: checkerboard(2, 16, 16)
bounds: [100, 100, 260, 260]
- type: "stacking-context"
transform-origin: 635 235
transform: rotate-z(45)
transform: rotate-z(-45)
filters: blur(3, 3)
items:
- image: checkerboard(2, 16, 16)

Просмотреть файл

@ -172,24 +172,24 @@ fn make_rotation(
axis_y: f32,
axis_z: f32,
) -> LayoutTransform {
let pre_transform = LayoutTransform::create_translation(origin.x, origin.y, 0.0);
let post_transform = LayoutTransform::create_translation(-origin.x, -origin.y, -0.0);
let pre_transform = LayoutTransform::translation(-origin.x, -origin.y, -0.0);
let post_transform = LayoutTransform::translation(origin.x, origin.y, 0.0);
let theta = 2.0f32 * f32::consts::PI - degrees.to_radians();
let transform =
LayoutTransform::identity().pre_rotate(axis_x, axis_y, axis_z, Angle::radians(theta));
pre_transform.pre_transform(&transform).pre_transform(&post_transform)
pre_transform.then(&transform).then(&post_transform)
}
pub fn make_perspective(
origin: LayoutPoint,
perspective: f32,
) -> LayoutTransform {
let pre_transform = LayoutTransform::create_translation(origin.x, origin.y, 0.0);
let post_transform = LayoutTransform::create_translation(-origin.x, -origin.y, -0.0);
let transform = LayoutTransform::create_perspective(perspective);
pre_transform.pre_transform(&transform).pre_transform(&post_transform)
let pre_transform = LayoutTransform::translation(-origin.x, -origin.y, -0.0);
let post_transform = LayoutTransform::translation(origin.x, origin.y, 0.0);
let transform = LayoutTransform::perspective(perspective);
pre_transform.then(&transform).then(&post_transform)
}
// Create a skew matrix, specified in degrees.
@ -199,7 +199,7 @@ fn make_skew(
) -> LayoutTransform {
let alpha = Angle::radians(skew_x.to_radians());
let beta = Angle::radians(skew_y.to_radians());
LayoutTransform::create_skew(alpha, beta)
LayoutTransform::skew(alpha, beta)
}
impl YamlHelper for Yaml {
@ -327,23 +327,11 @@ impl YamlHelper for Yaml {
fn as_matrix4d(&self) -> Option<LayoutTransform> {
if let Some(nums) = self.as_vec_f32() {
assert_eq!(nums.len(), 16, "expected 16 floats, got '{:?}'", self);
Some(LayoutTransform::row_major(
nums[0],
nums[1],
nums[2],
nums[3],
nums[4],
nums[5],
nums[6],
nums[7],
nums[8],
nums[9],
nums[10],
nums[11],
nums[12],
nums[13],
nums[14],
nums[15],
Some(LayoutTransform::new(
nums[0], nums[1], nums[2], nums[3],
nums[4], nums[5], nums[6], nums[7],
nums[8], nums[9], nums[10], nums[11],
nums[12], nums[13], nums[14], nums[15],
))
} else {
None
@ -365,7 +353,7 @@ impl YamlHelper for Yaml {
let mx = match function {
"translate" if args.len() >= 2 => {
let z = args.get(2).and_then(|a| a.parse().ok()).unwrap_or(0.);
LayoutTransform::create_translation(
LayoutTransform::translation(
args[0].parse().unwrap(),
args[1].parse().unwrap(),
z,
@ -386,16 +374,16 @@ impl YamlHelper for Yaml {
let y = args.get(1).and_then(|a| a.parse().ok()).unwrap_or(x);
// Default to no Z scale if unspecified.
let z = args.get(2).and_then(|a| a.parse().ok()).unwrap_or(1.0);
LayoutTransform::create_scale(x, y, z)
LayoutTransform::scale(x, y, z)
}
"scale-x" if args.len() == 1 => {
LayoutTransform::create_scale(args[0].parse().unwrap(), 1.0, 1.0)
LayoutTransform::scale(args[0].parse().unwrap(), 1.0, 1.0)
}
"scale-y" if args.len() == 1 => {
LayoutTransform::create_scale(1.0, args[0].parse().unwrap(), 1.0)
LayoutTransform::scale(1.0, args[0].parse().unwrap(), 1.0)
}
"scale-z" if args.len() == 1 => {
LayoutTransform::create_scale(1.0, 1.0, args[0].parse().unwrap())
LayoutTransform::scale(1.0, 1.0, args[0].parse().unwrap())
}
"skew" if args.len() >= 1 => {
// Default to no Y skew if unspecified.
@ -409,14 +397,14 @@ impl YamlHelper for Yaml {
make_skew(0.0, args[0].parse().unwrap())
}
"perspective" if args.len() == 1 => {
LayoutTransform::create_perspective(args[0].parse().unwrap())
LayoutTransform::perspective(args[0].parse().unwrap())
}
_ => {
println!("unknown function {}", function);
break;
}
};
transform = transform.post_transform(&mx);
transform = transform.then(&mx);
}
Some(transform)
}
@ -424,7 +412,7 @@ impl YamlHelper for Yaml {
let transform = array.iter().fold(
LayoutTransform::identity(),
|u, yaml| match yaml.as_transform(transform_origin) {
Some(ref transform) => u.pre_transform(transform),
Some(ref transform) => transform.then(&u),
None => u,
},
);

Просмотреть файл

@ -32,7 +32,7 @@ app_units = "0.7"
content-security-policy = { version = "0.4.0", features = ["serde"], optional = true }
crossbeam-channel = { version = "0.4", optional = true }
cssparser = "0.27"
euclid = "0.20"
euclid = "0.22"
hashglobe = { path = "../hashglobe" }
hyper = { version = "0.12", optional = true }
hyper_serde = { version = "0.11", optional = true }