mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
gfx: Inline a few commonly-used methods that were showing up in profiles
This commit is contained in:
parent
541077286c
commit
0758ca9a08
2 changed files with 7 additions and 0 deletions
|
@ -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 }
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue