8000 Remove the unnecessary fields in DpiHelper · dotnet/wpf@06f7f4f · GitHub
[go: up one dir, main page]

Skip to content

Commit 06f7f4f

Browse files
committed
Remove the unnecessary fields in DpiHelper
1 parent c8742b5 commit 06f7f4f

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
@@ -13,21 +13,16 @@ namespace Standard
1313

1414
internal static class DpiHelper
1515
{
16-
[ThreadStatic]
17-
private static Matrix _transformToDevice;
18-
[ThreadStatic]
19-
private static Matrix _transformToDip;
20-
2116
/// <summary>
2217
/// Convert a point in device independent pixels (1/96") to a point in the system coordinates.
2318
/// </summary>
2419
/// <param name="logicalPoint">A point in the logical coordinate system.</param>
2520
/// <returns>Returns the parameter converted to the system's coordinates.</returns>
2621
public static Point LogicalPixelsToDevice(Point logicalPoint, double dpiScaleX, double dpiScaleY)
2722
{
28-
_transformToDevice = Matrix.Identity;
29-
_transformToDevice.Scale(dpiScaleX, dpiScaleY);
30-
return _transformToDevice.Transform(logicalPoint);
23+
Matrix transformToDevice = Matrix.Identity;
24+
transformToDevice.Scale(dpiScaleX, dpiScaleY);
25+
return transformToDevice.Transform(logicalPoint);
3126
}
3227

3328
/// <summary>
@@ -37,9 +32,9 @@ public static Point LogicalPixelsToDevice(Point logicalPoint, double dpiScaleX,
3732
/// <returns>Returns the parameter converted to the device independent coordinate system.</returns>
3833
public static Point DevicePixelsToLogical(Point devicePoint, double dpiScaleX, double dpiScaleY)
3934
{
40-
_transformToDip = Matrix.Identity;
41-
_transformToDip.Scale(1d / dpiScaleX, 1d / dpiScaleY);
42-
return _transformToDip.Transform(devicePoint);
35+
Matrix transformToDip = Matrix.Identity;
36+
transformToDip.Scale(1d / dpiScaleX, 1d / dpiScaleY);
37+
return transformToDip.Transform(devicePoint);
4338
}
4439

4540
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]

0 commit comments

Comments
 (0)
0