Commit 3e7c7c5d authored by Romain Vimont's avatar Romain Vimont Committed by Romain Vimont

Simplify plane_offset()

There is no need to compute the superblock offset and the block offset
inside the superblock separately.
parent 71ccd911
......@@ -1169,14 +1169,9 @@ impl BlockOffset {
/// Offset of the top-left pixel of this block.
pub fn plane_offset(&self, plane: &PlaneConfig) -> PlaneOffset {
let po = self.sb_offset().plane_offset(plane);
let x_offset = self.x & LOCAL_BLOCK_MASK;
let y_offset = self.y & LOCAL_BLOCK_MASK;
PlaneOffset {
x: po.x + (x_offset as isize >> plane.xdec << BLOCK_TO_PLANE_SHIFT),
y: po.y + (y_offset as isize >> plane.ydec << BLOCK_TO_PLANE_SHIFT)
x: (self.x >> plane.xdec << BLOCK_TO_PLANE_SHIFT) as isize,
y: (self.y >> plane.ydec << BLOCK_TO_PLANE_SHIFT) as isize,
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment