RESOLVED FIXED Bug 161818
[Win][Direct2D] Provide Direct2D-based geometry and transform cast operations
https://bugs.webkit.org/show_bug.cgi?id=161818
Summary [Win][Direct2D] Provide Direct2D-based geometry and transform cast operations
Brent Fulgham
Reported 2016-09-09 14:49:35 PDT
As a first step for creating a Direct2D backend, make it possible to cast our existing Rect, Point, and other types to and from Direct2D native types. Do the same for Transforms.
Attachments
Patch (181.91 KB, patch)
2016-09-12 16:58 PDT, Brent Fulgham
no flags
Patch (182.19 KB, patch)
2016-09-12 17:05 PDT, Brent Fulgham
no flags
Patch (Style red due to MS naming) (191.78 KB, patch)
2016-09-13 11:24 PDT, Brent Fulgham
dino: review+
Brent Fulgham
Comment 1 2016-09-12 16:45:50 PDT
This patch grew to enormous size because I discovered that there were no unit tests for these functions.
Brent Fulgham
Comment 2 2016-09-12 16:58:42 PDT
WebKit Commit Bot
Comment 3 2016-09-12 17:00:07 PDT
Attachment 288642 [details] did not pass style-queue: ERROR: Source/WebCore/platform/graphics/IntRect.h:179: D2D1_RECT_F is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/IntRect.h:180: D2D1_RECT_U is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/win/IntRectWin.cpp:59: D2D1_RECT_F is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/win/IntRectWin.cpp:64: D2D1_RECT_U is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/FloatSize.h:133: D2D1_SIZE_F is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/win/IntPointWin.cpp:71: D2D1_POINT_2F is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/win/IntPointWin.cpp:76: D2D1_POINT_2U is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/win/TransformationMatrixDirect2D.cpp:48: D2D1_MATRIX_3X2_F is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/win/TransformationMatrixDirect2D.cpp:63: D2D1_MATRIX_3X2_F is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/transforms/AffineTransform.h:42: D2D_MATRIX_3X2_F is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/transforms/AffineTransform.h:43: D2D1_MATRIX_3X2_F is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/transforms/AffineTransform.h:185: D2D1_MATRIX_3X2_F is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/transforms/TransformationMatrix.h:54: D2D_MATRIX_3X2_F is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/transforms/TransformationMatrix.h:55: D2D1_MATRIX_3X2_F is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/transforms/TransformationMatrix.h:370: D2D1_MATRIX_3X2_F is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/win/IntSizeWin.cpp:59: D2D1_SIZE_U is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/win/IntSizeWin.cpp:64: D2D1_SIZE_F is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] Total errors found: 17 in 27 files If any of these errors are false positives, please file a bug against check-webkit-style.
Brent Fulgham
Comment 4 2016-09-12 17:05:15 PDT
WebKit Commit Bot
Comment 5 2016-09-12 17:06:57 PDT
Attachment 288643 [details] did not pass style-queue: ERROR: Source/WebCore/platform/graphics/IntRect.h:179: D2D1_RECT_F is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/IntRect.h:180: D2D1_RECT_U is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/win/IntRectWin.cpp:59: D2D1_RECT_F is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/win/IntRectWin.cpp:64: D2D1_RECT_U is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/FloatSize.h:133: D2D1_SIZE_F is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/win/IntPointWin.cpp:71: D2D1_POINT_2F is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/win/IntPointWin.cpp:76: D2D1_POINT_2U is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/win/TransformationMatrixDirect2D.cpp:48: D2D1_MATRIX_3X2_F is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/win/TransformationMatrixDirect2D.cpp:63: D2D1_MATRIX_3X2_F is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/transforms/AffineTransform.h:42: D2D_MATRIX_3X2_F is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/transforms/AffineTransform.h:43: D2D1_MATRIX_3X2_F is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/transforms/AffineTransform.h:185: D2D1_MATRIX_3X2_F is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/transforms/TransformationMatrix.h:54: D2D_MATRIX_3X2_F is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/transforms/TransformationMatrix.h:55: D2D1_MATRIX_3X2_F is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/transforms/TransformationMatrix.h:370: D2D1_MATRIX_3X2_F is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/win/IntSizeWin.cpp:59: D2D1_SIZE_U is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/win/IntSizeWin.cpp:64: D2D1_SIZE_F is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] Total errors found: 17 in 27 files If any of these errors are false positives, please file a bug against check-webkit-style.
Brent Fulgham
Comment 6 2016-09-13 11:24:07 PDT
Created attachment 288705 [details] Patch (Style red due to MS naming)
WebKit Commit Bot
Comment 7 2016-09-13 11:25:45 PDT
Attachment 288705 [details] did not pass style-queue: ERROR: Source/WebCore/platform/graphics/IntRect.h:179: D2D1_RECT_F is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/IntRect.h:180: D2D1_RECT_U is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/win/IntRectWin.cpp:59: D2D1_RECT_F is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/win/IntRectWin.cpp:64: D2D1_RECT_U is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/win/FloatRectDirect2D.cpp:42: D2D1_RECT_F is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/FloatSize.h:133: D2D1_SIZE_F is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/win/IntPointWin.cpp:71: D2D1_POINT_2F is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/win/IntPointWin.cpp:76: D2D1_POINT_2U is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/win/FloatPointDirect2D.cpp:41: D2D_POINT_2F is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/win/FloatSizeDirect2D.cpp:41: D2D1_SIZE_F is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/win/TransformationMatrixDirect2D.cpp:48: D2D1_MATRIX_3X2_F is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/win/TransformationMatrixDirect2D.cpp:63: D2D1_MATRIX_3X2_F is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/transforms/AffineTransform.h:42: D2D_MATRIX_3X2_F is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/transforms/AffineTransform.h:43: D2D1_MATRIX_3X2_F is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/transforms/AffineTransform.h:185: D2D1_MATRIX_3X2_F is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/transforms/TransformationMatrix.h:54: D2D_MATRIX_3X2_F is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/transforms/TransformationMatrix.h:55: D2D1_MATRIX_3X2_F is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/transforms/TransformationMatrix.h:370: D2D1_MATRIX_3X2_F is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/win/IntSizeWin.cpp:59: D2D1_SIZE_U is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/graphics/win/IntSizeWin.cpp:64: D2D1_SIZE_F is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] Total errors found: 20 in 30 files If any of these errors are false positives, please file a bug against check-webkit-style.
Brent Fulgham
Comment 8 2016-09-13 11:26:37 PDT
Comment on attachment 288705 [details] Patch (Style red due to MS naming) Unfortunately the Direct2D types defined by Microsoft violate our coding conventions.
Dean Jackson
Comment 9 2016-09-13 12:35:20 PDT
Comment on attachment 288705 [details] Patch (Style red due to MS naming) View in context: https://bugs.webkit.org/attachment.cgi?id=288705&action=review > Source/WebCore/platform/graphics/IntPoint.h:144 > + explicit IntPoint(const D2D1_POINT_2F&); // don't do this implicitly since it's lossy Nit: Use sentence casing and punctuation.
Brent Fulgham
Comment 10 2016-09-13 12:56:59 PDT
Simon Fraser (smfr)
Comment 11 2016-09-13 13:03:18 PDT
Comment on attachment 288705 [details] Patch (Style red due to MS naming) View in context: https://bugs.webkit.org/attachment.cgi?id=288705&action=review > Source/WebCore/platform/graphics/FloatRect.h:49 > +#include <d2d1.h> Can't we forward-declare D2D1_RECT_F like we do for other platforms? This is bringing a huge header into a frequently-included WebCore header. > Source/WebCore/platform/graphics/FloatSize.h:51 > +#include <d2d1.h> Ditto. > Source/WebCore/platform/graphics/IntPoint.h:37 > +#include <d2d1.h> Again. > Source/WebCore/platform/graphics/IntRect.h:33 > +#include <d2d1.h> Again. > Source/WebCore/platform/graphics/IntSize.h:37 > +#include <d2d1.h> Again. > Source/WebCore/platform/graphics/win/FloatPointDirect2D.cpp:31 > +#include <d2d1.h> But the header included it!
Brent Fulgham
Comment 12 2016-09-13 13:12:26 PDT
(In reply to comment #11) > > Source/WebCore/platform/graphics/FloatRect.h:49 > > +#include <d2d1.h> > > Can't we forward-declare D2D1_RECT_F like we do for other platforms? This is > bringing a huge header into a frequently-included WebCore header. I did try that first, but I ran into conflicting typedefs. Our usual trick of typedefing to an opaque struct type didn't work, because they define things like: typedef struct D2D_RECT_F { float ... } D2D_RECT_F; typedef D2D_RECT_F D2D1_RECT_F; So, if I make my own D2D1_RECT_F, it screws up the header includes in various ways. I might be able to define our headers and cast operators in terms of 'D2D_RECT_F', rather than 'D2D1_RECT_F'.
Brent Fulgham
Comment 13 2016-09-13 14:59:53 PDT
Follow-up patch (to get rid of header includes of <d2d1.h>) landed in r205881. Committed r205881: <http://trac.webkit.org/changeset/205881>
Note You need to log in before you can comment on or make changes to this bug.