diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2020-10-20 07:27:44 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-10-21 08:13:05 +0200 |
commit | 0fb58a1ff168ae122e9c8993a3136658e3b0e3f0 (patch) | |
tree | 908983b02f466e0a49599edc70aaa1baaa240371 /vcl/source/bitmap | |
parent | b84afd2188d6993c91081885dc24664bd3f1cc73 (diff) |
new tools::Degree10 strong typedef
partly to flush some use of "long" out the codebase,
but also to make it obvious which units are being used
for angle values.
Change-Id: I1dc22494ca42c4677a63f685d5903f2b89886dc2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104548
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/source/bitmap')
-rw-r--r-- | vcl/source/bitmap/bitmappaint.cxx | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/vcl/source/bitmap/bitmappaint.cxx b/vcl/source/bitmap/bitmappaint.cxx index ebc7e1288ef5..f9dff4ee0b26 100644 --- a/vcl/source/bitmap/bitmappaint.cxx +++ b/vcl/source/bitmap/bitmappaint.cxx @@ -209,16 +209,16 @@ bool Bitmap::Mirror(BmpMirrorFlags nMirrorFlags) return bRet; } -bool Bitmap::Rotate(tools::Long nAngle10, const Color& rFillColor) +bool Bitmap::Rotate(Degree10 nAngle10, const Color& rFillColor) { bool bRet = false; - nAngle10 %= 3600; - nAngle10 = (nAngle10 < 0) ? (3599L + nAngle10) : nAngle10; + nAngle10 %= Degree10(3600); + nAngle10 = (nAngle10 < Degree10(0)) ? (Degree10(3599) + nAngle10) : nAngle10; if (!nAngle10) bRet = true; - else if (nAngle10 == 1800) + else if (nAngle10 == Degree10(1800)) bRet = Mirror(BmpMirrorFlags::Horizontal | BmpMirrorFlags::Vertical); else { @@ -229,7 +229,7 @@ bool Bitmap::Rotate(tools::Long nAngle10, const Color& rFillColor) { const Size aSizePix(GetSizePixel()); - if (nAngle10 == 900 || nAngle10 == 2700) + if (nAngle10 == Degree10(900) || nAngle10 == Degree10(2700)) { const Size aNewSizePix(aSizePix.Height(), aSizePix.Width()); Bitmap aNewBmp(aNewSizePix, GetBitCount(), &pReadAcc->GetPalette()); @@ -244,7 +244,7 @@ bool Bitmap::Rotate(tools::Long nAngle10, const Color& rFillColor) const tools::Long nNewWidth = aNewSizePix.Width(); const tools::Long nNewHeight = aNewSizePix.Height(); - if (nAngle10 == 900) + if (nAngle10 == Degree10(900)) { for (tools::Long nY = 0, nOtherX = nWidth1; nY < nNewHeight; nY++, nOtherX--) @@ -257,7 +257,7 @@ bool Bitmap::Rotate(tools::Long nAngle10, const Color& rFillColor) } } } - else if (nAngle10 == 2700) + else if (nAngle10 == Degree10(2700)) { for (tools::Long nY = 0, nOtherX = 0; nY < nNewHeight; nY++, nOtherX++) { @@ -280,7 +280,7 @@ bool Bitmap::Rotate(tools::Long nAngle10, const Color& rFillColor) Point aTmpPoint; tools::Rectangle aTmpRectangle(aTmpPoint, aSizePix); tools::Polygon aPoly(aTmpRectangle); - aPoly.Rotate(aTmpPoint, static_cast<sal_uInt16>(nAngle10)); + aPoly.Rotate(aTmpPoint, nAngle10); tools::Rectangle aNewBound(aPoly.GetBoundRect()); const Size aNewSizePix(aNewBound.GetSize()); @@ -290,8 +290,8 @@ bool Bitmap::Rotate(tools::Long nAngle10, const Color& rFillColor) if (pWriteAcc) { const BitmapColor aFillColor(pWriteAcc->GetBestMatchingColor(rFillColor)); - const double fCosAngle = cos(nAngle10 * F_PI1800); - const double fSinAngle = sin(nAngle10 * F_PI1800); + const double fCosAngle = cos(nAngle10.get() * F_PI1800); + const double fSinAngle = sin(nAngle10.get() * F_PI1800); const double fXMin = aNewBound.Left(); const double fYMin = aNewBound.Top(); const tools::Long nWidth = aSizePix.Width(); |