Changeset 206773 in webkit
- Timestamp:
- Oct 4, 2016 11:31:21 AM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r206772 r206773 1 2016-10-04 Brent Fulgham <bfulgham@apple.com> 2 3 [Win][Direct2D] Add initial D2D GraphicsContext implementation 4 https://bugs.webkit.org/show_bug.cgi?id=162917 5 6 Reviewed by Dean Jackson. 7 8 This patch lands a set of new files that implement the GraphicsContext 9 features on Windows using Direct2D. 10 11 No new tests until complete backend lands. 12 13 * platform/graphics/Color.h: Add new casting operator. 14 * platform/graphics/FloatSize.h: Ditto. 15 * platform/graphics/GraphicsContext.cpp: Update for Direct2D 16 implementation. 17 * platform/graphics/GraphicsContext.h: 18 * platform/graphics/win/ColorDirect2D.cpp: 19 (WebCore::Color::operator D2D1_VECTOR_4F): Added. 20 * platform/graphics/win/GraphicsContextCGWin.cpp: Add compiler 21 guard to avoid building when using Direct2D. 22 * platform/graphics/win/GraphicsContextDirect2D.cpp: Added. 23 * platform/graphics/win/GraphicsContextPlatformPrivateDirect2D.h: Added. 24 * platform/graphics/win/GraphicsContextWin.cpp: Update for Direct2D 25 includes. 26 * platform/graphics/win/TransformationMatrixDirect2D.cpp: Fix comment. 27 1 28 2016-10-04 Carlos Garcia Campos <cgarcia@igalia.com> 2 29 -
trunk/Source/WebCore/platform/graphics/Color.h
r206245 r206773 45 45 typedef D3DCOLORVALUE D2D_COLOR_F; 46 46 typedef D2D_COLOR_F D2D1_COLOR_F; 47 struct D2D_VECTOR_4F; 48 typedef D2D_VECTOR_4F D2D1_VECTOR_4F; 47 49 #endif 48 50 … … 185 187 WEBCORE_EXPORT Color(D2D1_COLOR_F); 186 188 WEBCORE_EXPORT operator D2D1_COLOR_F() const; 189 WEBCORE_EXPORT operator D2D1_VECTOR_4F() const; 187 190 #endif 188 191 -
trunk/Source/WebCore/platform/graphics/FloatSize.h
r205881 r206773 131 131 132 132 #if PLATFORM(WIN) 133 WEBCORE_EXPORT explicit FloatSize(const D2D1_SIZE_F&); // don't do this implicitly since it's lossy133 WEBCORE_EXPORT FloatSize(const D2D1_SIZE_F&); 134 134 operator D2D1_SIZE_F() const; 135 135 #endif -
trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp
r204654 r206773 835 835 } 836 836 837 #if !USE(CG) && !USE( CAIRO)837 #if !USE(CG) && !USE(DIRECT2D) && !USE(CAIRO) 838 838 IntRect GraphicsContext::clipBounds() const 839 839 { … … 903 903 } 904 904 905 #if !USE(CG) && !USE( CAIRO)905 #if !USE(CG) && !USE(DIRECT2D) && !USE(CAIRO) 906 906 void GraphicsContext::fillRectWithRoundedHole(const IntRect& rect, const FloatRoundedRect& roundedHoleRect, const Color& color) 907 907 { … … 958 958 } 959 959 960 #if !USE(CG) 960 #if !USE(CG) && !USE(DIRECT2D) 961 961 // Implement this if you want to go push the drawing mode into your native context immediately. 962 962 void GraphicsContext::setPlatformTextDrawingMode(TextDrawingModeFlags) … … 971 971 #endif 972 972 973 #if !USE(CG) 973 #if !USE(CG) && !USE(DIRECT2D) 974 974 void GraphicsContext::setPlatformShouldSmoothFonts(bool) 975 975 { … … 977 977 #endif 978 978 979 #if !USE(CG) && !USE( CAIRO)979 #if !USE(CG) && !USE(DIRECT2D) && !USE(CAIRO) 980 980 bool GraphicsContext::isAcceleratedContext() const 981 981 { … … 1013 1013 } 1014 1014 1015 #if !USE(CG) 1015 #if !USE(CG) && !USE(DIRECT2D) 1016 1016 void GraphicsContext::platformApplyDeviceScaleFactor(float) 1017 1017 { … … 1061 1061 } 1062 1062 1063 #if !USE(CG) 1063 #if !USE(CG) && !USE(DIRECT2D) 1064 1064 void GraphicsContext::platformFillEllipse(const FloatRect& ellipse) 1065 1065 { -
trunk/Source/WebCore/platform/graphics/GraphicsContext.h
r206631 r206773 1 1 /* 2 * Copyright (C) 2003 , 2006, 2007, 2008, 2009, 2013Apple Inc. All rights reserved.2 * Copyright (C) 2003-2016 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2008-2009 Torch Mobile, Inc. 4 4 * … … 39 39 #if USE(CG) 40 40 typedef struct CGContext PlatformGraphicsContext; 41 #elif USE(DIRECT2D) 42 interface ID2D1DCRenderTarget; 43 interface ID2D1RenderTarget; 44 interface ID2D1Factory; 45 typedef ID2D1RenderTarget PlatformGraphicsContext; 41 46 #elif USE(CAIRO) 42 47 namespace WebCore { … … 301 306 const GraphicsContextState& state() const { return m_state; } 302 307 303 #if USE(CG) || USE( CAIRO)308 #if USE(CG) || USE(DIRECT2D) || USE(CAIRO) 304 309 WEBCORE_EXPORT void drawNativeImage(const NativeImagePtr&, const FloatSize& selfSize, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator = CompositeSourceOver, BlendMode = BlendModeNormal, ImageOrientation = ImageOrientation()); 305 310 #endif 306 311 307 #if USE(CG) 312 #if USE(CG) || USE(DIRECT2D) 308 313 void applyStrokePattern(); 309 314 void applyFillPattern(); … … 505 510 #else 506 511 GraphicsContext(HDC, bool hasAlpha = false); // FIXME: To be removed. 512 GraphicsContext(HDC, ID2D1DCRenderTarget**, RECT, bool hasAlpha = false); // FIXME: To be removed. 507 513 508 514 // When set to true, child windows should be rendered into this context … … 541 547 void drawWindowsBitmap(WindowsBitmap*, const IntPoint&); 542 548 #endif 549 WEBCORE_EXPORT static ID2D1Factory* systemFactory(); 550 WEBCORE_EXPORT static ID2D1RenderTarget* defaultRenderTarget(); 551 552 WEBCORE_EXPORT void setDidBeginDraw(bool); 553 WEBCORE_EXPORT bool didBeginDraw() const; 554 D2D1_COLOR_F colorWithGlobalAlpha(const Color&) const; 555 556 ID2D1SolidColorBrush* solidStrokeBrush(); 557 ID2D1SolidColorBrush* solidFillBrush(); 543 558 #else // PLATFORM(WIN) 544 559 bool shouldIncludeChildWindows() const { return false; } … … 558 573 #if PLATFORM(WIN) && !USE(WINGDI) 559 574 void platformInit(HDC, bool hasAlpha = false); 575 void platformInit(HDC, ID2D1RenderTarget**, RECT, bool hasAlpha = false); 576 void platformInit(ID2D1RenderTarget*); 577 #endif 578 579 #if USE(DIRECT2D) 580 void drawWithoutShadow(const FloatRect& boundingRect, const std::function<void(ID2D1RenderTarget*)>&); 581 void drawWithShadow(const FloatRect& boundingRect, const std::function<void(ID2D1RenderTarget*)>&); 560 582 #endif 561 583 -
trunk/Source/WebCore/platform/graphics/win/ColorDirect2D.cpp
r206056 r206773 30 30 31 31 #include <d2d1.h> 32 #include <d2d1_1helper.h> 32 33 33 34 namespace WebCore { … … 46 47 } 47 48 49 Color::operator D2D1_VECTOR_4F() const 50 { 51 float r, g, b, a; 52 getRGBA(r, g, b, a); 53 return D2D1::Vector4F(r, g, b, a); 54 } 55 48 56 } 49 57 -
trunk/Source/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp
r196439 r206773 27 27 #include "GraphicsContextCG.h" 28 28 29 #if USE(CG) 30 29 31 #include "AffineTransform.h" 30 32 #include "GraphicsContextPlatformPrivateCG.h" … … 263 265 264 266 } 267 #endif -
trunk/Source/WebCore/platform/graphics/win/GraphicsContextWin.cpp
r191326 r206773 29 29 #if USE(CG) 30 30 #include "GraphicsContextPlatformPrivateCG.h" 31 #elif USE(DIRECT2D) 32 #include "GraphicsContextPlatformPrivateDirect2D.h" 31 33 #elif USE(CAIRO) 32 34 #include "GraphicsContextPlatformPrivateCairo.h" … … 145 147 } 146 148 147 #if PLATFORM(WIN) 149 #if PLATFORM(WIN) && !USE(DIRECT2D) 148 150 void GraphicsContextPlatformPrivate::save() 149 151 { -
trunk/Source/WebCore/platform/graphics/win/TransformationMatrixDirect2D.cpp
r205871 r206773 73 73 } 74 74 75 #endif // USE(DIRECT2D)75 #endif
Note: See TracChangeset
for help on using the changeset viewer.