Skip to content

Commit 69decd3

Browse files
committed
fixed: Bitmap will be scaled if the x, y are float numbers
d2phap/ImageGlass#1786
1 parent e6d3e51 commit 69decd3

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

Source/DXControl/Graphics/D2DGraphics.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,17 @@ public void DrawBitmap(object? bitmap, RectangleF? destRect = null, RectangleF?
151151

152152
if (destRect != null)
153153
{
154-
destinationRect = new D2D_RECT_F(
155-
destRect.Value.Left,
156-
destRect.Value.Top,
157-
destRect.Value.Right,
158-
destRect.Value.Bottom);
154+
// Note: Bitmap will be scaled if the x, y are float numbers
155+
// https://github.com/d2phap/ImageGlass/issues/1786
156+
var left = (int)destRect.Value.Left;
157+
var top = (int)destRect.Value.Top;
158+
var right = left + destRect.Value.Width;
159+
var bottom = top + destRect.Value.Height;
160+
161+
destinationRect = new D2D_RECT_F(left, top, right, bottom);
159162
}
160163

164+
161165
DeviceContext.DrawBitmap(bmp, opacity, (D2D1_INTERPOLATION_MODE)interpolation, destinationRect, sourceRect);
162166
}
163167

0 commit comments

Comments
 (0)