From 683813d151ecef69835c2bbf3ac97bd1eefb86b2 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Tue, 15 Oct 2024 09:22:28 +1100 Subject: [PATCH] Drop gdi32-rotation patchset This was "fixed" upstream. Though the current implementation is causing multiple regressions with Rounded Rects. --- ...tated-Arc-ArcTo-Chord-and-Pie-drawin.patch | 119 ------------------ .../0002-gdi32-fix-for-rotated-ellipse.patch | 110 ---------------- patches/gdi32-rotation/definition | 3 - 3 files changed, 232 deletions(-) delete mode 100644 patches/gdi32-rotation/0001-gdi32-fix-for-rotated-Arc-ArcTo-Chord-and-Pie-drawin.patch delete mode 100644 patches/gdi32-rotation/0002-gdi32-fix-for-rotated-ellipse.patch delete mode 100644 patches/gdi32-rotation/definition diff --git a/patches/gdi32-rotation/0001-gdi32-fix-for-rotated-Arc-ArcTo-Chord-and-Pie-drawin.patch b/patches/gdi32-rotation/0001-gdi32-fix-for-rotated-Arc-ArcTo-Chord-and-Pie-drawin.patch deleted file mode 100644 index ffeba63a..00000000 --- a/patches/gdi32-rotation/0001-gdi32-fix-for-rotated-Arc-ArcTo-Chord-and-Pie-drawin.patch +++ /dev/null @@ -1,119 +0,0 @@ -From dc2aaa6a25ebccc30c7903fa68235d5971f8d6b8 Mon Sep 17 00:00:00 2001 -From: Daniel Wendt -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 - diff --git a/patches/gdi32-rotation/0002-gdi32-fix-for-rotated-ellipse.patch b/patches/gdi32-rotation/0002-gdi32-fix-for-rotated-ellipse.patch deleted file mode 100644 index bc6891f4..00000000 --- a/patches/gdi32-rotation/0002-gdi32-fix-for-rotated-ellipse.patch +++ /dev/null @@ -1,110 +0,0 @@ -From fdc9d34400af31765d20ca7b070e53d7eec710e4 Mon Sep 17 00:00:00 2001 -From: Daniel Wendt -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 - diff --git a/patches/gdi32-rotation/definition b/patches/gdi32-rotation/definition deleted file mode 100644 index 0fb42627..00000000 --- a/patches/gdi32-rotation/definition +++ /dev/null @@ -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