Drop gdi32-rotation patchset

This was "fixed" upstream. Though the current implementation is causing
multiple regressions with Rounded Rects.
This commit is contained in:
Alistair Leslie-Hughes 2024-10-15 09:22:28 +11:00
parent 858bf979a1
commit 683813d151
3 changed files with 0 additions and 232 deletions

View File

@ -1,119 +0,0 @@
From dc2aaa6a25ebccc30c7903fa68235d5971f8d6b8 Mon Sep 17 00:00:00 2001
From: Daniel Wendt <daniel.wendt@linux.com>
Date: Fri, 15 Nov 2013 12:52:37 +0100
Subject: [PATCH] gdi32: fix for rotated Arc, ArcTo, Chord and Pie drawing
problem
Wine-Bug: http://bugs.winehq.org/show_bug.cgi?id=34579
---
dlls/win32u/dibdrv/graphics.c | 80 +++++++++++++++++++++++++++++++++++
1 file changed, 80 insertions(+)
diff --git a/dlls/win32u/dibdrv/graphics.c b/dlls/win32u/dibdrv/graphics.c
index 410f29e8f19..3a6f8184009 100644
--- a/dlls/win32u/dibdrv/graphics.c
+++ b/dlls/win32u/dibdrv/graphics.c
@@ -310,6 +310,60 @@ static int get_arc_points( int arc_dir, const RECT *rect, POINT start, POINT end
return pos - count;
}
+/*
+ Check if matrix has uniform scale and shear and contains a rotation.
+*/
+static BOOL xform_has_rotate_and_uniform_scale_and_shear( const XFORM *xform )
+{
+ return xform->eM21 != 0 && xform->eM11 == xform->eM22 && -xform->eM21 == xform->eM12;
+}
+
+/*
+ Decompose rotation and translation from matrix xform.
+
+ If parameter rotation_and_translation is != NULL, save rotation and translation into it.
+
+ Note: The current implementation only works on matrixes with uniform scale and shear,
+ which has to be checked by a call to xform_has_rotate_and_uniform_scale_and_shear().
+ Hints how to get unique values for non-uniform matrixes are welcome.
+*/
+static BOOL xform_decompose_rotation_and_translation( XFORM *xform, XFORM *rotation_and_translation )
+{
+ XFORM inverse_matrix_scale;
+ XFORM origin_matrix = *xform;
+ double determinant = 0;
+
+ /* xform = xfrom-transposed * xform */
+ xform->eM11 = sqrt( xform->eM11 * xform->eM11 + xform->eM21 * xform->eM21 );
+ xform->eM22 = sqrt( xform->eM12 * xform->eM12 + xform->eM22 * xform->eM22 );
+ xform->eM12 = 0;
+ xform->eM21 = 0;
+ xform->eDx = 0;
+ xform->eDy = 0;
+
+ if ( rotation_and_translation == NULL )
+ return TRUE;
+
+ if ( xform->eM11 == 0 || xform->eM22 == 0 )
+ return FALSE;
+
+ determinant = xform->eM11 * xform->eM22;
+
+ inverse_matrix_scale.eM11 = xform->eM22 / determinant;
+ inverse_matrix_scale.eM12 = 0;
+ inverse_matrix_scale.eM21 = 0;
+ inverse_matrix_scale.eM22 = xform->eM11 / determinant;
+
+ /* calculate the rotation matrix */
+ rotation_and_translation->eM11 = inverse_matrix_scale.eM11 * origin_matrix.eM11;
+ rotation_and_translation->eM12 = inverse_matrix_scale.eM11 * origin_matrix.eM12;
+ rotation_and_translation->eM21 = inverse_matrix_scale.eM22 * origin_matrix.eM12 * -1;
+ rotation_and_translation->eM22 = inverse_matrix_scale.eM22 * origin_matrix.eM22;
+ rotation_and_translation->eDx = origin_matrix.eDx;
+ rotation_and_translation->eDy = origin_matrix.eDy;
+ return TRUE;
+}
+
/* backend for arc functions; extra_lines is -1 for ArcTo, 0 for Arc, 1 for Chord, 2 for Pie */
static BOOL draw_arc( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
INT start_x, INT start_y, INT end_x, INT end_y, INT extra_lines )
@@ -322,6 +376,22 @@ static BOOL draw_arc( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
BOOL ret = TRUE;
HRGN outline = 0, interior = 0;
+ BOOL exclude_rotation = FALSE;
+ XFORM old;
+ XFORM rotation_and_translation;
+ if (dc->attr->graphics_mode == GM_ADVANCED)
+ {
+ XFORM xf;
+ NtGdiGetTransform( pdev->dev.hdc, 0x203, &old );
+ xf = old;
+ if (xform_has_rotate_and_uniform_scale_and_shear( &xf ) &&
+ xform_decompose_rotation_and_translation( &xf, &rotation_and_translation ))
+ {
+ NtGdiModifyWorldTransform( pdev->dev.hdc, &xf, MWT_SET );
+ exclude_rotation = TRUE;
+ }
+ }
+
if (!get_pen_device_rect( dc, pdev, &rect, left, top, right, bottom )) return TRUE;
width = rect.right - rect.left;
@@ -355,6 +425,16 @@ static BOOL draw_arc( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
points[count].y = rect.top + height / 2;
count++;
}
+
+ if (exclude_rotation == TRUE)
+ {
+ NtGdiModifyWorldTransform( pdev->dev.hdc, &rotation_and_translation, MWT_SET );
+ /* apply rotation and translation to calculated points */
+ NtGdiTransformPoints( dev->hdc, points, points, count, NtGdiLPtoDP );
+ /* restore origin matrix */
+ NtGdiModifyWorldTransform( pdev->dev.hdc, &old, MWT_SET );
+ }
+
if (count < 2)
{
free( points );
--
2.33.0

View File

@ -1,110 +0,0 @@
From fdc9d34400af31765d20ca7b070e53d7eec710e4 Mon Sep 17 00:00:00 2001
From: Daniel Wendt <daniel.wendt@linux.com>
Date: Tue, 10 Dec 2013 14:55:32 +0100
Subject: [PATCH] gdi32: fix for rotated ellipse
Bug: http://bugs.winehq.org/show_bug.cgi?id=35331
---
dlls/win32u/dibdrv/graphics.c | 63 ++++++++++++++++++++++++-----------
1 file changed, 44 insertions(+), 19 deletions(-)
diff --git a/dlls/win32u/dibdrv/graphics.c b/dlls/win32u/dibdrv/graphics.c
index 21d2eabbc9e..1eeea1d68ea 100644
--- a/dlls/win32u/dibdrv/graphics.c
+++ b/dlls/win32u/dibdrv/graphics.c
@@ -1531,10 +1531,28 @@ BOOL dibdrv_RoundRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
DC *dc = get_physdev_dc( dev );
RECT rect;
POINT pt[2], *points;
- int i, end, count;
+ int i, end;
+ ULONG count;
BOOL ret = TRUE;
HRGN outline = 0, interior = 0;
+ BOOL exclude_rotation_translation = FALSE;
+ XFORM old;
+ XFORM rotation_and_translation;
+
+ if (dc->attr->graphics_mode == GM_ADVANCED)
+ {
+ XFORM xf;
+ NtGdiGetTransform( pdev->dev.hdc, 0x203, &old );
+ xf = old;
+ if (xform_has_rotate_and_uniform_scale_and_shear( &xf ) &&
+ xform_decompose_rotation_and_translation( &xf, &rotation_and_translation ))
+ {
+ NtGdiModifyWorldTransform( pdev->dev.hdc, &xf, MWT_SET );
+ exclude_rotation_translation = TRUE;
+ }
+ }
+
if (!get_pen_device_rect( dc, pdev, &rect, left, top, right, bottom )) return TRUE;
pt[0].x = pt[0].y = 0;
@@ -1555,23 +1573,6 @@ BOOL dibdrv_RoundRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
return FALSE;
}
- if (pdev->brush.style != BS_NULL &&
- !(interior = NtGdiCreateRoundRectRgn( rect.left, rect.top, rect.right + 1, rect.bottom + 1,
- ellipse_width, ellipse_height )))
- {
- free( points );
- if (outline) NtGdiDeleteObjectApp( outline );
- return FALSE;
- }
-
- /* if not using a region, paint the interior first so the outline can overlap it */
- if (interior && !outline)
- {
- ret = brush_region( pdev, interior );
- NtGdiDeleteObjectApp( interior );
- interior = 0;
- }
-
count = ellipse_first_quadrant( ellipse_width, ellipse_height, points );
if (dc->attr->arc_direction == AD_CLOCKWISE)
@@ -1615,13 +1616,37 @@ BOOL dibdrv_RoundRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
}
count = end + 1;
+ if (exclude_rotation_translation == TRUE)
+ {
+ NtGdiModifyWorldTransform( pdev->dev.hdc, &rotation_and_translation, MWT_SET );
+ /* apply rotation and translation to calculated points */
+ NtGdiTransformPoints( dev->hdc, points, points, count, NtGdiLPtoDP );
+ /* restore origin matrix */
+ NtGdiModifyWorldTransform( pdev->dev.hdc, &old, MWT_SET );
+ }
+
+ if (pdev->brush.style != BS_NULL &&
+ !(interior = ULongToHandle(NtGdiPolyPolyDraw( ULongToHandle(ALTERNATE), points, &count, 1, NtGdiPolyPolygonRgn ))))
+ {
+ free( points );
+ if (outline) NtGdiDeleteObjectApp( outline );
+ return FALSE;
+ }
+
+ /* if not using a region, paint the interior first so the outline can overlap it */
+ if (interior && !outline)
+ {
+ ret = brush_region( pdev, interior );
+ NtGdiDeleteObjectApp( interior );
+ interior = 0;
+ }
+
reset_dash_origin( pdev );
pdev->pen_lines( pdev, count, points, TRUE, outline );
add_pen_lines_bounds( pdev, count, points, outline );
if (interior)
{
- NtGdiCombineRgn( interior, interior, outline, RGN_DIFF );
ret = brush_region( pdev, interior );
NtGdiDeleteObjectApp( interior );
}
--
2.43.0

View File

@ -1,3 +0,0 @@
Fixes: [34579] gdi32: fix for rotated Arc, ArcTo, Chord and Pie drawing problem
Fixes: [35331] gdi32: fix for rotated ellipse
Disabled: True