Skip to content

Commit 0211e6e

Browse files
Loirooriolmrobinson
authored 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 6766059 commit 0211e6e

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
@@ -188,6 +188,7 @@ pub use crate::picture::{TileNode, TileNodeKind, TileOffset};
188188
pub use crate::intern::ItemUid;
189189
pub use crate::render_api::*;
190190
pub use crate::tile_cache::{PictureCacheDebugInfo, DirtyTileDebugInfo, TileDebugInfo, SliceDebugInfo};
191+
pub use crate::util::FastTransform;
191192
pub use glyph_rasterizer;
192193

193194
#[cfg(feature = "sw_compositor")]

webrender/src/util.rs

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

10401039
impl<Src, Dst> Copy for FastTransform<Src, Dst> { }
10411040

1041+
impl<Src, Dst> Default for FastTransform<Src, Dst> {
1042+
fn default() -> Self {
1043+
Self::identity()
1044+
}
1045+
}
1046+
10421047
impl<Src, Dst> FastTransform<Src, Dst> {
10431048
pub fn identity() -> Self {
10441049
FastTransform::Offset(Vector2D::zero())

0 commit comments

Comments
 (0)