Skip to content
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

Next set of ClipScrollTree optimizations #2156

Merged
merged 4 commits into from Dec 4, 2017
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Use transform_rect in prim_store.rs

Instead of duplicating the functionality of transform_rect in
get_local_bounding_rect, just use the function from utils.rs.
  • Loading branch information
mrobinson committed Dec 4, 2017
commit 41c5eb1920725a1bbe9aabb723662baf0abf6570
@@ -2,12 +2,12 @@
* 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::{BorderRadius, BuiltDisplayList, ColorF, ComplexClipRegion, DeviceIntRect};
use api::{DevicePoint, ExtendMode, FontRenderMode, GlyphInstance, GlyphKey};
use api::{GradientStop, ImageKey, ImageRendering, ItemRange, ItemTag, LayerPoint, LayerRect};
use api::{ClipMode, LayerSize, LayerVector2D, LayerToWorldTransform, LineOrientation, LineStyle};
use api::{ClipAndScrollInfo, PremultipliedColorF, TileOffset, WorldToLayerTransform};
use api::{ClipId, LayerTransform, PipelineId, YuvColorSpace, YuvFormat};
use api::{BorderRadius, BuiltDisplayList, ClipAndScrollInfo, ClipId, ClipMode, ColorF};
use api::{ComplexClipRegion, DeviceIntRect, DevicePoint, ExtendMode, FontRenderMode};
use api::{GlyphInstance, GlyphKey, GradientStop, ImageKey, ImageRendering, ItemRange, ItemTag};
use api::{LayerPoint, LayerRect, LayerSize, LayerToWorldTransform, LayerTransform, LayerVector2D};
use api::{LineOrientation, LineStyle, PipelineId, PremultipliedColorF, TileOffset};
use api::{WorldToLayerTransform, YuvColorSpace, YuvFormat};
use border::BorderCornerInstance;
use clip_scroll_tree::{CoordinateSystemId, ClipScrollTree};
use clip::{ClipSource, ClipSourcesHandle, ClipStore};
@@ -1854,13 +1854,13 @@ impl PrimitiveStore {
profile_counters.visible_primitives.inc();

if let Some(ref matrix) = original_relative_transform {
let bounds = get_local_bounding_rect(&prim_local_rect, matrix);
let bounds = matrix.transform_rect(&prim_local_rect);
result.local_rect_in_original_parent_space =
result.local_rect_in_original_parent_space.union(&bounds);
}

if let Some(ref matrix) = parent_relative_transform {
let bounds = get_local_bounding_rect(&prim_local_rect, matrix);
let bounds = matrix.transform_rect(&prim_local_rect);
result.local_rect_in_actual_parent_space =
result.local_rect_in_actual_parent_space.union(&bounds);
}
@@ -1897,32 +1897,6 @@ impl InsideTest<ComplexClipRegion> for ComplexClipRegion {
}
}

fn get_local_bounding_rect(
local_rect: &LayerRect,
matrix: &LayerTransform
) -> LayerRect {
let vertices = [
matrix.transform_point3d(&local_rect.origin.to_3d()),
matrix.transform_point3d(&local_rect.bottom_left().to_3d()),
matrix.transform_point3d(&local_rect.bottom_right().to_3d()),
matrix.transform_point3d(&local_rect.top_right().to_3d()),
];

let mut x0 = vertices[0].x;
let mut y0 = vertices[0].y;
let mut x1 = vertices[0].x;
let mut y1 = vertices[0].y;

for v in &vertices[1..] {
x0 = x0.min(v.x);
y0 = y0.min(v.y);
x1 = x1.max(v.x);
y1 = y1.max(v.y);
}

LayerRect::new(LayerPoint::new(x0, y0), LayerSize::new(x1 - x0, y1 - y0))
}

fn create_nine_patch(
local_rect: &LayerRect,
local_clip_rect: &LayerRect,
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.