summaryrefslogtreecommitdiff
path: root/emfio
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-02-07 09:49:10 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-02-07 10:08:30 +0100
commite5012e53b919ae4921d6d35660bde323a6f28417 (patch)
treed0ed24f56e29f5d027e21404696fca441cdd0fc5 /emfio
parentc99527385acf367c748b3dcf3e6a3bb8103f5eee (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 'emfio')
-rw-r--r--emfio/source/reader/mtftools.cxx21
1 files changed, 13 insertions, 8 deletions
diff --git a/emfio/source/reader/mtftools.cxx b/emfio/source/reader/mtftools.cxx
index 79f7efc90abd..efbfe52364f7 100644
--- a/emfio/source/reader/mtftools.cxx
+++ b/emfio/source/reader/mtftools.cxx
@@ -1666,17 +1666,22 @@ namespace emfio
const long nWidth(std::min(pR->Width(), pW->Width()));
const long nHeight(std::min(pR->Height(), pW->Height()));
- for(long nY(0); nY < nHeight; nY++) for(long nX(0); nX < nWidth; nX++)
+ for(long nY(0); nY < nHeight; nY++)
{
- const sal_uInt8 nIndR(pR->GetPixelIndex(nY, nX));
- const sal_uInt8 nIndW(pW->GetPixelIndex(nY, nX));
+ Scanline pScanlineR = pR->GetScanline( nY );
+ Scanline pScanlineW = pW->GetScanline( nY );
+ for(long nX(0); nX < nWidth; nX++)
+ {
+ const sal_uInt8 nIndR(pR->GetIndexFromData(pScanlineR, nX));
+ const sal_uInt8 nIndW(pW->GetIndexFromData(pScanlineW, nX));
- // these values represent transparency (0 == no, 255 == fully transparent),
- // so to blend these we have to multiply the inverse (opacity)
- // and re-invert the result to transparence
- const sal_uInt8 nCombined(0x00ff - (((0x00ff - nIndR) * (0x00ff - nIndW)) >> 8));
+ // these values represent transparency (0 == no, 255 == fully transparent),
+ // so to blend these we have to multiply the inverse (opacity)
+ // and re-invert the result to transparence
+ const sal_uInt8 nCombined(0x00ff - (((0x00ff - nIndR) * (0x00ff - nIndW)) >> 8));
- pW->SetPixelIndex(nY, nX, nCombined);
+ pW->SetPixelOnData(pScanlineW, nX, BitmapColor(nCombined));
+ }
}
}