diff --git a/servo/components/gfx/color.rs b/servo/components/gfx/color.rs index 0bf03bff6dc5..a91c6818ee61 100644 --- a/servo/components/gfx/color.rs +++ b/servo/components/gfx/color.rs @@ -3,9 +3,12 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use azure::AzFloat; -use azure::azure_hl::Color as AzColor; +use azure::azure::AzColor; -pub type Color = AzColor; +#[inline] +pub fn new(r: AzFloat, g: AzFloat, b: AzFloat, a: AzFloat) -> AzColor { + AzColor { r: r, g: g, b: b, a: a } +} #[inline] pub fn rgb(r: u8, g: u8, b: u8) -> AzColor { diff --git a/servo/components/gfx/display_list/mod.rs b/servo/components/gfx/display_list/mod.rs index 99a7cc5fe0c4..799810e4a70b 100644 --- a/servo/components/gfx/display_list/mod.rs +++ b/servo/components/gfx/display_list/mod.rs @@ -16,7 +16,6 @@ #![deny(unsafe_blocks)] -use color::Color; use display_list::optimizer::DisplayListOptimizer; use paint_context::{PaintContext, ToAzureRect}; use self::DisplayItem::*; @@ -25,6 +24,8 @@ use text::glyph::CharIndex; use text::TextRun; use azure::azure::AzFloat; +use azure::azure_hl::{Color}; + use collections::dlist::{self, DList}; use geom::{Point2D, Rect, SideOffsets2D, Size2D, Matrix2D}; use geom::num::Zero; diff --git a/servo/components/gfx/paint_context.rs b/servo/components/gfx/paint_context.rs index cf564ed1b787..566dd48b030a 100644 --- a/servo/components/gfx/paint_context.rs +++ b/servo/components/gfx/paint_context.rs @@ -687,7 +687,10 @@ impl<'a> PaintContext<'a> { } fn scale_color(&self, color: Color, scale_factor: f32) -> Color { - return Color::new(color.r * scale_factor, color.g * scale_factor, color.b * scale_factor, color.a); + return color::new(color.r * scale_factor, + color.g * scale_factor, + color.b * scale_factor, + color.a); } fn draw_double_border_segment(&self, @@ -735,8 +738,8 @@ impl<'a> PaintContext<'a> { lighter_color = color; } else { // You can't scale black color (i.e. 'scaled = 0 * scale', equals black). - darker_color = Color::new(0.3, 0.3, 0.3, color.a); - lighter_color = Color::new(0.7, 0.7, 0.7, color.a); + darker_color = color::new(0.3, 0.3, 0.3, color.a); + lighter_color = color::new(0.7, 0.7, 0.7, color.a); } let (outer_color, inner_color) = match (direction, is_groove) { @@ -787,16 +790,16 @@ impl<'a> PaintContext<'a> { scaled_color = match direction { Direction::Top | Direction::Left => { if is_inset { - Color::new(0.3, 0.3, 0.3, color.a) + color::new(0.3, 0.3, 0.3, color.a) } else { - Color::new(0.7, 0.7, 0.7, color.a) + color::new(0.7, 0.7, 0.7, color.a) } } Direction::Right | Direction::Bottom => { if is_inset { - Color::new(0.7, 0.7, 0.7, color.a) + color::new(0.7, 0.7, 0.7, color.a) } else { - Color::new(0.3, 0.3, 0.3, color.a) + color::new(0.3, 0.3, 0.3, color.a) } } }; diff --git a/servo/components/layout/Cargo.toml b/servo/components/layout/Cargo.toml index d20ca50ab09c..3445e214a217 100644 --- a/servo/components/layout/Cargo.toml +++ b/servo/components/layout/Cargo.toml @@ -7,6 +7,9 @@ authors = ["The Servo Project Developers"] name = "layout" path = "lib.rs" +[dependencies.azure] +git = "https://github.com/servo/rust-azure" + [dependencies.canvas] path = "../canvas" diff --git a/servo/components/layout/lib.rs b/servo/components/layout/lib.rs index a73ea6a7a0f6..30057310032f 100644 --- a/servo/components/layout/lib.rs +++ b/servo/components/layout/lib.rs @@ -25,7 +25,8 @@ #[macro_use] extern crate log; -#[macro_use] extern crate bitflags; +#[macro_use]extern crate bitflags; +extern crate azure; extern crate cssparser; extern crate canvas; extern crate geom; diff --git a/servo/components/layout/util.rs b/servo/components/layout/util.rs index a5e8328118fd..481adb895c79 100644 --- a/servo/components/layout/util.rs +++ b/servo/components/layout/util.rs @@ -9,6 +9,7 @@ use incremental::RestyleDamage; use parallel::DomParallelInfo; use wrapper::{LayoutNode, TLayoutNode, ThreadSafeLayoutNode}; +use azure::azure_hl::{Color}; use gfx::display_list::OpaqueNode; use gfx; use libc::{c_void, uintptr_t}; @@ -169,11 +170,11 @@ impl OpaqueNodeMethods for OpaqueNode { /// Allows a CSS color to be converted into a graphics color. pub trait ToGfxColor { /// Converts a CSS color to a graphics color. - fn to_gfx_color(&self) -> gfx::color::Color; + fn to_gfx_color(&self) -> Color; } impl ToGfxColor for style::values::RGBA { - fn to_gfx_color(&self) -> gfx::color::Color { + fn to_gfx_color(&self) -> Color { gfx::color::rgba(self.red, self.green, self.blue, self.alpha) } } diff --git a/servo/components/servo/Cargo.lock b/servo/components/servo/Cargo.lock index 794d9e9be402..06dddf9a0c91 100644 --- a/servo/components/servo/Cargo.lock +++ b/servo/components/servo/Cargo.lock @@ -36,7 +36,7 @@ dependencies = [ [[package]] name = "azure" version = "0.1.0" -source = "git+https://github.com/servo/rust-azure#9ae7938c56e8c59d09a3ce682dd4cf5fcbb2ac57" +source = "git+https://github.com/servo/rust-azure#08d2513e8ebbfe9ce6620aa514c2f2b91059b304" dependencies = [ "core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)", "core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics)", @@ -476,6 +476,7 @@ dependencies = [ name = "layout" version = "0.0.1" dependencies = [ + "azure 0.1.0 (git+https://github.com/servo/rust-azure)", "bitflags 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "canvas 0.0.1", "cssparser 0.2.0 (git+https://github.com/servo/rust-cssparser)", diff --git a/servo/ports/cef/Cargo.lock b/servo/ports/cef/Cargo.lock index 5d9922dbd5c0..690e6ea86d58 100644 --- a/servo/ports/cef/Cargo.lock +++ b/servo/ports/cef/Cargo.lock @@ -38,7 +38,7 @@ dependencies = [ [[package]] name = "azure" version = "0.1.0" -source = "git+https://github.com/servo/rust-azure#9ae7938c56e8c59d09a3ce682dd4cf5fcbb2ac57" +source = "git+https://github.com/servo/rust-azure#08d2513e8ebbfe9ce6620aa514c2f2b91059b304" dependencies = [ "core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)", "core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics)", @@ -478,6 +478,7 @@ dependencies = [ name = "layout" version = "0.0.1" dependencies = [ + "azure 0.1.0 (git+https://github.com/servo/rust-azure)", "bitflags 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "canvas 0.0.1", "cssparser 0.2.0 (git+https://github.com/servo/rust-cssparser)", diff --git a/servo/ports/gonk/Cargo.lock b/servo/ports/gonk/Cargo.lock index 75c20199b547..f4e9dfda1ee4 100644 --- a/servo/ports/gonk/Cargo.lock +++ b/servo/ports/gonk/Cargo.lock @@ -17,7 +17,7 @@ dependencies = [ [[package]] name = "azure" version = "0.1.0" -source = "git+https://github.com/servo/rust-azure#9ae7938c56e8c59d09a3ce682dd4cf5fcbb2ac57" +source = "git+https://github.com/servo/rust-azure#08d2513e8ebbfe9ce6620aa514c2f2b91059b304" dependencies = [ "core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)", "core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics)", @@ -396,6 +396,7 @@ dependencies = [ name = "layout" version = "0.0.1" dependencies = [ + "azure 0.1.0 (git+https://github.com/servo/rust-azure)", "bitflags 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "canvas 0.0.1", "cssparser 0.2.0 (git+https://github.com/servo/rust-cssparser)",