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.
This patch grew to enormous size because I discovered that there were no unit tests for these functions.
Created attachment 288642 [details] Patch
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.
Created attachment 288643 [details] Patch
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.
Created attachment 288705 [details] Patch (Style red due to MS naming)
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.
Comment on attachment 288705 [details] Patch (Style red due to MS naming) Unfortunately the Direct2D types defined by Microsoft violate our coding conventions.
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.
Committed r205871: <http://trac.webkit.org/changeset/205871>
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!
(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'.
Follow-up patch (to get rid of header includes of <d2d1.h>) landed in r205881. Committed r205881: <http://trac.webkit.org/changeset/205881>