Skip to content

Commit f7c8fc3

Browse files
committed
Address review comments
1 parent 85ca850 commit f7c8fc3

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

webrender/src/clip.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,9 +321,13 @@ pub struct ClipStore {
321321
#[derive(Debug)]
322322
pub struct ClipChainInstance {
323323
pub clips_range: ClipNodeRange,
324+
// Combined clip rect for clips that are in the
325+
// same coordinate system as the primitive.
324326
pub local_clip_rect: LayoutRect,
325327
pub has_non_root_coord_system: bool,
326328
pub has_non_local_clips: bool,
329+
// Combined clip rect in picture space (may
330+
// be more conservative that local_clip_rect).
327331
pub pic_clip_rect: PictureRect,
328332
}
329333

webrender/src/frame_builder.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* License, v. 2.0. If a copy of the MPL was not distributed with this
33
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
44

5-
use api::{ColorF, DeviceIntPoint, DeviceIntRect, DevicePixelScale, LayoutPixel, PicturePixel};
5+
use api::{ColorF, DeviceIntPoint, DevicePixelScale, LayoutPixel, PicturePixel};
66
use api::{DeviceUintPoint, DeviceUintRect, DeviceUintSize, DocumentLayer, FontRenderMode, PictureRect};
77
use api::{LayoutPoint, LayoutRect, LayoutSize, PipelineId, WorldPoint, WorldRect, WorldPixel};
88
use clip::{ClipStore};
@@ -71,7 +71,6 @@ pub struct FrameBuildingContext<'a> {
7171
pub device_pixel_scale: DevicePixelScale,
7272
pub scene_properties: &'a SceneProperties,
7373
pub pipelines: &'a FastHashMap<PipelineId, Arc<ScenePipeline>>,
74-
pub screen_rect: DeviceIntRect,
7574
pub world_rect: WorldRect,
7675
pub clip_scroll_tree: &'a ClipScrollTree,
7776
pub transforms: &'a TransformPalette,
@@ -226,7 +225,6 @@ impl FrameBuilder {
226225
device_pixel_scale,
227226
scene_properties,
228227
pipelines,
229-
screen_rect: self.screen_rect.to_i32(),
230228
world_rect,
231229
clip_scroll_tree,
232230
transforms: transform_palette,
@@ -283,8 +281,8 @@ impl FrameBuilder {
283281
let pic_state = pic.take_state();
284282

285283
let root_render_task = RenderTask::new_picture(
286-
RenderTaskLocation::Fixed(frame_context.screen_rect),
287-
frame_context.screen_rect.size.to_f32(),
284+
RenderTaskLocation::Fixed(self.screen_rect.to_i32()),
285+
self.screen_rect.size.to_f32(),
288286
root_prim_index,
289287
DeviceIntPoint::zero(),
290288
pic_state.tasks,

webrender/src/prim_store.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2263,6 +2263,9 @@ impl Primitive {
22632263
true
22642264
}
22652265

2266+
// Returns true if the primitive *might* need a clip mask. If
2267+
// false, there is no need to even check for clip masks for
2268+
// this primitive.
22662269
fn reset_clip_task(&mut self) -> bool {
22672270
self.metadata.clip_task_id = None;
22682271
match self.details {
@@ -2741,6 +2744,7 @@ impl Primitive {
27412744
println!("\tupdating clip task with pic rect {:?}", clip_chain.pic_clip_rect);
27422745
}
27432746
// Reset clips from previous frames since we may clip differently each frame.
2747+
// If this primitive never needs clip masks, just return straight away.
27442748
if !self.reset_clip_task() {
27452749
return;
27462750
}

0 commit comments

Comments
 (0)