gfx: Inline a few commonly-used methods that were showing up in profiles

This commit is contained in:
Patrick Walton 2014-10-28 10:55:19 -07:00
parent 541077286c
commit 0758ca9a08
2 changed files with 7 additions and 0 deletions

View file

@ -7,6 +7,7 @@ use azure::azure_hl::Color as AzColor;
pub type Color = AzColor;
#[inline]
pub fn rgb(r: u8, g: u8, b: u8) -> AzColor {
AzColor {
r: (r as AzFloat) / (255.0 as AzFloat),
@ -16,6 +17,7 @@ pub fn rgb(r: u8, g: u8, b: u8) -> AzColor {
}
}
#[inline]
pub fn rgba(r: AzFloat, g: AzFloat, b: AzFloat, a: AzFloat) -> AzColor {
AzColor { r: r, g: g, b: b, a: a }
}

View file

@ -159,6 +159,7 @@ pub enum StackingLevel {
}
impl StackingLevel {
#[inline]
pub fn from_background_and_border_level(level: BackgroundAndBorderLevel) -> StackingLevel {
match level {
RootOfStackingContextLevel => BackgroundAndBordersStackingLevel,
@ -258,6 +259,7 @@ impl<'a> Iterator<&'a DisplayList> for DisplayListIterator<'a> {
impl DisplayList {
/// Creates a new display list.
#[inline]
pub fn new() -> DisplayList {
DisplayList {
list: DList::new(),
@ -265,6 +267,7 @@ impl DisplayList {
}
/// Appends the given item to the display list.
#[inline]
pub fn push(&mut self, item: DisplayItem) {
self.list.push(item)
}
@ -297,6 +300,7 @@ impl DisplayList {
}
/// Returns a preorder iterator over the given display list.
#[inline]
pub fn iter<'a>(&'a self) -> DisplayItemIterator<'a> {
ParentDisplayItemIterator(self.list.iter())
}
@ -401,6 +405,7 @@ pub struct BaseDisplayItem {
}
impl BaseDisplayItem {
#[inline(always)]
pub fn new(bounds: Rect<Au>, node: OpaqueNode, level: StackingLevel, clip_rect: Rect<Au>)
-> BaseDisplayItem {
BaseDisplayItem {