summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2024-09-01 03:53:23 +1000
committerTomaž Vajngerl <quikee@gmail.com>2024-09-13 11:15:11 +0200
commit0874f235e6779317ae215c438b6e642694b40af1 (patch)
tree7862a6e4be4ea1e445af1f85d30a63f48254a7d9 /vcl/source
parentdc451a30d4a42dcf7bc7f3a9b42721aa9d0dbd43 (diff)
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 <quikee@gmail.com>
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/bitmap/BitmapEmbossGreyFilter.cxx20
1 files changed, 11 insertions, 9 deletions
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;