Zhiyi Zhang : uxtheme: Support TrueSizeStretchMark property.

Alexandre Julliard julliard at winehq.org
Tue Aug 24 15:56:10 CDT 2021


Module: wine
Branch: master
Commit: 4b2777db4badd882b630f4d9aa2ce00c3c05d726
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=4b2777db4badd882b630f4d9aa2ce00c3c05d726

Author: Zhiyi Zhang <zzhang at codeweavers.com>
Date:   Tue Aug 24 14:35:26 2021 +0800

uxtheme: Support TrueSizeStretchMark property.

Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/uxtheme/draw.c | 25 ++++++++++---------------
 1 file changed, 10 insertions(+), 15 deletions(-)

diff --git a/dlls/uxtheme/draw.c b/dlls/uxtheme/draw.c
index 866200f7fa8..5b90f6b1fdc 100644
--- a/dlls/uxtheme/draw.c
+++ b/dlls/uxtheme/draw.c
@@ -579,7 +579,7 @@ static HRESULT get_image_part_size (HTHEME hTheme, HDC hdc, int iPartId,
     {
         case TS_DRAW:
         {
-            int sizingType = ST_STRETCH, scalingType = TSST_NONE;
+            int sizingType = ST_STRETCH, scalingType = TSST_NONE, stretchMark = 0;
             POINT srcSize;
 
             srcSize.x = rcSrc.right - rcSrc.left;
@@ -589,10 +589,13 @@ static HRESULT get_image_part_size (HTHEME hTheme, HDC hdc, int iPartId,
             if (sizingType == ST_TRUESIZE)
             {
                 GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_TRUESIZESCALINGTYPE, &scalingType);
+                GetThemeInt(hTheme, iPartId, iStateId, TMT_TRUESIZESTRETCHMARK, &stretchMark);
                 if (scalingType == TSST_DPI)
                 {
+                    /* Scale to DPI only if the destination DPI exceeds the source DPI by
+                     * stretchMark percent */
                     dstDpi = GetDeviceCaps(hdc, LOGPIXELSY);
-                    if (dstDpi && dstDpi != imageDpi)
+                    if (dstDpi && dstDpi != imageDpi && MulDiv(100, dstDpi, imageDpi) >= stretchMark + 100)
                     {
                         srcSize.x = MulDiv(srcSize.x, dstDpi, imageDpi);
                         srcSize.y = MulDiv(srcSize.y, dstDpi, imageDpi);
@@ -620,19 +623,11 @@ static HRESULT get_image_part_size (HTHEME hTheme, HDC hdc, int iPartId,
 
                 if (sizingType == ST_TRUESIZE)
                 {
-                    int truesizestretchmark = 100;
-
-                    /* Whatever TrueSizeStretchMark does - it does not seem to
-                     * be what's outlined below. It appears as if native 
-                     * uxtheme always stretches if dest is smaller than source
-                     * (ie as if TrueSizeStretchMark==100 with the code below) */
-#if 0
-                    /* Only stretch when target exceeds source by truesizestretchmark percent */
-                    GetThemeInt(hTheme, iPartId, iStateId, TMT_TRUESIZESTRETCHMARK, &truesizestretchmark);
-#endif
-                    if (scalingType == TSST_SIZE || dstSize.x < 0 || dstSize.y < 0
-                        || (MulDiv(srcSize.x, 100, dstSize.x) > truesizestretchmark
-                            && MulDiv(srcSize.y, 100, dstSize.y) > truesizestretchmark))
+                    if ((dstSize.x < 0 || dstSize.y < 0)
+                        || (dstSize.x < srcSize.x && dstSize.y < srcSize.y)
+                        || (scalingType == TSST_SIZE
+                            && MulDiv(100, dstSize.x, srcSize.x) >= stretchMark + 100
+                            && MulDiv(100, dstSize.y, srcSize.y) >= stretchMark + 100))
                     {
                         *psz = dstSize;
                     }




More information about the wine-cvs mailing list