8000 Remove the unnecessary fields in DpiHelper (#6851) · dotnet/wpf@c572f8e · GitHub
[go: up one dir, main page]

Skip to content

Commit c572f8e

Browse files
authored
Remove the unnecessary fields in DpiHelper (#6851)
1 parent ac5efa2 commit c572f8e

File tree

1 file changed

+6
-11
lines changed
  • src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Standard

1 file changed

+6
-11
lines changed

src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Standard/DpiHelper.cs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,16 @@ namespace Standard
1010
{
1111
internal static class DpiHelper
1212
{
13-
[ThreadStatic]
14-
private static Matrix _transformToDevice;
15-
[ThreadStatic]
16-
private static Matrix _transformToDip;
17-
1813
/// <summary>
1914
/// Convert a point in device independent pixels (1/96") to a point in the system coordinates.
2015
/// </summary>
2116
/// <param name="logicalPoint">A point in the logical coordinate system.</param>
2217
/// <returns>Returns the parameter converted to the system's coordinates.</returns>
2318
public static Point LogicalPixelsToDevice(Point logicalPoint, double dpiScaleX, double dpiScaleY)
2419
{
25-
_transformToDevice = Matrix.Identity;
26-
_transformToDevice.Scale(dpiScaleX, dpiScaleY);
27-
return _transformToDevice.Transform(logicalPoint);
20+
Matrix transformToDevice = Matrix.Identity;
21+
transformToDevice.Scale(dpiScaleX, dpiScaleY);
22+
return transformToDevice.Transform(logicalPoint);
2823
}
2924

3025
/// <summary>
@@ -34,9 +29,9 @@ public static Point LogicalPixelsToDevice(Point logicalPoint, double dpiScaleX,
3429
/// <returns>Returns the parameter converted to the device independent coordinate system.</returns>
3530
public static Point DevicePixelsToLogical(Point devicePoint, double dpiScaleX, double dpiScaleY)
3631
{
37-
_transformToDip = Matrix.Identity;
38-
_transformToDip.Scale(1d / dpiScaleX, 1d / dpiScaleY);
39-
return _transformToDip.Transform(devicePoint);
32+
Matrix transformToDip = Matrix.Identity;
33+
transformToDip.Scale(1d / dpiScaleX, 1d / dpiScaleY);
34+
return transformToDip.Transform(devicePoint);
4035
}
4136

4237
public static Rect LogicalRectToDevice(Rect logicalRectangle, double dpiScaleX, double dpiScaleY)

0 commit comments

Comments
 (0)
0