vcl/source/bitmap/BitmapEmbossGreyFilter.cxx | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
New commits: commit 0874f235e6779317ae215c438b6e642694b40af1 Author: Chris Sherlock <[email protected]> AuthorDate: Sun Sep 1 03:53:23 2024 +1000 Commit: Tomaž Vajngerl <[email protected]> CommitDate: Fri Sep 13 11:15:11 2024 +0200 vcl: move variables closer to first usage in BitmapEmbossGreyFilter::execute() Change-Id: I711b82e2c86035aa1bfbb245c125be65277043f4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173198 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <[email protected]> diff --git a/vcl/source/bitmap/BitmapEmbossGreyFilter.cxx b/vcl/source/bitmap/BitmapEmbossGreyFilter.cxx index 3e7694968d1b..325badb4d16a 100644 --- a/vcl/source/bitmap/BitmapEmbossGreyFilter.cxx +++ b/vcl/source/bitmap/BitmapEmbossGreyFilter.cxx @@ -35,19 +35,10 @@ BitmapEx BitmapEmbossGreyFilter::execute(BitmapEx const& rBitmapEx) const if (!pWriteAcc) return BitmapEx(); - BitmapColor aGrey(sal_uInt8(0)); const sal_Int32 nWidth = pWriteAcc->Width(); const sal_Int32 nHeight = pWriteAcc->Height(); - const double fAzim = toRadians(mnAzimuthAngle); - const double fElev = toRadians(mnElevationAngle); std::vector<sal_Int32> pHMap(nWidth + 2); std::vector<sal_Int32> pVMap(nHeight + 2); - const double nLx = cos(fAzim) * cos(fElev) * 255.0; - const double nLy = sin(fAzim) * cos(fElev) * 255.0; - const double nLz = sin(fElev) * 255.0; - const double nNz = 6 * 255.0 / 4; - const double nNzLz = nNz * nLz; - const sal_uInt8 cLz = basegfx::fround<sal_uInt8>(nLz); // fill mapping tables pHMap[0] = 0; @@ -68,6 +59,15 @@ BitmapEx BitmapEmbossGreyFilter::execute(BitmapEx const& rBitmapEx) const pVMap[nHeight + 1] = nHeight - 1; + const double fAzim = toRadians(mnAzimuthAngle); + const double fElev = toRadians(mnElevationAngle); + const double nLx = cos(fAzim) * cos(fElev) * 255.0; + const double nLy = sin(fAzim) * cos(fElev) * 255.0; + const double nLz = sin(fElev) * 255.0; + const double nNz = 6 * 255.0 / 4; + const double nNzLz = nNz * nLz; + const sal_uInt8 cLz = basegfx::fround<sal_uInt8>(nLz); + for (sal_Int32 nY = 0; nY < nHeight; nY++) { sal_Int32 nGrey11 = pReadAcc->GetPixel(pVMap[nY], pHMap[0]).GetIndex(); @@ -81,6 +81,8 @@ BitmapEx BitmapEmbossGreyFilter::execute(BitmapEx const& rBitmapEx) const sal_Int32 nGrey33 = pReadAcc->GetPixel(pVMap[nY + 2], pHMap[2]).GetIndex(); Scanline pScanline = pWriteAcc->GetScanline(nY); + BitmapColor aGrey(sal_uInt8(0)); + for (sal_Int32 nX = 0; nX < nWidth; nX++) { const sal_Int32 nNx = nGrey11 + nGrey21 + nGrey31 - nGrey13 - nGrey23 - nGrey33;
