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

Fixes for tiled blobs #3237

Merged
merged 2 commits into from Oct 29, 2018
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Next

Use u32 for TIleOffset, since Gecko generates tile sets bigger than u16.

  • Loading branch information
mattwoodrow committed Oct 29, 2018
commit 2f52831cf40bc851e818adef73e69d57e2882fc5
@@ -156,10 +156,10 @@ pub struct Tile {
}

pub struct TileIterator {
current_x: u16,
x_count: u16,
current_y: u16,
y_count: u16,
current_x: u32,
x_count: u32,
current_y: u32,
y_count: u32,
origin: TileOffset,
tile_size: LayoutSize,
leftover_offset: TileOffset,
@@ -302,26 +302,26 @@ pub fn tiles(

// Offset of the row and column of tiles with leftover size.
let leftover_offset = TileOffset::new(
(device_image_size.width / device_tile_size) as u16,
(device_image_size.height / device_tile_size) as u16,
(device_image_size.width / device_tile_size) as u32,
(device_image_size.height / device_tile_size) as u32,
);

// Number of culled out tiles to skip before the first visible tile.
let t0 = TileOffset::new(
if visible_rect.origin.x > prim_rect.origin.x {
f32::floor((visible_rect.origin.x - prim_rect.origin.x) / layer_tile_size.width) as u16
f32::floor((visible_rect.origin.x - prim_rect.origin.x) / layer_tile_size.width) as u32
} else {
0
},
if visible_rect.origin.y > prim_rect.origin.y {
f32::floor((visible_rect.origin.y - prim_rect.origin.y) / layer_tile_size.height) as u16
f32::floor((visible_rect.origin.y - prim_rect.origin.y) / layer_tile_size.height) as u32
} else {
0
},
);

let x_count = f32::ceil((visible_rect.max_x() - prim_rect.origin.x) / layer_tile_size.width) as u16 - t0.x;
let y_count = f32::ceil((visible_rect.max_y() - prim_rect.origin.y) / layer_tile_size.height) as u16 - t0.y;
let x_count = f32::ceil((visible_rect.max_x() - prim_rect.origin.x) / layer_tile_size.width) as u32 - t0.x;
let y_count = f32::ceil((visible_rect.max_y() - prim_rect.origin.y) / layer_tile_size.height) as u32 - t0.y;

let mut row_flags = EdgeAaSegmentMask::TOP;
if y_count == 1 {
@@ -352,12 +352,12 @@ pub fn compute_tile_range(
let t0 = point2(
f32::floor(visible_area.origin.x as f32 * tw),
f32::floor(visible_area.origin.y as f32 * th),
).try_cast::<u16>().unwrap_or_else(|| panic!("compute_tile_range bad values {:?} {:?}", visible_area, tile_size));
).try_cast::<u32>().unwrap_or_else(|| panic!("compute_tile_range bad values {:?} {:?}", visible_area, tile_size));

let t1 = point2(
f32::ceil(visible_area.max_x() as f32 * tw),
f32::ceil(visible_area.max_y() as f32 * th),
).try_cast::<u16>().unwrap_or_else(|| panic!("compute_tile_range bad values {:?} {:?}", visible_area, tile_size));
).try_cast::<u32>().unwrap_or_else(|| panic!("compute_tile_range bad values {:?} {:?}", visible_area, tile_size));

TileRange {
origin: t0,
@@ -93,8 +93,8 @@ pub type WorldVector3D = TypedVector3D<f32, WorldPixel>;
/// Offset in number of tiles.
#[derive(Hash, Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd)]
pub struct Tiles;
pub type TileOffset = TypedPoint2D<u16, Tiles>;
pub type TileRange = TypedRect<u16, Tiles>;
pub type TileOffset = TypedPoint2D<u32, Tiles>;
pub type TileRange = TypedRect<u32, Tiles>;

/// Scaling ratio from world pixels to device pixels.
pub type DevicePixelScale = TypedScale<f32, WorldPixel, DevicePixel>;
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.