Kaydet (Commit) 43e961e4 authored tarafından Michael Meeks's avatar Michael Meeks Kaydeden (comit) Michael Meeks

headless: clip more intelligently without allocating huge masks constantly

üst 40552039
...@@ -41,7 +41,6 @@ class SvpSalGraphics : public SalGraphics ...@@ -41,7 +41,6 @@ class SvpSalGraphics : public SalGraphics
{ {
basebmp::BitmapDeviceSharedPtr m_aDevice; basebmp::BitmapDeviceSharedPtr m_aDevice;
basebmp::BitmapDeviceSharedPtr m_aOrigDevice; basebmp::BitmapDeviceSharedPtr m_aOrigDevice;
basebmp::BitmapDeviceSharedPtr m_aClipMap;
bool m_bUseLineColor; bool m_bUseLineColor;
basebmp::Color m_aLineColor; basebmp::Color m_aLineColor;
...@@ -54,6 +53,22 @@ class SvpSalGraphics : public SalGraphics ...@@ -54,6 +53,22 @@ class SvpSalGraphics : public SalGraphics
ServerFont* m_pServerFont[ MAX_FALLBACK ]; ServerFont* m_pServerFont[ MAX_FALLBACK ];
sal_uInt32 m_eTextFmt; sal_uInt32 m_eTextFmt;
basebmp::BitmapDeviceSharedPtr m_aClipMap;
protected:
Region m_aClipRegion;
basegfx::B2IVector GetSize() { return m_aOrigDevice->getSize(); }
private:
bool m_bClipSetup;
struct ClipUndoHandle {
SvpSalGraphics &m_rGfx;
basebmp::BitmapDeviceSharedPtr m_aDevice;
ClipUndoHandle( SvpSalGraphics *pGfx ) : m_rGfx( *pGfx ) {}
~ClipUndoHandle();
};
ClipUndoHandle ensureClipFor( const basegfx::B2IRange &aRange );
void ensureClip();
protected: protected:
virtual bool drawAlphaBitmap( const SalTwoRect&, const SalBitmap& rSourceBitmap, const SalBitmap& rAlphaBitmap ); virtual bool drawAlphaBitmap( const SalTwoRect&, const SalBitmap& rSourceBitmap, const SalBitmap& rAlphaBitmap );
virtual bool drawAlphaRect( long nX, long nY, long nWidth, long nHeight, sal_uInt8 nTransparency ); virtual bool drawAlphaRect( long nX, long nY, long nWidth, long nHeight, sal_uInt8 nTransparency );
...@@ -76,8 +91,7 @@ public: ...@@ -76,8 +91,7 @@ public:
virtual void SetLineColor(); virtual void SetLineColor();
virtual void SetLineColor( SalColor nSalColor ); virtual void SetLineColor( SalColor nSalColor );
virtual void SetFillColor(); virtual void SetFillColor();
virtual void SetFillColor( SalColor nSalColor );
virtual void SetFillColor( SalColor nSalColor );
virtual void SetXORMode( bool bSet, bool ); virtual void SetXORMode( bool bSet, bool );
......
...@@ -94,7 +94,8 @@ SvpSalGraphics::SvpSalGraphics() : ...@@ -94,7 +94,8 @@ SvpSalGraphics::SvpSalGraphics() :
m_aFillColor( COL_WHITE ), m_aFillColor( COL_WHITE ),
m_aTextColor( COL_BLACK ), m_aTextColor( COL_BLACK ),
m_aDrawMode( DrawMode_PAINT ), m_aDrawMode( DrawMode_PAINT ),
m_eTextFmt( Format::EIGHT_BIT_GREY ) m_eTextFmt( Format::EIGHT_BIT_GREY ),
m_bClipSetup( false )
{ {
for( int i = 0; i < MAX_FALLBACK; ++i ) for( int i = 0; i < MAX_FALLBACK; ++i )
m_pServerFont[i] = NULL; m_pServerFont[i] = NULL;
...@@ -106,9 +107,8 @@ SvpSalGraphics::~SvpSalGraphics() ...@@ -106,9 +107,8 @@ SvpSalGraphics::~SvpSalGraphics()
void SvpSalGraphics::setDevice( BitmapDeviceSharedPtr& rDevice ) void SvpSalGraphics::setDevice( BitmapDeviceSharedPtr& rDevice )
{ {
m_aDevice = rDevice;
m_aOrigDevice = rDevice; m_aOrigDevice = rDevice;
m_aClipMap.reset(); ResetClipRegion();
// determine matching bitmap format for masks // determine matching bitmap format for masks
sal_uInt32 nDeviceFmt = m_aDevice->getScanlineFormat(); sal_uInt32 nDeviceFmt = m_aDevice->getScanlineFormat();
...@@ -142,7 +142,7 @@ long SvpSalGraphics::GetGraphicsWidth() const ...@@ -142,7 +142,7 @@ long SvpSalGraphics::GetGraphicsWidth() const
{ {
if( m_aDevice.get() ) if( m_aDevice.get() )
{ {
B2IVector aSize = m_aDevice->getSize(); B2IVector aSize = m_aOrigDevice->getSize();
return aSize.getX(); return aSize.getX();
} }
return 0; return 0;
...@@ -152,40 +152,137 @@ void SvpSalGraphics::ResetClipRegion() ...@@ -152,40 +152,137 @@ void SvpSalGraphics::ResetClipRegion()
{ {
m_aDevice = m_aOrigDevice; m_aDevice = m_aOrigDevice;
m_aClipMap.reset(); m_aClipMap.reset();
m_bClipSetup = true;
m_aClipRegion.SetNull();
}
// verify clip for the whole area is setup
void SvpSalGraphics::ensureClip()
{
if (m_bClipSetup)
return;
m_aDevice = m_aOrigDevice;
B2IVector aSize = m_aDevice->getSize();
m_aClipMap = createBitmapDevice( aSize, false, Format::ONE_BIT_MSB_GREY );
m_aClipMap->clear( basebmp::Color(0xFFFFFFFF) );
// fprintf( stderr, "non rect clip region set with %d rects:\n",
// (int)m_aClipRegion.GetRectCount() );
ImplRegionInfo aInfo;
long nX, nY, nW, nH;
bool bRegionRect = m_aClipRegion.ImplGetFirstRect(aInfo, nX, nY, nW, nH );
while( bRegionRect )
{
if ( nW && nH )
{
B2DPolyPolygon aFull;
aFull.append( tools::createPolygonFromRect( B2DRectangle( nX, nY, nX+nW, nY+nH ) ) );
m_aClipMap->fillPolyPolygon( aFull, basebmp::Color(0), DrawMode_PAINT );
}
// fprintf( stderr, "\t %ld,%ld %ldx%ld\n", nX, nY, nW, nH );
bRegionRect = m_aClipRegion.ImplGetNextRect( aInfo, nX, nY, nW, nH );
}
m_bClipSetup = true;
}
SvpSalGraphics::ClipUndoHandle::~ClipUndoHandle()
{
if( m_aDevice.get() )
m_rGfx.m_aDevice = m_aDevice;
}
// setup a clip rectangle -only- iff we have to; if aRange
// is entirely contained inside an existing clip frame, we
// will avoid setting up the clip bitmap.
SvpSalGraphics::ClipUndoHandle SvpSalGraphics::ensureClipFor( const basegfx::B2IRange &aRange )
{
ClipUndoHandle aRet(this);
if (m_bClipSetup)
return aRet;
// fprintf( stderr, "ensureClipFor: %d, %d %dx%d\n",
// aRange.getMinX(), aRange.getMinY(),
// (int)aRange.getWidth(), (int)aRange.getHeight() );
// first see if aRange is purely internal to one of the clip regions
Rectangle aRect( Point( aRange.getMinX(), aRange.getMinY() ),
Size( aRange.getWidth(), aRange.getHeight() ) );
// then see if we are overlapping with just one
int nHit = 0;
Rectangle aIterRect, aHitRect;
RegionHandle aHnd = m_aClipRegion.BeginEnumRects();
while( m_aClipRegion.GetNextEnumRect( aHnd, aIterRect ) )
{
if( aIterRect.IsOver( aRect ) )
{
aHitRect = aIterRect;
nHit++;
}
}
m_aClipRegion.EndEnumRects (aHnd);
if( nHit == 0 )
{
// degenerate case - we're all clipped ... hmm.
fprintf (stderr, "FIXME: denegerate case detected ...\n");
}
else if( nHit == 1 )
{
if( aIterRect.IsInside( aRect ) )
{
// fprintf (stderr, " is inside ! avoid deeper clip ...\n");
return aRet;
}
// fprintf (stderr, " operation only overlaps with a single clip zone\n" );
aRet.m_aDevice = m_aDevice;
m_aDevice = basebmp::subsetBitmapDevice( m_aOrigDevice,
basegfx::B2IRange (aHitRect.Left(),
aHitRect.Top(),
aHitRect.Right(),
aHitRect.Bottom()) );
return aRet;
}
// else
// fprintf (stderr, "URK: complex & slow clipping case\n" );
ensureClip();
return aRet;
} }
// Clipping by creating unconditional mask bitmaps is horribly
// slow so defer it, as much as possible. It is common to get
// 3 rectangles pushed, and have to create a vast off-screen
// mask only to destroy it shortly afterwards. That is
// particularly galling if we render only to a small,
// well defined rectangular area inside one of these clip
// rectangles.
//
// ensureClipFor() or ensureClip() need to be called before
// real rendering. FIXME: we should prolly push this down to
// bitmapdevice instead.
bool SvpSalGraphics::setClipRegion( const Region& i_rClip ) bool SvpSalGraphics::setClipRegion( const Region& i_rClip )
{ {
m_aClipRegion = i_rClip;
if( i_rClip.IsEmpty() ) if( i_rClip.IsEmpty() )
{
m_aClipMap.reset(); m_aClipMap.reset();
m_bClipSetup = true;
}
else if( i_rClip.GetRectCount() == 1 ) else if( i_rClip.GetRectCount() == 1 )
{ {
m_aClipMap.reset(); m_aClipMap.reset();
Rectangle aBoundRect( i_rClip.GetBoundRect() ); Rectangle aBoundRect( i_rClip.GetBoundRect() );
m_aDevice = basebmp::subsetBitmapDevice( m_aOrigDevice, m_aDevice = basebmp::subsetBitmapDevice( m_aOrigDevice,
basegfx::B2IRange(aBoundRect.Left(),aBoundRect.Top(),aBoundRect.Right(),aBoundRect.Bottom()) ); basegfx::B2IRange(aBoundRect.Left(),aBoundRect.Top(),aBoundRect.Right(),aBoundRect.Bottom()) );
m_bClipSetup = true;
} }
else else
{ m_bClipSetup = false;
m_aDevice = m_aOrigDevice;
B2IVector aSize = m_aDevice->getSize();
m_aClipMap = createBitmapDevice( aSize, false, Format::ONE_BIT_MSB_GREY );
m_aClipMap->clear( basebmp::Color(0xFFFFFFFF) );
ImplRegionInfo aInfo;
long nX, nY, nW, nH;
bool bRegionRect = i_rClip.ImplGetFirstRect(aInfo, nX, nY, nW, nH );
while( bRegionRect )
{
if ( nW && nH )
{
B2DPolyPolygon aFull;
aFull.append( tools::createPolygonFromRect( B2DRectangle( nX, nY, nX+nW, nY+nH ) ) );
m_aClipMap->fillPolyPolygon( aFull, basebmp::Color(0), DrawMode_PAINT );
}
bRegionRect = i_rClip.ImplGetNextRect( aInfo, nX, nY, nW, nH );
}
}
return true; return true;
} }
...@@ -258,17 +355,21 @@ void SvpSalGraphics::SetTextColor( SalColor nSalColor ) ...@@ -258,17 +355,21 @@ void SvpSalGraphics::SetTextColor( SalColor nSalColor )
void SvpSalGraphics::drawPixel( long nX, long nY ) void SvpSalGraphics::drawPixel( long nX, long nY )
{ {
if( m_bUseLineColor ) if( m_bUseLineColor )
{
ensureClip();
m_aDevice->setPixel( B2IPoint( nX, nY ), m_aDevice->setPixel( B2IPoint( nX, nY ),
m_aLineColor, m_aLineColor,
m_aDrawMode, m_aDrawMode,
m_aClipMap m_aClipMap
); );
}
dbgOut( m_aDevice ); dbgOut( m_aDevice );
} }
void SvpSalGraphics::drawPixel( long nX, long nY, SalColor nSalColor ) void SvpSalGraphics::drawPixel( long nX, long nY, SalColor nSalColor )
{ {
basebmp::Color aColor( nSalColor ); basebmp::Color aColor( nSalColor );
ensureClip();
m_aDevice->setPixel( B2IPoint( nX, nY ), m_aDevice->setPixel( B2IPoint( nX, nY ),
aColor, aColor,
m_aDrawMode, m_aDrawMode,
...@@ -280,11 +381,14 @@ void SvpSalGraphics::drawPixel( long nX, long nY, SalColor nSalColor ) ...@@ -280,11 +381,14 @@ void SvpSalGraphics::drawPixel( long nX, long nY, SalColor nSalColor )
void SvpSalGraphics::drawLine( long nX1, long nY1, long nX2, long nY2 ) void SvpSalGraphics::drawLine( long nX1, long nY1, long nX2, long nY2 )
{ {
if( m_bUseLineColor ) if( m_bUseLineColor )
{
ensureClip(); // FIXME: for ...
m_aDevice->drawLine( B2IPoint( nX1, nY1 ), m_aDevice->drawLine( B2IPoint( nX1, nY1 ),
B2IPoint( nX2, nY2 ), B2IPoint( nX2, nY2 ),
m_aLineColor, m_aLineColor,
m_aDrawMode, m_aDrawMode,
m_aClipMap ); m_aClipMap );
}
dbgOut( m_aDevice ); dbgOut( m_aDevice );
} }
...@@ -293,6 +397,7 @@ void SvpSalGraphics::drawRect( long nX, long nY, long nWidth, long nHeight ) ...@@ -293,6 +397,7 @@ void SvpSalGraphics::drawRect( long nX, long nY, long nWidth, long nHeight )
if( m_bUseLineColor || m_bUseFillColor ) if( m_bUseLineColor || m_bUseFillColor )
{ {
B2DPolygon aRect = tools::createPolygonFromRect( B2DRectangle( nX, nY, nX+nWidth, nY+nHeight ) ); B2DPolygon aRect = tools::createPolygonFromRect( B2DRectangle( nX, nY, nX+nWidth, nY+nHeight ) );
ensureClip(); // FIXME: for ...
if( m_bUseFillColor ) if( m_bUseFillColor )
{ {
B2DPolyPolygon aPolyPoly( aRect ); B2DPolyPolygon aPolyPoly( aRect );
...@@ -313,6 +418,7 @@ void SvpSalGraphics::drawPolyLine( sal_uLong nPoints, const SalPoint* pPtAry ) ...@@ -313,6 +418,7 @@ void SvpSalGraphics::drawPolyLine( sal_uLong nPoints, const SalPoint* pPtAry )
for( sal_uLong i = 1; i < nPoints; i++ ) for( sal_uLong i = 1; i < nPoints; i++ )
aPoly.setB2DPoint( i, B2DPoint( pPtAry[i].mnX, pPtAry[i].mnY ) ); aPoly.setB2DPoint( i, B2DPoint( pPtAry[i].mnX, pPtAry[i].mnY ) );
aPoly.setClosed( false ); aPoly.setClosed( false );
ensureClip(); // FIXME: for ...
m_aDevice->drawPolygon( aPoly, m_aLineColor, m_aDrawMode, m_aClipMap ); m_aDevice->drawPolygon( aPoly, m_aLineColor, m_aDrawMode, m_aClipMap );
} }
dbgOut( m_aDevice ); dbgOut( m_aDevice );
...@@ -326,6 +432,7 @@ void SvpSalGraphics::drawPolygon( sal_uLong nPoints, const SalPoint* pPtAry ) ...@@ -326,6 +432,7 @@ void SvpSalGraphics::drawPolygon( sal_uLong nPoints, const SalPoint* pPtAry )
aPoly.append( B2DPoint( pPtAry->mnX, pPtAry->mnY ), nPoints ); aPoly.append( B2DPoint( pPtAry->mnX, pPtAry->mnY ), nPoints );
for( sal_uLong i = 1; i < nPoints; i++ ) for( sal_uLong i = 1; i < nPoints; i++ )
aPoly.setB2DPoint( i, B2DPoint( pPtAry[i].mnX, pPtAry[i].mnY ) ); aPoly.setB2DPoint( i, B2DPoint( pPtAry[i].mnX, pPtAry[i].mnY ) );
ensureClip(); // FIXME: for ...
if( m_bUseFillColor ) if( m_bUseFillColor )
{ {
aPoly.setClosed( true ); aPoly.setClosed( true );
...@@ -361,6 +468,7 @@ void SvpSalGraphics::drawPolyPolygon( sal_uInt32 nPoly, ...@@ -361,6 +468,7 @@ void SvpSalGraphics::drawPolyPolygon( sal_uInt32 nPoly,
aPolyPoly.append( aPoly ); aPolyPoly.append( aPoly );
} }
} }
ensureClip(); // FIXME: for ...
if( m_bUseFillColor ) if( m_bUseFillColor )
{ {
aPolyPoly.setClosed( true ); aPolyPoly.setClosed( true );
...@@ -421,6 +529,9 @@ void SvpSalGraphics::copyArea( long nDestX, ...@@ -421,6 +529,9 @@ void SvpSalGraphics::copyArea( long nDestX,
{ {
B2IRange aSrcRect( nSrcX, nSrcY, nSrcX+nSrcWidth, nSrcY+nSrcHeight ); B2IRange aSrcRect( nSrcX, nSrcY, nSrcX+nSrcWidth, nSrcY+nSrcHeight );
B2IRange aDestRect( nDestX, nDestY, nDestX+nSrcWidth, nDestY+nSrcHeight ); B2IRange aDestRect( nDestX, nDestY, nDestX+nSrcWidth, nDestY+nSrcHeight );
// fprintf( stderr, "copyArea %ld pixels - clip region %d\n",
// (long)(nSrcWidth * nSrcHeight), m_aClipMap.get() != NULL );
SvpSalGraphics::ClipUndoHandle aUndo = ensureClipFor( aDestRect );
m_aDevice->drawBitmap( m_aOrigDevice, aSrcRect, aDestRect, DrawMode_PAINT, m_aClipMap ); m_aDevice->drawBitmap( m_aOrigDevice, aSrcRect, aDestRect, DrawMode_PAINT, m_aClipMap );
dbgOut( m_aDevice ); dbgOut( m_aDevice );
} }
...@@ -436,6 +547,7 @@ void SvpSalGraphics::copyBits( const SalTwoRect* pPosAry, ...@@ -436,6 +547,7 @@ void SvpSalGraphics::copyBits( const SalTwoRect* pPosAry,
B2IRange aDestRect( pPosAry->mnDestX, pPosAry->mnDestY, B2IRange aDestRect( pPosAry->mnDestX, pPosAry->mnDestY,
pPosAry->mnDestX+pPosAry->mnDestWidth, pPosAry->mnDestX+pPosAry->mnDestWidth,
pPosAry->mnDestY+pPosAry->mnDestHeight ); pPosAry->mnDestY+pPosAry->mnDestHeight );
SvpSalGraphics::ClipUndoHandle aUndo = ensureClipFor( aDestRect );
m_aDevice->drawBitmap( pSrc->m_aOrigDevice, aSrcRect, aDestRect, DrawMode_PAINT, m_aClipMap ); m_aDevice->drawBitmap( pSrc->m_aOrigDevice, aSrcRect, aDestRect, DrawMode_PAINT, m_aClipMap );
dbgOut( m_aDevice ); dbgOut( m_aDevice );
} }
...@@ -450,6 +562,7 @@ void SvpSalGraphics::drawBitmap( const SalTwoRect* pPosAry, ...@@ -450,6 +562,7 @@ void SvpSalGraphics::drawBitmap( const SalTwoRect* pPosAry,
B2IRange aDestRect( pPosAry->mnDestX, pPosAry->mnDestY, B2IRange aDestRect( pPosAry->mnDestX, pPosAry->mnDestY,
pPosAry->mnDestX+pPosAry->mnDestWidth, pPosAry->mnDestX+pPosAry->mnDestWidth,
pPosAry->mnDestY+pPosAry->mnDestHeight ); pPosAry->mnDestY+pPosAry->mnDestHeight );
SvpSalGraphics::ClipUndoHandle aUndo = ensureClipFor( aDestRect );
m_aDevice->drawBitmap( rSrc.getBitmap(), aSrcRect, aDestRect, DrawMode_PAINT, m_aClipMap ); m_aDevice->drawBitmap( rSrc.getBitmap(), aSrcRect, aDestRect, DrawMode_PAINT, m_aClipMap );
dbgOut( m_aDevice ); dbgOut( m_aDevice );
} }
...@@ -473,6 +586,7 @@ void SvpSalGraphics::drawBitmap( const SalTwoRect* pPosAry, ...@@ -473,6 +586,7 @@ void SvpSalGraphics::drawBitmap( const SalTwoRect* pPosAry,
B2IRange aDestRect( pPosAry->mnDestX, pPosAry->mnDestY, B2IRange aDestRect( pPosAry->mnDestX, pPosAry->mnDestY,
pPosAry->mnDestX+pPosAry->mnDestWidth, pPosAry->mnDestX+pPosAry->mnDestWidth,
pPosAry->mnDestY+pPosAry->mnDestHeight ); pPosAry->mnDestY+pPosAry->mnDestHeight );
SvpSalGraphics::ClipUndoHandle aUndo = ensureClipFor( aDestRect );
m_aDevice->drawMaskedBitmap( rSrc.getBitmap(), rSrcTrans.getBitmap(), aSrcRect, aDestRect, DrawMode_PAINT, m_aClipMap ); m_aDevice->drawMaskedBitmap( rSrc.getBitmap(), rSrcTrans.getBitmap(), aSrcRect, aDestRect, DrawMode_PAINT, m_aClipMap );
dbgOut( m_aDevice ); dbgOut( m_aDevice );
} }
...@@ -500,6 +614,8 @@ void SvpSalGraphics::drawMask( const SalTwoRect* pPosAry, ...@@ -500,6 +614,8 @@ void SvpSalGraphics::drawMask( const SalTwoRect* pPosAry,
basebmp::Color aColor( nMaskColor ); basebmp::Color aColor( nMaskColor );
B2IRange aSrcRect2( 0, 0, pPosAry->mnSrcWidth, pPosAry->mnSrcHeight ); B2IRange aSrcRect2( 0, 0, pPosAry->mnSrcWidth, pPosAry->mnSrcHeight );
const B2IRange aClipRect( aDestPoint, B2ITuple( aSrcRect.getWidth(), aSrcRect.getHeight() ) );
SvpSalGraphics::ClipUndoHandle aUndo = ensureClipFor( aClipRect );
m_aDevice->drawMaskedColor( aColor, aCopy, aSrcRect, aDestPoint, m_aClipMap ); m_aDevice->drawMaskedColor( aColor, aCopy, aSrcRect, aDestPoint, m_aClipMap );
dbgOut( m_aDevice ); dbgOut( m_aDevice );
} }
...@@ -511,6 +627,7 @@ SalBitmap* SvpSalGraphics::getBitmap( long nX, long nY, long nWidth, long nHeigh ...@@ -511,6 +627,7 @@ SalBitmap* SvpSalGraphics::getBitmap( long nX, long nY, long nWidth, long nHeigh
m_aDevice ); m_aDevice );
B2IRange aSrcRect( nX, nY, nX+nWidth, nY+nHeight ); B2IRange aSrcRect( nX, nY, nX+nWidth, nY+nHeight );
B2IRange aDestRect( 0, 0, nWidth, nHeight ); B2IRange aDestRect( 0, 0, nWidth, nHeight );
SvpSalGraphics::ClipUndoHandle aUndo = ensureClipFor( aDestRect );
aCopy->drawBitmap( m_aOrigDevice, aSrcRect, aDestRect, DrawMode_PAINT ); aCopy->drawBitmap( m_aOrigDevice, aSrcRect, aDestRect, DrawMode_PAINT );
SvpSalBitmap* pBitmap = new SvpSalBitmap(); SvpSalBitmap* pBitmap = new SvpSalBitmap();
...@@ -520,7 +637,7 @@ SalBitmap* SvpSalGraphics::getBitmap( long nX, long nY, long nWidth, long nHeigh ...@@ -520,7 +637,7 @@ SalBitmap* SvpSalGraphics::getBitmap( long nX, long nY, long nWidth, long nHeigh
SalColor SvpSalGraphics::getPixel( long nX, long nY ) SalColor SvpSalGraphics::getPixel( long nX, long nY )
{ {
basebmp::Color aColor( m_aDevice->getPixel( B2IPoint( nX, nY ) ) ); basebmp::Color aColor( m_aOrigDevice->getPixel( B2IPoint( nX, nY ) ) );
return aColor.toInt32(); return aColor.toInt32();
} }
...@@ -529,6 +646,7 @@ void SvpSalGraphics::invert( long nX, long nY, long nWidth, long nHeight, SalInv ...@@ -529,6 +646,7 @@ void SvpSalGraphics::invert( long nX, long nY, long nWidth, long nHeight, SalInv
// FIXME: handle SAL_INVERT_50 and SAL_INVERT_TRACKFRAME // FIXME: handle SAL_INVERT_50 and SAL_INVERT_TRACKFRAME
B2DPolygon aRect = tools::createPolygonFromRect( B2DRectangle( nX, nY, nX+nWidth, nY+nHeight ) ); B2DPolygon aRect = tools::createPolygonFromRect( B2DRectangle( nX, nY, nX+nWidth, nY+nHeight ) );
B2DPolyPolygon aPolyPoly( aRect ); B2DPolyPolygon aPolyPoly( aRect );
ensureClip(); // FIXME for ...
m_aDevice->fillPolyPolygon( aPolyPoly, basebmp::Color( 0xffffff ), DrawMode_XOR, m_aClipMap ); m_aDevice->fillPolyPolygon( aPolyPoly, basebmp::Color( 0xffffff ), DrawMode_XOR, m_aClipMap );
dbgOut( m_aDevice ); dbgOut( m_aDevice );
} }
...@@ -541,6 +659,7 @@ void SvpSalGraphics::invert( sal_uLong nPoints, const SalPoint* pPtAry, SalInver ...@@ -541,6 +659,7 @@ void SvpSalGraphics::invert( sal_uLong nPoints, const SalPoint* pPtAry, SalInver
for( sal_uLong i = 1; i < nPoints; i++ ) for( sal_uLong i = 1; i < nPoints; i++ )
aPoly.setB2DPoint( i, B2DPoint( pPtAry[i].mnX, pPtAry[i].mnY ) ); aPoly.setB2DPoint( i, B2DPoint( pPtAry[i].mnX, pPtAry[i].mnY ) );
aPoly.setClosed( true ); aPoly.setClosed( true );
ensureClip(); // FIXME for ...
m_aDevice->fillPolyPolygon( B2DPolyPolygon(aPoly), basebmp::Color( 0xffffff ), DrawMode_XOR, m_aClipMap ); m_aDevice->fillPolyPolygon( B2DPolyPolygon(aPoly), basebmp::Color( 0xffffff ), DrawMode_XOR, m_aClipMap );
dbgOut( m_aDevice ); dbgOut( m_aDevice );
} }
......
...@@ -533,6 +533,8 @@ void SvpSalGraphics::DrawServerFontLayout( const ServerFontLayout& rSalLayout ) ...@@ -533,6 +533,8 @@ void SvpSalGraphics::DrawServerFontLayout( const ServerFontLayout& rSalLayout )
// blend text color into target using the glyph's mask // blend text color into target using the glyph's mask
const B2IRange aSrcRect( B2ITuple(0,0), aAlphaMask->getSize() ); const B2IRange aSrcRect( B2ITuple(0,0), aAlphaMask->getSize() );
const B2IRange aClipRect( aDstPoint, aAlphaMask->getSize() );
SvpSalGraphics::ClipUndoHandle aUndo = ensureClipFor( aClipRect );
m_aDevice->drawMaskedColor( m_aTextColor, aAlphaMask, aSrcRect, aDstPoint, m_aClipMap ); m_aDevice->drawMaskedColor( m_aTextColor, aAlphaMask, aSrcRect, aDstPoint, m_aClipMap );
} }
} }
......
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