mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Stop using int/uint in net_traits.
This commit is contained in:
parent
f22d920b4d
commit
b50b21d1da
5 changed files with 17 additions and 13 deletions
|
@ -327,15 +327,21 @@ impl ImageFragmentInfo {
|
|||
/// Returns the original inline-size of the image.
|
||||
pub fn image_inline_size(&mut self) -> Au {
|
||||
let size = self.image.get_size(self.replaced_image_fragment_info.for_node).unwrap_or(Size2D::zero());
|
||||
Au::from_px(if self.replaced_image_fragment_info.writing_mode_is_vertical { size.height }
|
||||
else { size.width })
|
||||
Au::from_px(if self.replaced_image_fragment_info.writing_mode_is_vertical {
|
||||
size.height
|
||||
} else {
|
||||
size.width
|
||||
} as isize)
|
||||
}
|
||||
|
||||
/// Returns the original block-size of the image.
|
||||
pub fn image_block_size(&mut self) -> Au {
|
||||
let size = self.image.get_size(self.replaced_image_fragment_info.for_node).unwrap_or(Size2D::zero());
|
||||
Au::from_px(if self.replaced_image_fragment_info.writing_mode_is_vertical { size.width }
|
||||
else { size.height })
|
||||
Au::from_px(if self.replaced_image_fragment_info.writing_mode_is_vertical {
|
||||
size.width
|
||||
} else {
|
||||
size.height
|
||||
} as isize)
|
||||
}
|
||||
|
||||
/// Tile an image
|
||||
|
|
|
@ -47,7 +47,7 @@ pub fn load_from_memory(buffer: &[u8]) -> Option<Image> {
|
|||
} else {
|
||||
// For non-png images, we use stb_image
|
||||
// Can't remember why we do this. Maybe it's what cairo wants
|
||||
static FORCE_DEPTH: uint = 4;
|
||||
static FORCE_DEPTH: usize = 4;
|
||||
|
||||
match stb_image2::load_from_memory_with_depth(buffer, FORCE_DEPTH, true) {
|
||||
stb_image2::LoadResult::ImageU8(mut image) => {
|
||||
|
|
|
@ -20,7 +20,7 @@ use url::Url;
|
|||
pub struct ImageHolder<NodeAddress> {
|
||||
url: Url,
|
||||
image: Option<Arc<Box<Image>>>,
|
||||
cached_size: Size2D<int>,
|
||||
cached_size: Size2D<u32>,
|
||||
local_image_cache: Arc<Mutex<LocalImageCache<NodeAddress>>>,
|
||||
}
|
||||
|
||||
|
@ -55,16 +55,15 @@ impl<NodeAddress: Send + 'static> ImageHolder<NodeAddress> {
|
|||
///
|
||||
/// The intent is that the impure version is used during layout when dimensions are used for
|
||||
/// computing layout.
|
||||
pub fn size(&self) -> Size2D<int> {
|
||||
pub fn size(&self) -> Size2D<u32> {
|
||||
self.cached_size
|
||||
}
|
||||
|
||||
/// Query and update the current image size.
|
||||
pub fn get_size(&mut self, node_address: NodeAddress) -> Option<Size2D<int>> {
|
||||
pub fn get_size(&mut self, node_address: NodeAddress) -> Option<Size2D<u32>> {
|
||||
debug!("get_size() {}", self.url.serialize());
|
||||
self.get_image(node_address).map(|img| {
|
||||
self.cached_size = Size2D(img.width as int,
|
||||
img.height as int);
|
||||
self.cached_size = Size2D(img.width, img.height);
|
||||
self.cached_size.clone()
|
||||
})
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#![feature(box_syntax)]
|
||||
#![feature(collections)]
|
||||
#![feature(core)]
|
||||
#![feature(int_uint)]
|
||||
#![feature(rustc_private)]
|
||||
#![feature(std_misc)]
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ pub trait ImageResponder<NodeAddress: Send> {
|
|||
|
||||
pub struct LocalImageCache<NodeAddress> {
|
||||
image_cache_task: ImageCacheTask,
|
||||
round_number: uint,
|
||||
round_number: u32,
|
||||
on_image_available: Option<Box<ImageResponder<NodeAddress>+Send>>,
|
||||
state_map: HashMap<Url, ImageState>
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ impl<NodeAddress: Send> LocalImageCache<NodeAddress> {
|
|||
struct ImageState {
|
||||
prefetched: bool,
|
||||
decoded: bool,
|
||||
last_request_round: uint,
|
||||
last_request_round: u32,
|
||||
last_response: ImageResponseMsg
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue