Kaydet (Commit) 947edda9 authored tarafından Caolán McNamara's avatar Caolán McNamara

m_aDevice may be null

Change-Id: Ibd4666bd185198e0702a498d5648f1e4d5580e11
üst 09f5922b
...@@ -111,7 +111,7 @@ void SvpSalGraphics::setDevice( basebmp::BitmapDeviceSharedPtr& rDevice ) ...@@ -111,7 +111,7 @@ void SvpSalGraphics::setDevice( basebmp::BitmapDeviceSharedPtr& rDevice )
ResetClipRegion(); ResetClipRegion();
// determine matching bitmap format for masks // determine matching bitmap format for masks
basebmp::Format nDeviceFmt = m_aDevice->getScanlineFormat(); basebmp::Format nDeviceFmt = m_aDevice ? m_aDevice->getScanlineFormat() : basebmp::FORMAT_EIGHT_BIT_GREY;
switch( nDeviceFmt ) switch( nDeviceFmt )
{ {
case basebmp::FORMAT_EIGHT_BIT_GREY: case basebmp::FORMAT_EIGHT_BIT_GREY:
...@@ -414,7 +414,7 @@ void SvpSalGraphics::drawLine( long nX1, long nY1, long nX2, long nY2 ) ...@@ -414,7 +414,7 @@ void SvpSalGraphics::drawLine( long nX1, long nY1, long nX2, long nY2 )
void SvpSalGraphics::drawRect( long nX, long nY, long nWidth, long nHeight ) void SvpSalGraphics::drawRect( long nX, long nY, long nWidth, long nHeight )
{ {
if( m_bUseLineColor || m_bUseFillColor ) if ((m_bUseLineColor || m_bUseFillColor) && m_aDevice)
{ {
basegfx::B2DPolygon aRect = basegfx::tools::createPolygonFromRect( basegfx::B2DRectangle( nX, nY, nX+nWidth, nY+nHeight ) ); basegfx::B2DPolygon aRect = basegfx::tools::createPolygonFromRect( basegfx::B2DRectangle( nX, nY, nX+nWidth, nY+nHeight ) );
ensureClip(); // FIXME: for ... ensureClip(); // FIXME: for ...
...@@ -431,7 +431,7 @@ void SvpSalGraphics::drawRect( long nX, long nY, long nWidth, long nHeight ) ...@@ -431,7 +431,7 @@ void SvpSalGraphics::drawRect( long nX, long nY, long nWidth, long nHeight )
void SvpSalGraphics::drawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAry ) void SvpSalGraphics::drawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAry )
{ {
if( m_bUseLineColor && nPoints ) if (m_bUseLineColor && nPoints && m_aDevice)
{ {
basegfx::B2DPolygon aPoly; basegfx::B2DPolygon aPoly;
aPoly.append( basegfx::B2DPoint( pPtAry->mnX, pPtAry->mnY ), nPoints ); aPoly.append( basegfx::B2DPoint( pPtAry->mnX, pPtAry->mnY ), nPoints );
...@@ -446,7 +446,7 @@ void SvpSalGraphics::drawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAry ) ...@@ -446,7 +446,7 @@ void SvpSalGraphics::drawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAry )
void SvpSalGraphics::drawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry ) void SvpSalGraphics::drawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry )
{ {
if( ( m_bUseLineColor || m_bUseFillColor ) && nPoints ) if ((m_bUseLineColor || m_bUseFillColor) && nPoints && m_aDevice)
{ {
basegfx::B2DPolygon aPoly; basegfx::B2DPolygon aPoly;
aPoly.append( basegfx::B2DPoint( pPtAry->mnX, pPtAry->mnY ), nPoints ); aPoly.append( basegfx::B2DPoint( pPtAry->mnX, pPtAry->mnY ), nPoints );
...@@ -471,7 +471,7 @@ void SvpSalGraphics::drawPolyPolygon( sal_uInt32 nPoly, ...@@ -471,7 +471,7 @@ void SvpSalGraphics::drawPolyPolygon( sal_uInt32 nPoly,
const sal_uInt32* pPointCounts, const sal_uInt32* pPointCounts,
PCONSTSALPOINT* pPtAry ) PCONSTSALPOINT* pPtAry )
{ {
if( ( m_bUseLineColor || m_bUseFillColor ) && nPoly ) if ((m_bUseLineColor || m_bUseFillColor) && nPoly && m_aDevice)
{ {
basegfx::B2DPolyPolygon aPolyPoly; basegfx::B2DPolyPolygon aPolyPoly;
for( sal_uInt32 nPolygon = 0; nPolygon < nPoly; nPolygon++ ) for( sal_uInt32 nPolygon = 0; nPolygon < nPoly; nPolygon++ )
...@@ -620,7 +620,7 @@ void SvpSalGraphics::drawBitmap( const SalTwoRect& rPosAry, ...@@ -620,7 +620,7 @@ void SvpSalGraphics::drawBitmap( const SalTwoRect& rPosAry,
rPosAry.mnDestX+rPosAry.mnDestWidth, rPosAry.mnDestX+rPosAry.mnDestWidth,
rPosAry.mnDestY+rPosAry.mnDestHeight ); rPosAry.mnDestY+rPosAry.mnDestHeight );
SvpSalGraphics::ClipUndoHandle aUndo( this ); SvpSalGraphics::ClipUndoHandle aUndo( this );
if( !isClippedSetup( aDestRect, aUndo ) ) if (!isClippedSetup(aDestRect, aUndo) && m_aDevice)
m_aDevice->drawMaskedBitmap( rSrc.getBitmap(), rSrcTrans.getBitmap(), m_aDevice->drawMaskedBitmap( rSrc.getBitmap(), rSrcTrans.getBitmap(),
aSrcRect, aDestRect, basebmp::DrawMode_PAINT, m_aClipMap ); aSrcRect, aDestRect, basebmp::DrawMode_PAINT, m_aClipMap );
dbgOut( m_aDevice ); dbgOut( m_aDevice );
...@@ -659,14 +659,15 @@ void SvpSalGraphics::drawMask( const SalTwoRect& rPosAry, ...@@ -659,14 +659,15 @@ void SvpSalGraphics::drawMask( const SalTwoRect& rPosAry,
SalBitmap* SvpSalGraphics::getBitmap( long nX, long nY, long nWidth, long nHeight ) SalBitmap* SvpSalGraphics::getBitmap( long nX, long nY, long nWidth, long nHeight )
{ {
basebmp::BitmapDeviceSharedPtr aCopy = basebmp::BitmapDeviceSharedPtr aCopy;
cloneBitmapDevice( basegfx::B2IVector( nWidth, nHeight ), if (m_aDevice)
m_aDevice ); aCopy = cloneBitmapDevice(basegfx::B2IVector(nWidth, nHeight),
m_aDevice);
basegfx::B2IBox aSrcRect( nX, nY, nX+nWidth, nY+nHeight ); basegfx::B2IBox aSrcRect( nX, nY, nX+nWidth, nY+nHeight );
basegfx::B2IBox aDestRect( 0, 0, nWidth, nHeight ); basegfx::B2IBox aDestRect( 0, 0, nWidth, nHeight );
SvpSalGraphics::ClipUndoHandle aUndo( this ); SvpSalGraphics::ClipUndoHandle aUndo( this );
if( !isClippedSetup( aDestRect, aUndo ) ) if (!isClippedSetup(aDestRect, aUndo) && aCopy)
aCopy->drawBitmap( m_aOrigDevice, aSrcRect, aDestRect, basebmp::DrawMode_PAINT ); aCopy->drawBitmap( m_aOrigDevice, aSrcRect, aDestRect, basebmp::DrawMode_PAINT );
SvpSalBitmap* pBitmap = new SvpSalBitmap(); SvpSalBitmap* pBitmap = new SvpSalBitmap();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment