Index: third_party/WebKit/Source/platform/graphics/Color.h |
diff --git a/third_party/WebKit/Source/platform/graphics/Color.h b/third_party/WebKit/Source/platform/graphics/Color.h |
index 681000ace876648888670752e0a358e47ee66b09..782b1ce90e4974a1492233969eab335e5037d44e 100644 |
--- a/third_party/WebKit/Source/platform/graphics/Color.h |
+++ b/third_party/WebKit/Source/platform/graphics/Color.h |
@@ -62,20 +62,23 @@ PLATFORM_EXPORT const NamedColor* findColor(register const char* str, register u |
class PLATFORM_EXPORT Color { |
DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
public: |
- Color() : m_color(Color::transparent) { } |
- Color(RGBA32 color) : m_color(color) { } |
- Color(int r, int g, int b) : m_color(makeRGB(r, g, b)) { } |
- Color(int r, int g, int b, int a) : m_color(makeRGBA(r, g, b, a)) { } |
+ Color() : m_color(Color::transparent), m_device(false) { } |
+ Color(RGBA32 color) : m_color(color), m_device(false) { } |
+ Color(int r, int g, int b) : m_color(makeRGB(r, g, b)), m_device(false) { } |
+ Color(int r, int g, int b, int a) : m_color(makeRGBA(r, g, b, a)), m_device(false) { } |
// Color is currently limited to 32bit RGBA, perhaps some day we'll support better colors |
- Color(float r, float g, float b, float a) : m_color(makeRGBA32FromFloats(r, g, b, a)) { } |
+ Color(float r, float g, float b, float a) : m_color(makeRGBA32FromFloats(r, g, b, a)), m_device(false) { } |
// Creates a new color from the specific CMYK and alpha values. |
- Color(float c, float m, float y, float k, float a) : m_color(makeRGBAFromCMYKA(c, m, y, k, a)) { } |
+ Color(float c, float m, float y, float k, float a) : m_color(makeRGBAFromCMYKA(c, m, y, k, a)), m_device(false) { } |
+ |
+ bool isDeviceColor() const { return m_device; } |
static Color createUnchecked(int r, int g, int b) |
{ |
RGBA32 color = 0xFF000000 | r << 16 | g << 8 | b; |
return Color(color); |
} |
+ |
static Color createUnchecked(int r, int g, int b, int a) |
{ |
RGBA32 color = a << 24 | r << 16 | g << 8 | b; |
@@ -133,8 +136,18 @@ public: |
static const RGBA32 lightGray = 0xFFC0C0C0; |
static const RGBA32 transparent = 0x00000000; |
+ static Color toDeviceColor(const Color&); |
+ |
private: |
+ Color(RGBA32 color, bool device) : m_color(color), m_device(device) { } |
+ |
+ static Color asDeviceColor(const Color& color) |
+ { |
+ return Color(color.rgb(), true); |
+ } |
+ |
RGBA32 m_color; |
+ bool m_device; |
}; |
inline bool operator==(const Color& a, const Color& b) |
@@ -171,6 +184,7 @@ inline Color blend(const Color& from, const Color& to, double progress, bool ble |
blend(from.blue(), to.blue(), progress), |
blend(from.alpha(), to.alpha(), progress)); |
} |
+ |
} // namespace blink |
#endif // Color_h |