diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-02-07 09:49:10 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-02-07 10:08:30 +0100 |
commit | e5012e53b919ae4921d6d35660bde323a6f28417 (patch) | |
tree | d0ed24f56e29f5d027e21404696fca441cdd0fc5 /vcl/source/bitmap/BitmapSymmetryCheck.cxx | |
parent | c99527385acf367c748b3dcf3e6a3bb8103f5eee (diff) |
use scanline when reading pixel data
extracts code from the innermost part of fairly hot loops
And add a GetIndexFromData method to make the call sites a little easier
to read.
Change-Id: I4ce5c5a687ecdb6982562a0aafce8513d86f9107
Reviewed-on: https://gerrit.libreoffice.org/49337
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/source/bitmap/BitmapSymmetryCheck.cxx')
-rw-r--r-- | vcl/source/bitmap/BitmapSymmetryCheck.cxx | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/vcl/source/bitmap/BitmapSymmetryCheck.cxx b/vcl/source/bitmap/BitmapSymmetryCheck.cxx index e5db09e463ca..9abb480864e2 100644 --- a/vcl/source/bitmap/BitmapSymmetryCheck.cxx +++ b/vcl/source/bitmap/BitmapSymmetryCheck.cxx @@ -35,17 +35,19 @@ bool BitmapSymmetryCheck::checkImpl(BitmapReadAccess const * pReadAccess) for (long y = 0; y < nHeightHalf; ++y) { + Scanline pScanlineRead = pReadAccess->GetScanline( y ); + Scanline pScanlineRead2 = pReadAccess->GetScanline( nHeight - y - 1 ); for (long x = 0; x < nWidthHalf; ++x) { - if (pReadAccess->GetPixel(y, x) != pReadAccess->GetPixel(nHeight - y - 1, x)) + if (pReadAccess->GetPixelFromData(pScanlineRead, x) != pReadAccess->GetPixelFromData(pScanlineRead2, x)) { return false; } - if (pReadAccess->GetPixel(y, x) != pReadAccess->GetPixel(y, nWidth - x - 1)) + if (pReadAccess->GetPixelFromData(pScanlineRead, x) != pReadAccess->GetPixelFromData(pScanlineRead, nWidth - x - 1)) { return false; } - if (pReadAccess->GetPixel(y, x) != pReadAccess->GetPixel(nHeight - y - 1, nWidth - x - 1)) + if (pReadAccess->GetPixelFromData(pScanlineRead, x) != pReadAccess->GetPixelFromData(pScanlineRead2, nWidth - x - 1)) { return false; } @@ -65,9 +67,10 @@ bool BitmapSymmetryCheck::checkImpl(BitmapReadAccess const * pReadAccess) if (bHeightEven) { + Scanline pScanlineRead = pReadAccess->GetScanline( nHeightHalf ); for (long x = 0; x < nWidthHalf; ++x) { - if (pReadAccess->GetPixel(nHeightHalf, x) != pReadAccess->GetPixel(nHeightHalf, nWidth - x - 1)) + if (pReadAccess->GetPixelFromData(pScanlineRead, x) != pReadAccess->GetPixelFromData(pScanlineRead, nWidth - x - 1)) { return false; } |