glyphcache.cxx (9f62ea84) glyphcache.cxx (248a599f)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 370 unchanged lines hidden (view full) ---

379void GlyphCache::GrowNotify()
380{
381 if( (mnBytesUsed + mrPeer.GetByteCount()) > mnMaxSize )
382 GarbageCollect();
383}
384
385// -----------------------------------------------------------------------
386
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 370 unchanged lines hidden (view full) ---

379void GlyphCache::GrowNotify()
380{
381 if( (mnBytesUsed + mrPeer.GetByteCount()) > mnMaxSize )
382 GarbageCollect();
383}
384
385// -----------------------------------------------------------------------
386
387inline void GlyphCache::RemovingGlyph( ServerFont& rSF, GlyphData& rGD, int nGlyphIndex )
387inline void GlyphCache::RemovingGlyph( ServerFont& rSF, GlyphData& rGD, sal_GlyphId aGlyphId )
388{
388{
389 mrPeer.RemovingGlyph( rSF, rGD, nGlyphIndex );
389 mrPeer.RemovingGlyph( rSF, rGD, aGlyphId );
390 mnBytesUsed -= sizeof( GlyphData );
391 --mnGlyphCount;
392}
393
394// =======================================================================
395// ServerFont
396// =======================================================================
397

--- 48 unchanged lines hidden (view full) ---

446long ServerFont::Release() const
447{
448 DBG_ASSERT( mnRefCount > 0, "ServerFont: RefCount underflow" );
449 return --mnRefCount;
450}
451
452// -----------------------------------------------------------------------
453
390 mnBytesUsed -= sizeof( GlyphData );
391 --mnGlyphCount;
392}
393
394// =======================================================================
395// ServerFont
396// =======================================================================
397

--- 48 unchanged lines hidden (view full) ---

446long ServerFont::Release() const
447{
448 DBG_ASSERT( mnRefCount > 0, "ServerFont: RefCount underflow" );
449 return --mnRefCount;
450}
451
452// -----------------------------------------------------------------------
453
454GlyphData& ServerFont::GetGlyphData( int nGlyphIndex )
454GlyphData& ServerFont::GetGlyphData( sal_GlyphId aGlyphId )
455{
456 // usually the GlyphData is cached
455{
456 // usually the GlyphData is cached
457 GlyphList::iterator it = maGlyphList.find( nGlyphIndex );
457 GlyphList::iterator it = maGlyphList.find( aGlyphId );
458 if( it != maGlyphList.end() ) {
459 GlyphData& rGlyphData = it->second;
460 GlyphCache::GetInstance().UsingGlyph( *this, rGlyphData );
461 return rGlyphData;
462 }
463
464 // sometimes not => we need to create and initialize it ourselves
458 if( it != maGlyphList.end() ) {
459 GlyphData& rGlyphData = it->second;
460 GlyphCache::GetInstance().UsingGlyph( *this, rGlyphData );
461 return rGlyphData;
462 }
463
464 // sometimes not => we need to create and initialize it ourselves
465 GlyphData& rGlyphData = maGlyphList[ nGlyphIndex ];
465 GlyphData& rGlyphData = maGlyphList[ aGlyphId ];
466 mnBytesUsed += sizeof( GlyphData );
466 mnBytesUsed += sizeof( GlyphData );
467 InitGlyphData( nGlyphIndex, rGlyphData );
467 InitGlyphData( aGlyphId, rGlyphData );
468 GlyphCache::GetInstance().AddedGlyph( *this, rGlyphData );
469 return rGlyphData;
470}
471
472// -----------------------------------------------------------------------
473
474void ServerFont::GarbageCollect( long nMinLruIndex )
475{

--- 22 unchanged lines hidden (view full) ---

498 // TODO: use 32x32=>64bit intermediate
499 const double dCos = mnCos * (1.0 / 0x10000);
500 const double dSin = mnSin * (1.0 / 0x10000);
501 long nX = (long)(rPoint.X() * dCos + rPoint.Y() * dSin);
502 long nY = (long)(rPoint.Y() * dCos - rPoint.X() * dSin);
503 return Point( nX, nY );
504}
505
468 GlyphCache::GetInstance().AddedGlyph( *this, rGlyphData );
469 return rGlyphData;
470}
471
472// -----------------------------------------------------------------------
473
474void ServerFont::GarbageCollect( long nMinLruIndex )
475{

--- 22 unchanged lines hidden (view full) ---

498 // TODO: use 32x32=>64bit intermediate
499 const double dCos = mnCos * (1.0 / 0x10000);
500 const double dSin = mnSin * (1.0 / 0x10000);
501 long nX = (long)(rPoint.X() * dCos + rPoint.Y() * dSin);
502 long nY = (long)(rPoint.Y() * dCos - rPoint.X() * dSin);
503 return Point( nX, nY );
504}
505
506bool ServerFont::IsGlyphInvisible( int nGlyphIndex )
506bool ServerFont::IsGlyphInvisible( sal_GlyphId aGlyphId )
507{
508 if (!mbCollectedZW)
509 {
510 mnZWJ = GetGlyphIndex( 0x200D );
511 mnZWNJ = GetGlyphIndex( 0x200C );
512 mbCollectedZW = true;
513 }
514
507{
508 if (!mbCollectedZW)
509 {
510 mnZWJ = GetGlyphIndex( 0x200D );
511 mnZWNJ = GetGlyphIndex( 0x200C );
512 mbCollectedZW = true;
513 }
514
515 if( !nGlyphIndex ) // don't hide the NotDef glyph
515 if( !aGlyphId ) // don't hide the NotDef glyph
516 return false;
516 return false;
517 if( (nGlyphIndex == mnZWNJ) || (nGlyphIndex == mnZWJ) )
517 if( (aGlyphId == mnZWNJ) || (aGlyphId == mnZWJ) )
518 return true;
519
520 return false;
521}
522
523// =======================================================================
524
525ImplServerFontEntry::ImplServerFontEntry( ImplFontSelectData& rFSD )

--- 75 unchanged lines hidden ---
518 return true;
519
520 return false;
521}
522
523// =======================================================================
524
525ImplServerFontEntry::ImplServerFontEntry( ImplFontSelectData& rFSD )

--- 75 unchanged lines hidden ---