Modified: trunk/Source/WebCore/ChangeLog (206055 => 206056)
--- trunk/Source/WebCore/ChangeLog 2016-09-16 23:33:33 UTC (rev 206055)
+++ trunk/Source/WebCore/ChangeLog 2016-09-17 00:14:16 UTC (rev 206056)
@@ -1,3 +1,21 @@
+2016-09-16 Brent Fulgham <bfulg...@apple.com>
+
+ [Win][Direct2D] Provide Color support for Direct2D
+ https://bugs.webkit.org/show_bug.cgi?id=162090
+
+ Reviewed by Dean Jackson.
+
+ Add casting operations to the Color class to allow easy interoption with
+ native Direct2D operations.
+
+ No new tests. No change in behavior.
+
+ * PlatformWin.cmake: Add new Windows implementation file.
+ * platform/graphics/Color.h:
+ * platform/graphics/win/ColorDirect2D.cpp: Added.
+ (WebCore::Color::Color):
+ (WebCore::Color::operator D2D1_COLOR_F):
+
2016-09-16 Antti Koivisto <an...@apple.com>
Add size assert for RenderElement
Modified: trunk/Source/WebCore/PlatformWin.cmake (206055 => 206056)
--- trunk/Source/WebCore/PlatformWin.cmake 2016-09-16 23:33:33 UTC (rev 206055)
+++ trunk/Source/WebCore/PlatformWin.cmake 2016-09-17 00:14:16 UTC (rev 206056)
@@ -86,6 +86,7 @@
platform/graphics/opentype/OpenTypeUtilities.cpp
+ platform/graphics/win/ColorDirect2D.cpp
platform/graphics/win/DIBPixelData.cpp
platform/graphics/win/FloatPointDirect2D.cpp
platform/graphics/win/FloatRectDirect2D.cpp
Modified: trunk/Source/WebCore/platform/graphics/Color.h (206055 => 206056)
--- trunk/Source/WebCore/platform/graphics/Color.h 2016-09-16 23:33:33 UTC (rev 206055)
+++ trunk/Source/WebCore/platform/graphics/Color.h 2016-09-17 00:14:16 UTC (rev 206056)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2006, 2010, 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2003-2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -39,6 +39,13 @@
typedef struct CGColor* CGColorRef;
#endif
+#if PLATFORM(WIN)
+struct _D3DCOLORVALUE;
+typedef _D3DCOLORVALUE D3DCOLORVALUE;
+typedef D3DCOLORVALUE D2D_COLOR_F;
+typedef D2D_COLOR_F D2D1_COLOR_F;
+#endif
+
#if PLATFORM(GTK)
typedef struct _GdkColor GdkColor;
#ifndef GTK_API_VERSION_2
@@ -174,6 +181,11 @@
WEBCORE_EXPORT Color(CGColorRef);
#endif
+#if PLATFORM(WIN)
+ WEBCORE_EXPORT Color(D2D1_COLOR_F);
+ WEBCORE_EXPORT operator D2D1_COLOR_F() const;
+#endif
+
static bool parseHexColor(const String&, RGBA32&);
static bool parseHexColor(const StringView&, RGBA32&);
static bool parseHexColor(const LChar*, unsigned, RGBA32&);
Added: trunk/Source/WebCore/platform/graphics/win/ColorDirect2D.cpp (0 => 206056)
--- trunk/Source/WebCore/platform/graphics/win/ColorDirect2D.cpp (rev 0)
+++ trunk/Source/WebCore/platform/graphics/win/ColorDirect2D.cpp 2016-09-17 00:14:16 UTC (rev 206056)
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "Color.h"
+
+#if PLATFORM(WIN)
+
+#include <d2d1.h>
+
+namespace WebCore {
+
+Color::Color(D2D1_COLOR_F color)
+{
+ m_color = makeRGBA(color.r * 255, color.g * 255, color.b * 255, color.a * 255);
+ m_valid = true;
+}
+
+Color::operator D2D1_COLOR_F() const
+{
+ float colorAlpha = alpha() / 255.0f;
+
+ return D2D1::ColorF(rgb(), colorAlpha);
+}
+
+}
+
+#endif // PLATFORM(WIN)