diff options
author | Neil <nyamatongwe@gmail.com> | 2018-04-27 17:30:25 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2018-04-27 17:30:25 +1000 |
commit | 4f0df34e67c3595d9a630f05bc5ddf5a395ad6c7 (patch) | |
tree | 847104bf04854c1903c01df5910822f76acd7e74 | |
parent | 3ccb3ba030bf99e2eb88f9163e5571ff4a867849 (diff) | |
download | scintilla-mirror-4f0df34e67c3595d9a630f05bc5ddf5a395ad6c7.tar.gz |
Backport: Use floor instead of casts when centring bitmaps inside the given rectangle.
Backport of changeset 6751:23a8e12e4b3d.
-rw-r--r-- | win32/PlatWin.cxx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 07759abf2..0d5cbdacf 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -858,10 +858,10 @@ void SurfaceGDI::DrawRGBAImage(PRectangle rc, int width, int height, const unsig if (rc.Width() > 0) { HDC hMemDC = ::CreateCompatibleDC(hdc); if (rc.Width() > width) - rc.left += static_cast<int>((rc.Width() - width) / 2); + rc.left += floor((rc.Width() - width) / 2); rc.right = rc.left + width; if (rc.Height() > height) - rc.top += static_cast<int>((rc.Height() - height) / 2); + rc.top += floor((rc.Height() - height) / 2); rc.bottom = rc.top + height; const BITMAPINFO bpih = {{sizeof(BITMAPINFOHEADER), width, height, 1, 32, BI_RGB, 0, 0, 0, 0, 0}, @@ -1473,10 +1473,10 @@ void SurfaceD2D::AlphaRectangle(PRectangle rc, int cornerSize, ColourDesired fil void SurfaceD2D::DrawRGBAImage(PRectangle rc, int width, int height, const unsigned char *pixelsImage) { if (pRenderTarget) { if (rc.Width() > width) - rc.left += static_cast<int>((rc.Width() - width) / 2); + rc.left += floor((rc.Width() - width) / 2); rc.right = rc.left + width; if (rc.Height() > height) - rc.top += static_cast<int>((rc.Height() - height) / 2); + rc.top += floor((rc.Height() - height) / 2); rc.bottom = rc.top + height; std::vector<unsigned char> image(height * width * 4); |