зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1329666 - Follow-up with small refactoring. r=jrmuizel?
MozReview-Commit-ID: HkW73OGgVAU
This commit is contained in:
Родитель
fe1bb32f1a
Коммит
cbabf2480f
|
@ -675,6 +675,14 @@ pub struct WrRect
|
|||
height: f32
|
||||
}
|
||||
|
||||
impl WrRect
|
||||
{
|
||||
pub fn to_rect(&self) -> LayoutRect
|
||||
{
|
||||
LayoutRect::new(LayoutPoint::new(self.x, self.y), LayoutSize::new(self.width, self.height))
|
||||
}
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
pub struct WrImageMask
|
||||
{
|
||||
|
@ -683,11 +691,11 @@ pub struct WrImageMask
|
|||
repeat: bool
|
||||
}
|
||||
|
||||
impl WrRect
|
||||
impl WrImageMask
|
||||
{
|
||||
pub fn to_rect(&self) -> LayoutRect
|
||||
pub fn to_image_mask(&self) -> ImageMask
|
||||
{
|
||||
LayoutRect::new(LayoutPoint::new(self.x, self.y), LayoutSize::new(self.width, self.height))
|
||||
ImageMask { image: self.image, rect: self.rect.to_rect(), repeat: self.repeat }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -698,8 +706,8 @@ pub extern fn wr_dp_push_image(state:&mut WrState, bounds: WrRect, clip : WrRect
|
|||
let bounds = bounds.to_rect();
|
||||
let clip = clip.to_rect();
|
||||
|
||||
// convert from the C type to the Rust type
|
||||
let mask = unsafe { mask.as_ref().map(|&WrImageMask{image, ref rect,repeat}| ImageMask{image: image, rect: rect.to_rect(), repeat: repeat}) };
|
||||
// convert from the C type to the Rust type, mapping NULL to None
|
||||
let mask = unsafe { mask.as_ref().map(|m| m.to_image_mask()) };
|
||||
|
||||
let clip_region = state.frame_builder.dl_builder.new_clip_region(&clip, Vec::new(), mask);
|
||||
state.frame_builder.dl_builder.push_image(
|
||||
|
|
Загрузка…
Ссылка в новой задаче