зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #4903 - Companion single Color patch (from Adenilson:singleColor02); r=pcwalton
Source-Repo: https://github.com/servo/servo Source-Revision: b5749e9855b68636d5366450602cd73397a6f219
This commit is contained in:
Родитель
4da720d734
Коммит
4a6230be7e
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)",
|
||||
|
|
|
@ -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)",
|
||||
|
|
|
@ -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)",
|
||||
|
|
Загрузка…
Ссылка в новой задаче