mirror of
https://github.com/servo/servo.git
synced 2025-08-23 22:35:33 +01:00
Implement an FFI and matrix conversions for matrix decomposition/interpolation/recomposition.
We use Servo backend to decompose/interpolate/recompose matrices on both main thread and compositor thread.
This commit is contained in:
parent
1a3845b719
commit
1d44c273d3
5 changed files with 4392 additions and 4010 deletions
|
@ -72,12 +72,14 @@ use style::gecko_bindings::structs::{nsCSSFontFaceRule, nsCSSCounterStyleRule};
|
|||
use style::gecko_bindings::structs::{nsRestyleHint, nsChangeHint, PropertyValuePair};
|
||||
use style::gecko_bindings::structs::IterationCompositeOperation;
|
||||
use style::gecko_bindings::structs::MallocSizeOf;
|
||||
use style::gecko_bindings::structs::RawGeckoGfxMatrix4x4;
|
||||
use style::gecko_bindings::structs::RawGeckoPresContextOwned;
|
||||
use style::gecko_bindings::structs::ServoElementSnapshotTable;
|
||||
use style::gecko_bindings::structs::StyleRuleInclusion;
|
||||
use style::gecko_bindings::structs::URLExtraData;
|
||||
use style::gecko_bindings::structs::nsCSSValueSharedList;
|
||||
use style::gecko_bindings::structs::nsCompatibility;
|
||||
use style::gecko_bindings::structs::nsStyleTransformMatrix::MatrixTransformOperator;
|
||||
use style::gecko_bindings::structs::nsresult;
|
||||
use style::gecko_bindings::sugar::ownership::{FFIArcHelpers, HasFFI, HasArcFFI, HasBoxFFI};
|
||||
use style::gecko_bindings::sugar::ownership::{HasSimpleFFI, Strong};
|
||||
|
@ -1594,6 +1596,28 @@ pub extern "C" fn Servo_GetProperties_Overriding_Animation(element: RawGeckoElem
|
|||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn Servo_MatrixTransform_Operate(matrix_operator: MatrixTransformOperator,
|
||||
from: *const RawGeckoGfxMatrix4x4,
|
||||
to: *const RawGeckoGfxMatrix4x4,
|
||||
progress: f64,
|
||||
output: *mut RawGeckoGfxMatrix4x4) {
|
||||
use self::MatrixTransformOperator::{Accumulate, Interpolate};
|
||||
use style::properties::longhands::transform::computed_value::ComputedMatrix;
|
||||
|
||||
let from = ComputedMatrix::from(unsafe { from.as_ref() }.expect("not a valid 'from' matrix"));
|
||||
let to = ComputedMatrix::from(unsafe { to.as_ref() }.expect("not a valid 'to' matrix"));
|
||||
let result = match matrix_operator {
|
||||
Interpolate => from.interpolate(&to, progress),
|
||||
Accumulate => from.accumulate(&to, progress as u64),
|
||||
};
|
||||
|
||||
let output = unsafe { output.as_mut() }.expect("not a valid 'output' matrix");
|
||||
if let Ok(result) = result {
|
||||
*output = result.into();
|
||||
};
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn Servo_ParseStyleAttribute(data: *const nsACString,
|
||||
raw_extra_data: *mut URLExtraData,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue