Skip to content

Commit b93565f

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 <[email protected]> Signed-off-by: Oriol Brufau <[email protected]>
1 parent ae2477d commit b93565f

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
@@ -192,6 +192,7 @@ pub use crate::picture::{TileNode, TileNodeKind, TileOffset};
192192
pub use crate::intern::ItemUid;
193193
pub use crate::render_api::*;
194194
pub use crate::tile_cache::{PictureCacheDebugInfo, DirtyTileDebugInfo, TileDebugInfo, SliceDebugInfo};
195+
pub use crate::util::FastTransform;
195196
pub use glyph_rasterizer;
196197
pub use bump_allocator::ChunkPool;
197198

webrender/src/util.rs

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

10251024
impl<Src, Dst> Copy for FastTransform<Src, Dst> { }
10261025

1026+
impl<Src, Dst> Default for FastTransform<Src, Dst> {
1027+
fn default() -> Self {
1028+
Self::identity()
1029+
}
1030+
}
1031+
10271032
impl<Src, Dst> FastTransform<Src, Dst> {
10281033
pub fn identity() -> Self {
10291034
FastTransform::Offset(Vector2D::zero())

0 commit comments

Comments
 (0)