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 | 35775912a5e5cce323187172b84653d43f070916 (patch) | |
| tree | 63372c033d091b87821133c2c327eef6944a9dc7 | |
| parent | 7c7f3f2dabae6a2d0da35480549db3a6c314f21b (diff) | |
| download | scintilla-mirror-35775912a5e5cce323187172b84653d43f070916.tar.gz | |
Use floor instead of casts when centring bitmaps inside the given rectangle.
| -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 ec215bb38..374ee9fd3 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -857,10 +857,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}, @@ -1472,10 +1472,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); |
