Bug 1650359 - Move get_raster_rects to picture.rs. r=gw

It is only used there.

Differential Revision: https://phabricator.services.mozilla.com/D82179
This commit is contained in:
Nicolas Silva 2020-07-05 20:34:32 +00:00
Родитель 85c0304595
Коммит 275d45b706
3 изменённых файлов: 38 добавлений и 39 удалений

Просмотреть файл

@ -118,8 +118,7 @@ use crate::gpu_types::{UvRectKind, ZBufferId};
use plane_split::{Clipper, Polygon, Splitter};
use crate::prim_store::{SpaceMapper, PrimitiveTemplateKind};
use crate::prim_store::{SpaceSnapper, PictureIndex, PrimitiveInstance, PrimitiveInstanceKind};
use crate::prim_store::{get_raster_rects, PrimitiveScratchBuffer};
use crate::prim_store::{ColorBindingStorage, ColorBindingIndex};
use crate::prim_store::{ColorBindingStorage, ColorBindingIndex, PrimitiveScratchBuffer};
use crate::print_tree::{PrintTree, PrintTreePrinter};
use crate::render_backend::{DataStores, FrameId};
use crate::render_task_graph::RenderTaskId;
@ -133,7 +132,7 @@ use std::sync::atomic::{AtomicUsize, Ordering};
use std::collections::hash_map::Entry;
use std::ops::Range;
use crate::texture_cache::TextureCacheHandle;
use crate::util::{MaxRect, VecHelper, RectHelpers, MatrixHelpers, Recycler};
use crate::util::{MaxRect, VecHelper, RectHelpers, MatrixHelpers, Recycler, raster_rect_to_device_pixels};
use crate::filterdata::{FilterDataHandle};
use crate::visibility::{PrimitiveVisibilityMask, PrimitiveVisibilityFlags, FrameVisibilityContext, FrameVisibilityState};
#[cfg(any(feature = "capture", feature = "replay"))]
@ -7120,3 +7119,38 @@ impl CompositeState {
}
}
}
pub fn get_raster_rects(
pic_rect: PictureRect,
map_to_raster: &SpaceMapper<PicturePixel, RasterPixel>,
map_to_world: &SpaceMapper<RasterPixel, WorldPixel>,
prim_bounding_rect: WorldRect,
device_pixel_scale: DevicePixelScale,
) -> Option<(DeviceRect, DeviceRect)> {
let unclipped_raster_rect = map_to_raster.map(&pic_rect)?;
let unclipped = raster_rect_to_device_pixels(
unclipped_raster_rect,
device_pixel_scale,
);
let unclipped_world_rect = map_to_world.map(&unclipped_raster_rect)?;
let clipped_world_rect = unclipped_world_rect.intersection(&prim_bounding_rect)?;
let clipped_raster_rect = map_to_world.unmap(&clipped_world_rect)?;
let clipped_raster_rect = clipped_raster_rect.intersection(&unclipped_raster_rect)?;
let clipped = raster_rect_to_device_pixels(
clipped_raster_rect,
device_pixel_scale,
);
// Ensure that we won't try to allocate a zero-sized clip render task.
if clipped.is_empty() {
return None;
}
Some((clipped, unclipped))
}

Просмотреть файл

@ -1769,7 +1769,7 @@ fn get_unclipped_device_rect(
/// Given an unclipped device rect, try to find a minimal device space
/// rect to allocate a clip mask for, by clipping to the screen. This
/// function is very similar to get_raster_rects below. It is far from
/// function is very similar to picture::get_raster_rects. It is far from
/// ideal, and should be refactored as part of the support for setting
/// scale per-raster-root.
fn get_clipped_device_rect(

Просмотреть файл

@ -1617,41 +1617,6 @@ impl PrimitiveStore {
}
}
pub fn get_raster_rects(
pic_rect: PictureRect,
map_to_raster: &SpaceMapper<PicturePixel, RasterPixel>,
map_to_world: &SpaceMapper<RasterPixel, WorldPixel>,
prim_bounding_rect: WorldRect,
device_pixel_scale: DevicePixelScale,
) -> Option<(DeviceRect, DeviceRect)> {
let unclipped_raster_rect = map_to_raster.map(&pic_rect)?;
let unclipped = raster_rect_to_device_pixels(
unclipped_raster_rect,
device_pixel_scale,
);
let unclipped_world_rect = map_to_world.map(&unclipped_raster_rect)?;
let clipped_world_rect = unclipped_world_rect.intersection(&prim_bounding_rect)?;
let clipped_raster_rect = map_to_world.unmap(&clipped_world_rect)?;
let clipped_raster_rect = clipped_raster_rect.intersection(&unclipped_raster_rect)?;
let clipped = raster_rect_to_device_pixels(
clipped_raster_rect,
device_pixel_scale,
);
// Ensure that we won't try to allocate a zero-sized clip render task.
if clipped.is_empty() {
return None;
}
Some((clipped, unclipped))
}
/// Choose the decoration mask tile size for a given line.
///
/// Given a line with overall size `rect_size` and the given `orientation`,