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 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _SV_GCACH_XPEER_HXX 25 #define _SV_GCACH_XPEER_HXX 26 27 #include <tools/prex.h> 28 #include <X11/extensions/Xrender.h> 29 #include <tools/postx.h> 30 31 #include <glyphcache.hxx> 32 33 class SalDisplay; 34 struct MultiScreenGlyph; 35 36 class X11GlyphPeer 37 : public GlyphCachePeer 38 { 39 public: 40 X11GlyphPeer(); 41 virtual ~X11GlyphPeer(); 42 43 Pixmap GetPixmap( ServerFont&, int nGlyphIndex, int nScreen ); 44 const RawBitmap* GetRawBitmap( ServerFont&, int nGlyphIndex ); 45 bool ForcedAntialiasing( const ServerFont&, int nScreen ) const; 46 47 GlyphSet GetGlyphSet( ServerFont&, int nScreen ); 48 Glyph GetGlyphId( ServerFont&, int nGlyphIndex ); 49 50 protected: 51 void InitAntialiasing(); 52 53 virtual void RemovingFont( ServerFont& ); 54 virtual void RemovingGlyph( ServerFont&, GlyphData&, int nGlyphIndex ); 55 56 MultiScreenGlyph* PrepareForMultiscreen( ExtGlyphData& ) const; 57 void SetRenderGlyph( GlyphData&, Glyph ) const; 58 void SetRawBitmap( GlyphData&, const RawBitmap* ) const; 59 void SetPixmap( GlyphData&, Pixmap, int nScreen ) const; 60 Glyph GetRenderGlyph( const GlyphData& ) const; 61 const RawBitmap* GetRawBitmap( const GlyphData& ) const; 62 Pixmap GetPixmap( const GlyphData&, int nScreen ) const; 63 64 private: 65 Display* mpDisplay; 66 67 // thirty-two screens should be enough for everyone... 68 static const int MAX_GCACH_SCREENS = 32; 69 int mnMaxScreens; 70 int mnDefaultScreen; 71 int mnExtByteCount; 72 RawBitmap maRawBitmap; 73 sal_uInt32 mnForcedAA; 74 sal_uInt32 mnUsingXRender; 75 }; 76 77 class X11GlyphCache : public GlyphCache 78 { 79 public: 80 X11GlyphPeer& GetPeer() { return reinterpret_cast<X11GlyphPeer&>( mrPeer ); } 81 static X11GlyphCache& GetInstance(); 82 static void KillInstance(); 83 84 private: 85 X11GlyphCache( X11GlyphPeer& ); 86 }; 87 88 #endif // _SV_GCACH_XPEER_HXX 89