Skip to content

Construct split planes with help of the inversed transform #3093

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion webrender/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ image = { optional = true, version = "0.19" }
lazy_static = "1"
log = "0.4"
num-traits = "0.2"
plane-split = "0.13"
plane-split = "0.13.1"
png = { optional = true, version = "0.12" }
rayon = "1"
ron = { optional = true, version = "0.1.7" }
Expand Down
6 changes: 4 additions & 2 deletions webrender/src/batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -703,9 +703,11 @@ impl AlphaBatchBuilder {
if let Some(local_rect) = local_rect {
match transform.transform_kind() {
TransformedRectKind::AxisAligned => {
let polygon = Polygon::from_transformed_rect(
let inv_transform = transforms.get_world_inv_transform(prim_metadata.spatial_node_index);
let polygon = Polygon::from_transformed_rect_with_inverse(
local_rect.cast(),
transform.cast(),
&transform.cast(),
&inv_transform.cast(),
prim_index.0,
).unwrap();
splitter.add(polygon);
Expand Down
16 changes: 14 additions & 2 deletions webrender/src/gpu_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use api::{DevicePoint, DeviceSize, DeviceRect, LayoutRect, LayoutToWorldTransform, LayoutTransform};
use api::{PremultipliedColorF, LayoutToPictureTransform, PictureToLayoutTransform, PicturePixel, WorldPixel};
use api::{
DevicePoint, DeviceSize, DeviceRect, LayoutRect, LayoutToWorldTransform, LayoutTransform,
PremultipliedColorF, LayoutToPictureTransform, PictureToLayoutTransform, PicturePixel,
WorldPixel, WorldToLayoutTransform,
};
use clip_scroll_tree::{ClipScrollTree, ROOT_SPATIAL_NODE_INDEX, SpatialNodeIndex};
use gpu_cache::{GpuCacheAddress, GpuDataRequest};
use internal_types::FastHashMap;
Expand Down Expand Up @@ -487,6 +490,15 @@ impl TransformPalette {
.with_destination::<WorldPixel>()
}

pub fn get_world_inv_transform(
&self,
index: SpatialNodeIndex,
) -> WorldToLayoutTransform {
self.transforms[index.0]
.inv_transform
.with_source::<WorldPixel>()
}

// Get a transform palette id for the given spatial node.
// TODO(gw): In the future, it will be possible to specify
// a coordinate system id here, to allow retrieving
Expand Down