Skip to content

Commit dae8715

Browse files
Loirooriolmrobinson
andcommitted
Expose FastTransform so that it can be used in Servo
Also derive Deserialize and Serialize for serde, not just for the capture and replay features. Co-authored-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Oriol Brufau <obrufau@igalia.com>
1 parent 8fd6c41 commit dae8715

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

webrender/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ pub use crate::picture::{TileNode, TileNodeKind, TileOffset};
198198
pub use crate::intern::ItemUid;
199199
pub use crate::render_api::*;
200200
pub use crate::tile_cache::{PictureCacheDebugInfo, DirtyTileDebugInfo, TileDebugInfo, SliceDebugInfo};
201+
pub use crate::util::FastTransform;
201202
pub use glyph_rasterizer;
202203
pub use bump_allocator::ChunkPool;
203204

webrender/src/util.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,8 +1000,7 @@ impl<U> MaxRect for Box2D<f32, U> {
10001000
/// An enum that tries to avoid expensive transformation matrix calculations
10011001
/// when possible when dealing with non-perspective axis-aligned transformations.
10021002
#[derive(Debug, MallocSizeOf)]
1003-
#[cfg_attr(feature = "capture", derive(Serialize))]
1004-
#[cfg_attr(feature = "replay", derive(Deserialize))]
1003+
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
10051004
pub enum FastTransform<Src, Dst> {
10061005
/// A simple offset, which can be used without doing any matrix math.
10071006
Offset(Vector2D<f32, Src>),
@@ -1022,6 +1021,12 @@ impl<Src, Dst> Clone for FastTransform<Src, Dst> {
10221021

10231022
impl<Src, Dst> Copy for FastTransform<Src, Dst> { }
10241023

1024+
impl<Src, Dst> Default for FastTransform<Src, Dst> {
1025+
fn default() -> Self {
1026+
Self::identity()
1027+
}
1028+
}
1029+
10251030
impl<Src, Dst> FastTransform<Src, Dst> {
10261031
pub fn identity() -> Self {
10271032
FastTransform::Offset(Vector2D::zero())

0 commit comments

Comments
 (0)