Bug 1617369 - Reformat recent rust changes with rustfmt r=emilio

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D88714
This commit is contained in:
Sylvestre Ledru 2020-08-31 06:51:29 +00:00
parent 939dd426e6
commit 86c0cc26c0
2 changed files with 36 additions and 49 deletions

View File

@ -35,10 +35,10 @@ use swgl_bindings::SwCompositor;
use tracy_rs::register_thread_with_profiler;
use webrender::{
api::units::*, api::*, set_profiler_hooks, AsyncPropertySampler, AsyncScreenshotHandle, Compositor,
CompositorCapabilities, CompositorConfig, DebugFlags, Device, FastHashMap, NativeSurfaceId, NativeSurfaceInfo,
NativeTileId, PipelineInfo, ProfilerHooks, RecordedFrameHandle, Renderer, RendererOptions, RendererStats,
SceneBuilderHooks, ShaderPrecacheFlags, Shaders, ThreadListener, UploadMethod, WrShaders, ONE_TIME_USAGE_HINT,
CompositorSurfaceTransform,
CompositorCapabilities, CompositorConfig, CompositorSurfaceTransform, DebugFlags, Device, FastHashMap,
NativeSurfaceId, NativeSurfaceInfo, NativeTileId, PipelineInfo, ProfilerHooks, RecordedFrameHandle, Renderer,
RendererOptions, RendererStats, SceneBuilderHooks, ShaderPrecacheFlags, Shaders, ThreadListener, UploadMethod,
WrShaders, ONE_TIME_USAGE_HINT,
};
use wr_malloc_size_of::MallocSizeOfOps;
@ -1196,11 +1196,7 @@ extern "C" {
tile_size: DeviceIntSize,
is_opaque: bool,
);
fn wr_compositor_create_external_surface(
compositor: *mut c_void,
id: NativeSurfaceId,
is_opaque: bool,
);
fn wr_compositor_create_external_surface(compositor: *mut c_void, id: NativeSurfaceId, is_opaque: bool);
fn wr_compositor_destroy_surface(compositor: *mut c_void, id: NativeSurfaceId);
fn wr_compositor_create_tile(compositor: *mut c_void, id: NativeSurfaceId, x: i32, y: i32);
fn wr_compositor_destroy_tile(compositor: *mut c_void, id: NativeSurfaceId, x: i32, y: i32);
@ -1256,11 +1252,7 @@ impl Compositor for WrCompositor {
}
}
fn create_external_surface(
&mut self,
id: NativeSurfaceId,
is_opaque: bool,
) {
fn create_external_surface(&mut self, id: NativeSurfaceId, is_opaque: bool) {
unsafe {
wr_compositor_create_external_surface(self.0, id, is_opaque);
}
@ -1284,17 +1276,12 @@ impl Compositor for WrCompositor {
}
}
fn attach_external_image(
&mut self,
id: NativeSurfaceId,
external_image: ExternalImageId,
) {
fn attach_external_image(&mut self, id: NativeSurfaceId, external_image: ExternalImageId) {
unsafe {
wr_compositor_attach_external_image(self.0, id, external_image);
}
}
fn bind(&mut self, id: NativeTileId, dirty_rect: DeviceIntRect, valid_rect: DeviceIntRect) -> NativeSurfaceInfo {
let mut surface_info = NativeSurfaceInfo {
origin: DeviceIntPoint::zero(),
@ -1332,7 +1319,7 @@ impl Compositor for WrCompositor {
id: NativeSurfaceId,
transform: CompositorSurfaceTransform,
clip_rect: DeviceIntRect,
image_rendering: ImageRendering
image_rendering: ImageRendering,
) {
unsafe {
wr_compositor_add_surface(self.0, id, &transform, clip_rect, image_rendering);
@ -1779,13 +1766,7 @@ pub extern "C" fn wr_transaction_set_display_list(
let dl_vec = dl_data.flush_into_vec();
let dl = BuiltDisplayList::from_data(dl_vec, dl_descriptor);
txn.set_display_list(
epoch,
color,
viewport_size,
(pipeline_id, dl),
preserve_frame_state,
);
txn.set_display_list(epoch, color, viewport_size, (pipeline_id, dl), preserve_frame_state);
}
#[no_mangle]
@ -2295,10 +2276,7 @@ impl WebRenderFrameBuilder {
dl_builder: DisplayListBuilder::new(root_pipeline_id),
}
}
pub fn with_capacity(
root_pipeline_id: WrPipelineId,
capacity: usize,
) -> WebRenderFrameBuilder {
pub fn with_capacity(root_pipeline_id: WrPipelineId, capacity: usize) -> WebRenderFrameBuilder {
WebRenderFrameBuilder {
root_pipeline_id: root_pipeline_id,
dl_builder: DisplayListBuilder::with_capacity(root_pipeline_id, capacity),
@ -2741,7 +2719,7 @@ fn prim_flags(is_backface_visible: bool, prefer_compositor_surface: bool) -> Pri
fn prim_flags2(
is_backface_visible: bool,
prefer_compositor_surface: bool,
supports_external_compositing: bool
supports_external_compositing: bool,
) -> PrimitiveFlags {
let mut flags = PrimitiveFlags::empty();
@ -2984,7 +2962,11 @@ pub extern "C" fn wr_dp_push_image(
clip_rect: clip,
clip_id: space_and_clip.clip_id,
spatial_id: space_and_clip.spatial_id,
flags: prim_flags2(is_backface_visible, prefer_compositor_surface, supports_external_compositing),
flags: prim_flags2(
is_backface_visible,
prefer_compositor_surface,
supports_external_compositing,
),
};
let alpha_type = if premultiplied_alpha {
@ -3068,7 +3050,11 @@ pub extern "C" fn wr_dp_push_yuv_planar_image(
clip_rect: clip,
clip_id: space_and_clip.clip_id,
spatial_id: space_and_clip.spatial_id,
flags: prim_flags2(is_backface_visible, prefer_compositor_surface, supports_external_compositing),
flags: prim_flags2(
is_backface_visible,
prefer_compositor_surface,
supports_external_compositing,
),
};
state.frame_builder.dl_builder.push_yuv_image(
@ -3107,7 +3093,11 @@ pub extern "C" fn wr_dp_push_yuv_NV12_image(
clip_rect: clip,
clip_id: space_and_clip.clip_id,
spatial_id: space_and_clip.spatial_id,
flags: prim_flags2(is_backface_visible, prefer_compositor_surface, supports_external_compositing),
flags: prim_flags2(
is_backface_visible,
prefer_compositor_surface,
supports_external_compositing,
),
};
state.frame_builder.dl_builder.push_yuv_image(
@ -3145,7 +3135,11 @@ pub extern "C" fn wr_dp_push_yuv_interleaved_image(
clip_rect: clip,
clip_id: space_and_clip.clip_id,
spatial_id: space_and_clip.spatial_id,
flags: prim_flags2(is_backface_visible, prefer_compositor_surface, supports_external_compositing),
flags: prim_flags2(
is_backface_visible,
prefer_compositor_surface,
supports_external_compositing,
),
};
state.frame_builder.dl_builder.push_yuv_image(
@ -3747,10 +3741,7 @@ pub unsafe extern "C" fn wr_api_finalize_builder(
dl_descriptor: &mut BuiltDisplayListDescriptor,
dl_data: &mut WrVecU8,
) {
let frame_builder = mem::replace(
&mut state.frame_builder,
WebRenderFrameBuilder::new(state.pipeline_id),
);
let frame_builder = mem::replace(&mut state.frame_builder, WebRenderFrameBuilder::new(state.pipeline_id));
let (_, dl) = frame_builder.dl_builder.finalize();
let (data, descriptor) = dl.into_data();
*dl_data = WrVecU8::from_vec(data);
@ -3768,11 +3759,7 @@ pub struct HitResult {
pub extern "C" fn wr_api_hit_test(dh: &mut DocumentHandle, point: WorldPoint, out_results: &mut ThinVec<HitResult>) {
dh.ensure_hit_tester();
let result = dh
.hit_tester
.as_ref()
.unwrap()
.hit_test(None, point);
let result = dh.hit_tester.as_ref().unwrap().hit_test(None, point);
for item in &result.items {
out_results.push(HitResult {

View File

@ -714,7 +714,7 @@ impl SwCompositor {
) {
(Some(y_texture), Some(u_texture), Some(v_texture)) => {
SwCompositeSource::YUV(y_texture, u_texture, v_texture, info.color_space)
},
}
_ => return,
},
_ => panic!("unsupported number of YUV planes: {}", info.yuv_planes),
@ -829,7 +829,7 @@ impl SwCompositor {
Some(overlap_rect) => overlap_rect,
None => return,
}
},
}
None => return,
};
@ -1135,7 +1135,7 @@ impl Compositor for SwCompositor {
// updated but are otherwise ready to composite.
self.flush_composites(&id, surface, tile);
return;
},
}
};
assert!(stride % 4 == 0);