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

Clippy fixes #2614

Merged
merged 9 commits into from Apr 6, 2018
Next

webrender: Remove borrows that aren't necessary.

  • Loading branch information
waywardmonkeys committed Apr 5, 2018
commit c1231c66e103a22fa44f4e6753585e6301c6c5a4
@@ -240,7 +240,7 @@ impl OpaqueBatchList {
// case we just see if it can be added to the existing batch or
// create a new one.
if item_area > self.pixel_area_threshold_for_new_batch {
if let Some(ref batch) = self.batches.last() {
if let Some(batch) = self.batches.last() {
if batch.key.is_compatible_with(&key) {
selected_batch_index = Some(self.batches.len() - 1);
}
@@ -655,7 +655,7 @@ impl AlphaBatchBuilder {
.into();
let polygon = make_polygon(
picture.real_local_rect,
&real_xf,
real_xf,
prim_index.0,
);

@@ -955,7 +955,7 @@ impl AlphaBatchBuilder {
ctx.resource_cache,
gpu_cache,
deferred_resolves,
&ctx.cached_gradients,
ctx.cached_gradients,
) {
self.add_brush_to_batch(
brush,
@@ -462,7 +462,7 @@ impl<'a> DisplayListFlattener<'a> {

self.add_solid_rectangle(
clip_and_scroll,
&info,
info,
border.top.color,
Some(descriptor),
);
@@ -478,7 +478,7 @@ impl<'a> DisplayListFlattener<'a> {

self.add_solid_rectangle(
clip_and_scroll,
&info,
info,
border.left.color,
Some(descriptor),
);
@@ -494,7 +494,7 @@ impl<'a> DisplayListFlattener<'a> {

self.add_solid_rectangle(
clip_and_scroll,
&info,
info,
border.right.color,
Some(descriptor),
);
@@ -512,7 +512,7 @@ impl<'a> DisplayListFlattener<'a> {

self.add_solid_rectangle(
clip_and_scroll,
&info,
info,
border.bottom.color,
Some(descriptor),
);
@@ -550,7 +550,7 @@ impl ClipScrollTree {
pt.new_level("Clip".to_owned());

pt.add_item(format!("index: {:?}", index));
let clips = clip_store.get(&handle).clips();
let clips = clip_store.get(handle).clips();
pt.new_level(format!("Clip Sources [{}]", clips.len()));
for source in clips {
pt.add_item(format!("{:?}", source));
@@ -349,11 +349,11 @@ impl VertexDescriptor {
}

fn bind(&self, gl: &gl::Gl, main: VBOId, instance: VBOId) {
Self::bind_attributes(&self.vertex_attributes, 0, 0, gl, main);
Self::bind_attributes(self.vertex_attributes, 0, 0, gl, main);

if !self.instance_attributes.is_empty() {
Self::bind_attributes(
&self.instance_attributes,
self.instance_attributes,
self.vertex_attributes.len(),
1, gl, instance,
);
@@ -410,7 +410,7 @@ impl<'a> DisplayListFlattener<'a> {
parent_id: &ClipId,
reference_frame_relative_offset: &LayerVector2D,
) {
let frame_rect = item.rect().translate(&reference_frame_relative_offset);
let frame_rect = item.rect().translate(reference_frame_relative_offset);
let sticky_frame_info = StickyFrameInfo::new(
info.margins,
info.vertical_offset_bounds,
@@ -426,7 +426,7 @@ impl<'a> DisplayListFlattener<'a> {
sticky_frame_info,
info.id.pipeline_id(),
);
self.id_to_index_mapper.map_to_parent_clip_chain(info.id, &parent_id);
self.id_to_index_mapper.map_to_parent_clip_chain(info.id, parent_id);
}

fn flatten_scroll_frame(
@@ -442,14 +442,14 @@ impl<'a> DisplayListFlattener<'a> {
*item.clip_rect(),
complex_clips,
info.image_mask,
&reference_frame_relative_offset,
reference_frame_relative_offset,
);
// Just use clip rectangle as the frame rect for this scroll frame.
// This is useful when calculating scroll extents for the
// ClipScrollNode::scroll(..) API as well as for properly setting sticky
// positioning offsets.
let frame_rect = item.clip_rect().translate(&reference_frame_relative_offset);
let content_rect = item.rect().translate(&reference_frame_relative_offset);
let frame_rect = item.clip_rect().translate(reference_frame_relative_offset);
let content_rect = item.rect().translate(reference_frame_relative_offset);

debug_assert!(info.clip_id != info.scroll_frame_id);

@@ -579,7 +579,7 @@ impl<'a> DisplayListFlattener<'a> {
clip_and_scroll_ids.scroll_node_id,
ClipRegion::create_for_clip_node_with_local_clip(
&LocalClip::from(*item.clip_rect()),
&reference_frame_relative_offset
reference_frame_relative_offset
),
);

@@ -2078,7 +2078,7 @@ impl<'a> DisplayListFlattener<'a> {
) {
let prim = {
let instance_map = self.font_instances.read().unwrap();
let font_instance = match instance_map.get(&font_instance_key) {
let font_instance = match instance_map.get(font_instance_key) {
Some(instance) => instance,
None => {
warn!("Unknown font instance key");
@@ -2122,7 +2122,7 @@ impl<'a> DisplayListFlattener<'a> {
// TODO(gw): It's possible we can relax this in
// the future, if we modify the way
// we handle subpixel blending.
if let Some(ref stacking_context) = self.sc_stack.last() {
if let Some(stacking_context) = self.sc_stack.last() {
if !stacking_context.allow_subpixel_aa {
render_mode = FontRenderMode::Alpha;
}
@@ -294,7 +294,7 @@ impl FrameBuilder {

let mut node_data = Vec::with_capacity(clip_scroll_tree.nodes.len());
let total_prim_runs =
self.prim_store.pictures.iter().fold(1, |count, ref pic| count + pic.runs.len());
self.prim_store.pictures.iter().fold(1, |count, pic| count + pic.runs.len());
let mut clip_chain_local_clip_rects = Vec::with_capacity(total_prim_runs);
clip_chain_local_clip_rects.push(LayerRect::max_rect());

@@ -414,7 +414,7 @@ impl FrameBuilder {
pub fn create_hit_tester(&mut self, clip_scroll_tree: &ClipScrollTree) -> HitTester {
HitTester::new(
&self.hit_testing_runs,
&clip_scroll_tree,
clip_scroll_tree,
&self.clip_store
)
}
@@ -847,10 +847,10 @@ impl AddFont for FontContext {
fn add_font(&mut self, font_key: &FontKey, template: &FontTemplate) {
match template {
&FontTemplate::Raw(ref bytes, index) => {
self.add_raw_font(&font_key, bytes.clone(), index);
self.add_raw_font(font_key, bytes.clone(), index);
}
&FontTemplate::Native(ref native_font_handle) => {
self.add_native_font(&font_key, (*native_font_handle).clone());
self.add_native_font(font_key, (*native_font_handle).clone());
}
}
}
@@ -861,10 +861,10 @@ impl AddFont for PathfinderFontContext {
fn add_font(&mut self, font_key: &FontKey, template: &FontTemplate) {
match template {
&FontTemplate::Raw(ref bytes, index) => {
drop(self.add_font_from_memory(&font_key, bytes.clone(), index));
drop(self.add_font_from_memory(font_key, bytes.clone(), index));
}
&FontTemplate::Native(ref native_font_handle) => {
drop(self.add_native_font(&font_key, (*native_font_handle).clone().0));
drop(self.add_native_font(font_key, (*native_font_handle).clone().0));
}
}
}
@@ -305,7 +305,7 @@ fn get_regions_for_clip_scroll_node(
_ => return Vec::new(),
};

clips.iter().map(|ref source| {
clips.iter().map(|source| {
match source.0 {
ClipSource::Rectangle(ref rect) => HitTestRegion::Rectangle(*rect),
ClipSource::RoundedRectangle(ref rect, ref radii, ref mode) =>
@@ -365,7 +365,7 @@ impl HitTest {

let point = &LayerPoint::new(self.point.x, self.point.y);
self.pipeline_id.map(|id|
hit_tester.get_pipeline_root(id).world_viewport_transform.transform_point2d(&point)
hit_tester.get_pipeline_root(id).world_viewport_transform.transform_point2d(point)
).unwrap_or_else(|| WorldPoint::new(self.point.x, self.point.y))
}
}
@@ -89,7 +89,7 @@ fn decompose_row(item_rect: &LayerRect, info: &TiledImageInfo, callback: &mut Fn
item_rect.origin.y,
info.stretch_size.width,
item_rect.size.height,
).intersection(&item_rect);
).intersection(item_rect);

if let Some(decomposed_rect) = decomposed_rect {
decompose_cache_tiles(&decomposed_rect, info, callback);
@@ -270,7 +270,7 @@ fn add_device_tile(
}

// Fix up the primitive's rect if it overflows the original item rect.
if let Some(rect) = prim_rect.intersection(&item_rect) {
if let Some(rect) = prim_rect.intersection(item_rect) {
callback(&DecomposedTile {
tile_offset,
rect,
@@ -1699,7 +1699,7 @@ impl PrimitiveStore {
let transform = &prim_run_context.scroll_node.world_content_transform;
let extra_clip = {
let metadata = &self.cpu_metadata[prim_index.0];
metadata.clip_sources.as_ref().map(|ref clip_sources| {
metadata.clip_sources.as_ref().map(|clip_sources| {
let prim_clips = frame_state.clip_store.get_mut(clip_sources);
prim_clips.update(
frame_state.gpu_cache,
@@ -2124,7 +2124,7 @@ fn convert_clip_chain_to_clip_vector(
*combined_inner_rect = if !node.screen_inner_rect.is_empty() {
// If this clip's inner area contains the area of the primitive clipped
// by previous clips, then it's not going to affect rendering in any way.
if node.screen_inner_rect.contains_rect(&combined_outer_rect) {
if node.screen_inner_rect.contains_rect(combined_outer_rect) {
return None;
}
combined_inner_rect.intersection(&node.screen_inner_rect)
@@ -2849,7 +2849,7 @@ impl Renderer {
self.submit_batch(
&batch.key,
&batch.instances,
&projection,
projection,
render_tasks,
render_target,
target_size,
@@ -3034,7 +3034,7 @@ impl Renderer {
self.submit_batch(
&batch.key,
&batch.instances,
&projection,
projection,
render_tasks,
render_target,
target_size,
@@ -590,7 +590,7 @@ impl RenderTarget for AlphaRenderTarget {
task_address,
&task_info.clips,
task_info.coordinate_system_id,
&ctx.resource_cache,
ctx.resource_cache,
gpu_cache,
clip_store,
);
@@ -479,7 +479,7 @@ impl<Src, Dst> FastTransform<Src, Dst> {
FastTransform::Offset(offset) =>
Some(TypedRect::from_untyped(&rect.to_untyped().translate(&-offset.to_untyped()))),
FastTransform::Transform { inverse: Some(ref inverse), is_2d: true, .. } =>
Some(inverse.transform_rect(&rect)),
Some(inverse.transform_rect(rect)),
FastTransform::Transform { ref transform, is_2d: false, .. } =>
Some(transform.inverse_rect_footprint(rect)),
FastTransform::Transform { inverse: None, .. } => None,
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.