[cairo-commit] 2 commits - src/win32

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jan 10 21:31:07 UTC 2023


 src/win32/cairo-dwrite-font.cpp |   38 ++++++++++++--------------------------
 1 file changed, 12 insertions(+), 26 deletions(-)

New commits:
commit ad046709711d4d310ec293b62b6e24a371407378
Merge: 5ecfc2eb5 a599720c8
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Tue Jan 10 21:31:05 2023 +0000

    Merge branch 'bug-566' into 'master'
    
    DWrite: Don't call _controlfp_s with MCW_PC
    
    Closes #566
    
    See merge request cairo/cairo!400

commit a599720c889dd57d2c10b92c6403f99da057c556
Author: Fujii Hironori <Hironori.Fujii at sony.com>
Date:   Tue Jan 10 13:55:59 2023 +0900

    DWrite: Don't call _controlfp_s with MCW_PC
    
    GeometryRecorder class was calling _controlfp_s with MCW_PC to reset
    the floating point precision to default. However, MCW_PC isn't
    supported for ARM or x64 platforms. It reports an assertion failure
    for them. And, Cairo isn't changing the MCW_PC setting. Removed the
    calls. Also, removed `GetFixedX` and `GetFixedY` methods because they
    called only `_cairo_fixed_from_double`.
    
    Fixes cairo/cairo#566

diff --git a/src/win32/cairo-dwrite-font.cpp b/src/win32/cairo-dwrite-font.cpp
index ea87fe7e1..03f1668d3 100644
--- a/src/win32/cairo-dwrite-font.cpp
+++ b/src/win32/cairo-dwrite-font.cpp
@@ -738,28 +738,14 @@ public:
 	return;
     }
 
-    cairo_fixed_t GetFixedX(const D2D1_POINT_2F &point)
-    {
-	unsigned int control_word;
-	_controlfp_s(&control_word, _CW_DEFAULT, MCW_PC);
-	return _cairo_fixed_from_double(point.x);
-    }
-
-    cairo_fixed_t GetFixedY(const D2D1_POINT_2F &point)
-    {
-	unsigned int control_word;
-	_controlfp_s(&control_word, _CW_DEFAULT, MCW_PC);
-	return _cairo_fixed_from_double(point.y);
-    }
-
     IFACEMETHODIMP_(void) BeginFigure(
 	D2D1_POINT_2F startPoint,
 	D2D1_FIGURE_BEGIN figureBegin)
     {
 	mStartPoint = startPoint;
 	cairo_status_t status = _cairo_path_fixed_move_to(mCairoPath,
-							  GetFixedX(startPoint),
-							  GetFixedY(startPoint));
+							  _cairo_fixed_from_double(startPoint.x),
+							  _cairo_fixed_from_double(startPoint.y));
 	(void)status; /* squelch warning */
     }
 
@@ -768,8 +754,8 @@ public:
     {
 	if (figureEnd == D2D1_FIGURE_END_CLOSED) {
 	    cairo_status_t status = _cairo_path_fixed_line_to(mCairoPath,
-							      GetFixedX(mStartPoint),
-							      GetFixedY(mStartPoint));
+							      _cairo_fixed_from_double(mStartPoint.x),
+							      _cairo_fixed_from_double(mStartPoint.y));
 	    (void)status; /* squelch warning */
 	}
     }
@@ -780,12 +766,12 @@ public:
     {
 	for (unsigned int i = 0; i < beziersCount; i++) {
 	    cairo_status_t status = _cairo_path_fixed_curve_to(mCairoPath,
-							       GetFixedX(beziers[i].point1),
-							       GetFixedY(beziers[i].point1),
-							       GetFixedX(beziers[i].point2),
-							       GetFixedY(beziers[i].point2),
-							       GetFixedX(beziers[i].point3),
-							       GetFixedY(beziers[i].point3));
+							       _cairo_fixed_from_double(beziers[i].point1.x),
+							       _cairo_fixed_from_double(beziers[i].point1.y),
+							       _cairo_fixed_from_double(beziers[i].point2.x),
+							       _cairo_fixed_from_double(beziers[i].point2.y),
+							       _cairo_fixed_from_double(beziers[i].point3.x),
+							       _cairo_fixed_from_double(beziers[i].point3.y));
 	    (void)status; /* squelch warning */
 	}
     }
@@ -796,8 +782,8 @@ public:
     {
 	for (unsigned int i = 0; i < pointsCount; i++) {
 	    cairo_status_t status = _cairo_path_fixed_line_to(mCairoPath,
-							      GetFixedX(points[i]),
-							      GetFixedY(points[i]));
+							      _cairo_fixed_from_double(points[i].x),
+							      _cairo_fixed_from_double(points[i].y));
 	    (void)status; /* squelch warning */
 	}
     }


More information about the cairo-commit mailing list