summaryrefslogtreecommitdiffstats
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-08-20 00:16:57 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-08-22 09:39:13 +0100
commit846899404e1f6799b68d5d9ff4238364c53cbaa7 (patch)
tree8fc34992168902daeae6bd35485a329d998f1c28 /vcl
parentcallcatcher: post-unotools cleanup this is now unused (diff)
downloadcore-846899404e1f6799b68d5d9ff4238364c53cbaa7.tar.gz
core-846899404e1f6799b68d5d9ff4238364c53cbaa7.zip
callcatcher: post cairo-text remove unused legacy methods
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/unx/salgdi.h4
-rw-r--r--vcl/unx/generic/gdi/gcach_xpeer.cxx10
-rw-r--r--vcl/unx/generic/gdi/gcach_xpeer.hxx1
-rw-r--r--vcl/unx/generic/gdi/salgdi3.cxx358
4 files changed, 1 insertions, 372 deletions
diff --git a/vcl/inc/unx/salgdi.h b/vcl/inc/unx/salgdi.h
index a44a3f562436..d606a36c6d27 100644
--- a/vcl/inc/unx/salgdi.h
+++ b/vcl/inc/unx/salgdi.h
@@ -214,10 +214,6 @@ protected:
void DrawPrinterString( const SalLayout& );
void DrawServerFontString( const ServerFontLayout& );
- void DrawServerSimpleFontString( const ServerFontLayout& );
- void DrawServerAAFontString( const ServerFontLayout& );
- bool DrawServerAAForcedString( const ServerFontLayout& );
- void DrawCairoAAFontString( const ServerFontLayout& );
void freeResources();
public:
diff --git a/vcl/unx/generic/gdi/gcach_xpeer.cxx b/vcl/unx/generic/gdi/gcach_xpeer.cxx
index 644295048e77..14191c738ab3 100644
--- a/vcl/unx/generic/gdi/gcach_xpeer.cxx
+++ b/vcl/unx/generic/gdi/gcach_xpeer.cxx
@@ -404,16 +404,6 @@ void X11GlyphPeer::RemovingGlyph( ServerFont& /*rServerFont*/, GlyphData& rGlyph
// ---------------------------------------------------------------------------
-bool X11GlyphPeer::ForcedAntialiasing( const ServerFont& rServerFont, int nScreen ) const
-{
- bool bForceOk = rServerFont.GetAntialiasAdvice();
- // maximum size for antialiasing is 250 pixels
- bForceOk &= (rServerFont.GetFontSelData().mnHeight < 250);
- return (bForceOk && ((mnForcedAA >> nScreen) & 1));
-}
-
-// ---------------------------------------------------------------------------
-
GlyphSet X11GlyphPeer::GetGlyphSet( ServerFont& rServerFont, int nScreen )
{
if( (nScreen >= 0) && ((mnUsingXRender >> nScreen) & 1) == 0 )
diff --git a/vcl/unx/generic/gdi/gcach_xpeer.hxx b/vcl/unx/generic/gdi/gcach_xpeer.hxx
index 990cba36d245..de019d74d6c4 100644
--- a/vcl/unx/generic/gdi/gcach_xpeer.hxx
+++ b/vcl/unx/generic/gdi/gcach_xpeer.hxx
@@ -47,7 +47,6 @@ public:
Pixmap GetPixmap( ServerFont&, int nGlyphIndex, int nScreen );
const RawBitmap* GetRawBitmap( ServerFont&, int nGlyphIndex );
- bool ForcedAntialiasing( const ServerFont&, int nScreen ) const;
GlyphSet GetGlyphSet( ServerFont&, int nScreen );
Glyph GetGlyphId( ServerFont&, int nGlyphIndex );
diff --git a/vcl/unx/generic/gdi/salgdi3.cxx b/vcl/unx/generic/gdi/salgdi3.cxx
index ca0385baac1f..7c94d40b5949 100644
--- a/vcl/unx/generic/gdi/salgdi3.cxx
+++ b/vcl/unx/generic/gdi/salgdi3.cxx
@@ -286,7 +286,7 @@ namespace
}
}
-void X11SalGraphics::DrawCairoAAFontString( const ServerFontLayout& rLayout )
+void X11SalGraphics::DrawServerFontLayout( const ServerFontLayout& rLayout )
{
std::vector<cairo_glyph_t> cairo_glyphs;
std::vector<int> glyph_extrarotation;
@@ -472,362 +472,6 @@ void X11SalGraphics::DrawCairoAAFontString( const ServerFontLayout& rLayout )
//--------------------------------------------------------------------------
-void X11SalGraphics::DrawServerAAFontString( const ServerFontLayout& rLayout )
-{
- // get xrender target for this drawable
- Picture aDstPic = GetXRenderPicture();
- if( !aDstPic )
- return;
-
- // get a XRenderPicture for the font foreground
- // TODO: move into own method
- XRenderPeer& rRenderPeer = XRenderPeer::GetInstance();
- XRenderPictFormat* pVisualFormat = (XRenderPictFormat*)GetXRenderFormat();
- DBG_ASSERT( pVisualFormat, "we already have a render picture, but XRenderPictFormat==NULL???");
- const int nVisualDepth = pVisualFormat->depth;
- SalDisplay::RenderEntry& rEntry = GetDisplay()->GetRenderEntries( m_nScreen )[ nVisualDepth ];
- if( !rEntry.m_aPicture )
- {
- // create and cache XRenderPicture for the font foreground
- Display* pDisplay = GetXDisplay();
-#ifdef DEBUG
- int iDummy;
- unsigned uDummy;
- XLIB_Window wDummy;
- unsigned int nDrawDepth;
- ::XGetGeometry( pDisplay, hDrawable_, &wDummy, &iDummy, &iDummy,
- &uDummy, &uDummy, &uDummy, &nDrawDepth );
- DBG_ASSERT( static_cast<unsigned>(nVisualDepth) == nDrawDepth, "depth messed up for XRender" );
-#endif
-
- rEntry.m_aPixmap = ::XCreatePixmap( pDisplay, hDrawable_, 1, 1, nVisualDepth );
-
- XRenderPictureAttributes aAttr;
- aAttr.repeat = true;
- rEntry.m_aPicture = rRenderPeer.CreatePicture ( rEntry.m_aPixmap, pVisualFormat, CPRepeat, &aAttr );
- }
-
- // set font foreground color and opacity
- XRenderColor aRenderColor = GetXRenderColor( nTextColor_ );
- rRenderPeer.FillRectangle( PictOpSrc, rEntry.m_aPicture, &aRenderColor, 0, 0, 1, 1 );
-
- // set clipping
- // TODO: move into GetXRenderPicture()?
- if( mpClipRegion && !XEmptyRegion( mpClipRegion ) )
- rRenderPeer.SetPictureClipRegion( aDstPic, mpClipRegion );
-
- ServerFont& rFont = rLayout.GetServerFont();
- X11GlyphPeer& rGlyphPeer = X11GlyphCache::GetInstance().GetPeer();
- GlyphSet aGlyphSet = rGlyphPeer.GetGlyphSet( rFont, m_nScreen );
-
- Point aPos;
- static const int MAXGLYPHS = 160;
- sal_GlyphId aGlyphAry[ MAXGLYPHS ];
- int nMaxGlyphs = rLayout.GetOrientation() ? 1 : MAXGLYPHS;
- for( int nStart = 0;;)
- {
- int nGlyphs = rLayout.GetNextGlyphs( nMaxGlyphs, aGlyphAry, aPos, nStart );
- if( !nGlyphs )
- break;
-
- // #i51924# avoid 32->16bit coordinate truncation problem in X11
- // TODO: reevaluate once displays with >30000 pixels are available
- if( aPos.X() >= 30000 || aPos.Y() >= 30000 )
- continue;
-
- unsigned int aRenderAry[ MAXGLYPHS ];
- for( int i = 0; i < nGlyphs; ++i )
- aRenderAry[ i ] = rGlyphPeer.GetGlyphId( rFont, aGlyphAry[i] );
- rRenderPeer.CompositeString32( rEntry.m_aPicture, aDstPic,
- aGlyphSet, aPos.X(), aPos.Y(), aRenderAry, nGlyphs );
- }
-}
-
-//--------------------------------------------------------------------------
-
-bool X11SalGraphics::DrawServerAAForcedString( const ServerFontLayout& rLayout )
-{
- ServerFont& rFont = rLayout.GetServerFont();
-
- // prepare glyphs and get extent of operation
- X11GlyphPeer& rGlyphPeer = X11GlyphCache::GetInstance().GetPeer();
- int nXmin = 0;
- int nXmax = 0;
- int nYmin = 0;
- int nYmax = 0;
- int nStart = 0;
- Point aPos;
- sal_GlyphId nGlyph;
- for( bool bFirst=true; rLayout.GetNextGlyphs( 1, &nGlyph, aPos, nStart ); )
- {
- const RawBitmap* const pRawBitmap = rGlyphPeer.GetRawBitmap( rFont, nGlyph );
- if( !pRawBitmap )
- continue;
-
- const int nX1 = aPos.X() + pRawBitmap->mnXOffset;
- const int nY1 = aPos.Y() + pRawBitmap->mnYOffset;
- const int nX2 = nX1 + pRawBitmap->mnWidth;
- const int nY2 = nY1 + pRawBitmap->mnHeight;
-
- if( bFirst )
- {
- bFirst = false;
- nXmin = nX1;
- nXmax = nX2;
- nYmin = nY1;
- nYmax = nY2;
- }
- else
- {
- if( nXmin > nX1 ) nXmin = nX1;
- if( nXmax < nX2 ) nXmax = nX2;
- if( nYmin > nY1 ) nYmin = nY1;
- if( nYmax < nY2 ) nYmax = nY2;
- }
- }
-
- // get XImage
- GetDisplay()->GetXLib()->PushXErrorLevel( true );
- Display* pDisplay = GetXDisplay();
-
- XRectangle aXRect;
- long nWidth = 1, nHeight = 1;
- if( m_pFrame )
- nWidth = m_pFrame->maGeometry.nWidth, nHeight = m_pFrame->maGeometry.nHeight;
- else if( m_pVDev )
- nWidth = m_pVDev->GetWidth(), nHeight = m_pVDev->GetHeight();
-
- if( mpClipRegion && !XEmptyRegion( mpClipRegion ) )
- {
- // get bounding box
- XClipBox( mpClipRegion, &aXRect );
- // clip with window
- if( aXRect.x < 0 ) aXRect.x = 0;
-
- if( aXRect.y < 0 ) aXRect.y = 0;
- if( aXRect.width+aXRect.x > nWidth ) aXRect.width = nWidth-aXRect.x;
- if( aXRect.height+aXRect.y > nHeight ) aXRect.height = nHeight-aXRect.y;
- }
- else
- {
- aXRect.x = 0;
- aXRect.y = 0;
- aXRect.width = nWidth;
- aXRect.height = nHeight;
- }
- if( m_pFrame )
- {
- // clip with screen
- int nScreenX = m_pFrame->maGeometry.nX+aXRect.x;
- int nScreenY = m_pFrame->maGeometry.nY+aXRect.y;
- const Size& rScreenSize = GetDisplay()->getDataForScreen( m_nScreen ).m_aSize;
- int nScreenW = rScreenSize.Width();
- int nScreenH = rScreenSize.Height();
- if( nScreenX < 0 )
- aXRect.x -= nScreenX, aXRect.width += nScreenX;
- if( nScreenX+aXRect.width > nScreenW )
- aXRect.width = nScreenW-nScreenX;
- if( nScreenY < 0 )
- aXRect.y -= nScreenY, aXRect.height += nScreenY;
- if( nScreenY+aXRect.height > nScreenH )
- aXRect.height = nScreenH-nScreenY;
- }
-
-
- if( nXmin < aXRect.x ) nXmin = aXRect.x;
- if( nYmin < aXRect.y ) nYmin = aXRect.y;
- if( nXmax >= aXRect.x+aXRect.width ) nXmax = aXRect.x + aXRect.width - 1;
- if( nYmax >= aXRect.y+aXRect.height ) nYmax = aXRect.y + aXRect.height - 1;
-
- if( nXmin > nXmax )
- return false;
- if( nYmin > nYmax )
- return false;
-
- XImage* pImg = XGetImage( pDisplay, hDrawable_,
- nXmin, nYmin,
- (nXmax-nXmin+1), (nYmax-nYmin+1),
- ~0, ZPixmap );
- if( pImg == NULL )
- {
- if( m_pFrame )
- {
- // the reason we did not get an image could be that the frame
- // geometry changed in the meantime; lets get the current geometry
- // and clip against the current window size as well as the screen
- // with the current frame position
- const Size& rScreenSize = GetDisplay()->getDataForScreen(m_nScreen).m_aSize;
- int nScreenW = rScreenSize.Width();
- int nScreenH = rScreenSize.Height();
- XLIB_Window aRoot = None;
- int x = 0, y = 0;
- unsigned int w = 0, h = 0, bw = 0, d;
- XGetGeometry( pDisplay, hDrawable_, &aRoot, &x, &y, &w, &h, &bw, &d );
- XTranslateCoordinates( pDisplay, hDrawable_, aRoot, 0, 0, &x, &y, &aRoot );
- if( nXmin + x < 0 ) // clip on left screen edge
- nXmin += x-nXmin;
- if( nYmin + y < 0 ) // clip on top screen edge
- nYmin += y-nYmin;
- if( nXmax >= int(w) ) // clip on right window egde
- nXmax = w-1;
- if( nYmax >= int(h) ) // clip on bottom window edge
- nYmax = h-1;
- if( nXmax + x >= nScreenW ) // clip on right screen edge
- nXmax -= (nXmax + x - nScreenW)+1;
- if( nYmax + y >= nScreenH ) // clip on bottom screen edge
- nYmax -= (nYmax + y - nScreenH)+1;
- if( nXmax >= nXmin && nYmax >= nYmin )
- {
- // try again to get the image
- pImg = XGetImage( pDisplay, hDrawable_,
- nXmin, nYmin,
- (nXmax-nXmin+1), (nYmax-nYmin+1),
- ~0, ZPixmap );
- }
- }
- if( pImg == NULL )
- {
- GetDisplay()->GetXLib()->PopXErrorLevel();
- return false;
- }
- }
-
- // prepare context
- GC nGC = GetFontGC();
- XGCValues aGCVal;
- XGetGCValues( pDisplay, nGC, GCForeground, &aGCVal );
-
- unsigned long nOrigColor = XGetPixel( pImg, 0, 0 );
- XPutPixel( pImg, 0, 0, aGCVal.foreground );
- unsigned char aColor[4];
- aColor[0] = pImg->data[0];
- aColor[1] = pImg->data[1];
- aColor[2] = pImg->data[2];
- aColor[3] = pImg->data[3];
- XPutPixel( pImg, 0, 0, nOrigColor );
-
- // work on XImage
- const int bpp = pImg->bits_per_pixel >> 3;
- for( nStart = 0; rLayout.GetNextGlyphs( 1, &nGlyph, aPos, nStart ); )
- {
- const RawBitmap* const pRawBitmap = rGlyphPeer.GetRawBitmap( rFont, nGlyph );
- if( !pRawBitmap )
- continue;
-
- const int nX1 = aPos.X() + pRawBitmap->mnXOffset;
- const int nY1 = aPos.Y() + pRawBitmap->mnYOffset;
-
- if( (nX1 <= nXmax) && (int(nX1 + pRawBitmap->mnWidth) > nXmin)
- && (nY1 <= nYmax) && (int(nY1 + pRawBitmap->mnHeight) > nYmin) )
- {
- const unsigned char* p10 = pRawBitmap->mpBits;
- unsigned char* p20 = (unsigned char*)pImg->data; // dest left limit
- p20 += (nY1 - nYmin) * pImg->bytes_per_line;
- unsigned char* p21 = p20 + (nX1 - nXmin + pImg->xoffset) * bpp;
- int y = pRawBitmap->mnHeight;
- if( y > nYmax - nY1 )
- y = nYmax - nY1 + 1;
- while( --y >= 0 )
- {
- if( p20 >= (unsigned char*)pImg->data )
- {
- unsigned char* const p22 = p20 + pImg->width * bpp; // dest right limit
- unsigned char* pDst = p21;
- const unsigned char* pSrc = p10;
- for( int x = pRawBitmap->mnWidth; (--x >= 0) && (p22 > pDst); ++pSrc )
- {
- if( (*pSrc == 0) || (p20 > pDst) ) // keep background
- pDst += bpp;
- else if( *pSrc == 0xFF ) // paint foreground
- {
- const unsigned char* pColor = aColor;
- for( int z = bpp; --z >= 0; ++pColor, ++pDst )
- *pDst = *pColor;
- }
- else // blend fg into bg
- {
- const unsigned char* pColor = aColor;
- for( int z = bpp; --z >= 0; ++pColor, ++pDst )
- // theoretically it should be *257) >> 16
- // but the error is <0.4% worst case and we are in
- // the innermost loop of very perf-sensitive code
-
- *pDst += (*pSrc * ((int)*pColor - *pDst)) >> 8;
- }
- }
- }
- p10 += pRawBitmap->mnScanlineSize;
- p20 += pImg->bytes_per_line;
- p21 += pImg->bytes_per_line;
- }
- }
- }
-
- // put XImage
- XPutImage( pDisplay, hDrawable_, nGC, pImg,
- 0, 0, nXmin, nYmin, (nXmax - nXmin + 1), (nYmax - nYmin + 1) );
- XDestroyImage( pImg );
-
- GetDisplay()->GetXLib()->PopXErrorLevel();
- return true;
-}
-
-//--------------------------------------------------------------------------
-
-void X11SalGraphics::DrawServerSimpleFontString( const ServerFontLayout& rSalLayout )
-{
- ServerFont& rFont = rSalLayout.GetServerFont();
- X11GlyphPeer& rGlyphPeer = X11GlyphCache::GetInstance().GetPeer();
-
- Display* pDisplay = GetXDisplay();
- GC nGC = GetFontGC();
-
- XGCValues aGCVal;
- aGCVal.fill_style = FillStippled;
- aGCVal.line_width = 0;
- GC tmpGC = XCreateGC( pDisplay, hDrawable_, GCFillStyle|GCLineWidth, &aGCVal );
- XCopyGC( pDisplay, nGC, (1<<GCLastBit)-(1+GCFillStyle+GCLineWidth), tmpGC );
-
- Point aPos;
- sal_GlyphId nGlyph;
- for( int nStart = 0; rSalLayout.GetNextGlyphs( 1, &nGlyph, aPos, nStart ); )
- {
- // #i51924# avoid 32->16bit coordinate truncation problem in X11
- // TODO: reevaluate once displays with >30000 pixels are available
- if( aPos.X() >= 30000 || aPos.Y() >= 30000 )
- continue;
-
- Pixmap aStipple = rGlyphPeer.GetPixmap( rFont, nGlyph, m_nScreen );
- const GlyphMetric& rGM = rFont.GetGlyphMetric( nGlyph );
-
- if( aStipple != None )
- {
- const int nDestX = aPos.X() + rGM.GetOffset().X();
- const int nDestY = aPos.Y() + rGM.GetOffset().Y();
-
- aGCVal.stipple = aStipple;
- aGCVal.ts_x_origin = nDestX;
- aGCVal.ts_y_origin = nDestY;
- XChangeGC( pDisplay, tmpGC, GCStipple|GCTileStipXOrigin|GCTileStipYOrigin, &aGCVal );
-
- const int nWidth = rGM.GetSize().Width();
- const int nHeight = rGM.GetSize().Height();
- XFillRectangle( pDisplay, hDrawable_, tmpGC, nDestX, nDestY, nWidth, nHeight );
- }
- }
-
- XFreeGC( pDisplay, tmpGC );
-}
-
-//--------------------------------------------------------------------------
-
-void X11SalGraphics::DrawServerFontLayout( const ServerFontLayout& rLayout )
-{
- DrawCairoAAFontString( rLayout );
-}
-
-//--------------------------------------------------------------------------
-
const ImplFontCharMap* X11SalGraphics::GetImplFontCharMap() const
{
if( !mpServerFont[0] )