summaryrefslogtreecommitdiff
path: root/vcl/source/gdi
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-10-10 10:22:31 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-10-10 12:50:19 +0100
commit03327cbd668eeb9ef4cf1ede66c3f27e7303c122 (patch)
treee97b92b4a06017b13eaf33ab2d4d9a8b7c6029a9 /vcl/source/gdi
parent04301686969bc244dd21a4d41906617e2e95b47e (diff)
coverity#1242439 ALPHABITS == nAlphaShift == 8
Change-Id: Ifde395113524df03a2523115ab2234403d405455
Diffstat (limited to 'vcl/source/gdi')
-rw-r--r--vcl/source/gdi/bmpfast.cxx15
1 files changed, 6 insertions, 9 deletions
diff --git a/vcl/source/gdi/bmpfast.cxx b/vcl/source/gdi/bmpfast.cxx
index 84004bfd16c3..1764dc65c355 100644
--- a/vcl/source/gdi/bmpfast.cxx
+++ b/vcl/source/gdi/bmpfast.cxx
@@ -267,18 +267,15 @@ inline void ImplConvertLine( const TrueColorPixelPtr<DSTFMT>& rDst,
}
// alpha blending truecolor pixels
-template <unsigned ALPHABITS, sal_uLong SRCFMT, sal_uLong DSTFMT>
+template <sal_uLong SRCFMT, sal_uLong DSTFMT>
inline void ImplBlendPixels( const TrueColorPixelPtr<DSTFMT>& rDst,
const TrueColorPixelPtr<SRCFMT>& rSrc, unsigned nAlphaVal )
{
+ static const unsigned nAlphaShift = 8;
if( !nAlphaVal )
ImplConvertPixel( rDst, rSrc );
- else if( nAlphaVal != ~(~0U << ALPHABITS) )
+ else if( nAlphaVal != ~(~0U << nAlphaShift) )
{
- static const unsigned nAlphaShift = (ALPHABITS > 8) ? 8 : ALPHABITS;
- if( ALPHABITS > nAlphaShift )
- nAlphaVal >>= ALPHABITS - nAlphaShift;
-
int nR = rDst.GetRed();
int nS = rSrc.GetRed();
nR = nS + (((nR - nS) * nAlphaVal) >> nAlphaShift);
@@ -297,7 +294,7 @@ inline void ImplBlendPixels( const TrueColorPixelPtr<DSTFMT>& rDst,
}
}
-template <unsigned ALPHABITS, sal_uLong MASKFMT, sal_uLong SRCFMT, sal_uLong DSTFMT>
+template <sal_uLong MASKFMT, sal_uLong SRCFMT, sal_uLong DSTFMT>
inline void ImplBlendLines( const TrueColorPixelPtr<DSTFMT>& rDst,
const TrueColorPixelPtr<SRCFMT>& rSrc, const TrueColorPixelPtr<MASKFMT>& rMsk,
int nPixelCount )
@@ -307,7 +304,7 @@ inline void ImplBlendLines( const TrueColorPixelPtr<DSTFMT>& rDst,
TrueColorPixelPtr<SRCFMT> aSrc( rSrc );
while( --nPixelCount >= 0 )
{
- ImplBlendPixels<ALPHABITS>( aDst, aSrc, aMsk.GetAlpha() );
+ ImplBlendPixels(aDst, aSrc, aMsk.GetAlpha());
++aDst;
++aSrc;
++aMsk;
@@ -576,7 +573,7 @@ bool ImplBlendToBitmap( TrueColorPixelPtr<SRCFMT>& rSrcLine,
assert(rDstBuffer.mnHeight <= rSrcBuffer.mnHeight && "not sure about that?");
for (int y = rDstBuffer.mnHeight; --y >= 0;)
{
- ImplBlendLines<8>( aDstLine, rSrcLine, aMskLine, rDstBuffer.mnWidth );
+ ImplBlendLines(aDstLine, rSrcLine, aMskLine, rDstBuffer.mnWidth);
aDstLine.AddByteOffset( nDstLinestep );
rSrcLine.AddByteOffset( nSrcLinestep );
aMskLine.AddByteOffset( nMskLinestep );