xref: /aoo41x/main/vcl/unx/generic/gdi/gcach_xpeer.hxx (revision 248a599f)
1ebfcd9afSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3ebfcd9afSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4ebfcd9afSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5ebfcd9afSAndrew Rist  * distributed with this work for additional information
6ebfcd9afSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7ebfcd9afSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8ebfcd9afSAndrew Rist  * "License"); you may not use this file except in compliance
9ebfcd9afSAndrew Rist  * with the License.  You may obtain a copy of the License at
10ebfcd9afSAndrew Rist  *
11ebfcd9afSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12ebfcd9afSAndrew Rist  *
13ebfcd9afSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14ebfcd9afSAndrew Rist  * software distributed under the License is distributed on an
15ebfcd9afSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16ebfcd9afSAndrew Rist  * KIND, either express or implied.  See the License for the
17ebfcd9afSAndrew Rist  * specific language governing permissions and limitations
18ebfcd9afSAndrew Rist  * under the License.
19ebfcd9afSAndrew Rist  *
20ebfcd9afSAndrew Rist  *************************************************************/
21ebfcd9afSAndrew Rist 
22ebfcd9afSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _SV_GCACH_XPEER_HXX
25cdf0e10cSrcweir #define _SV_GCACH_XPEER_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <tools/prex.h>
28cdf0e10cSrcweir #include <X11/extensions/Xrender.h>
29cdf0e10cSrcweir #include <tools/postx.h>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include <glyphcache.hxx>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir class SalDisplay;
34cdf0e10cSrcweir struct MultiScreenGlyph;
35*248a599fSHerbert Dürr typedef Glyph XRenderGlyph;
36cdf0e10cSrcweir 
37cdf0e10cSrcweir class X11GlyphPeer
38cdf0e10cSrcweir : public GlyphCachePeer
39cdf0e10cSrcweir {
40cdf0e10cSrcweir public:
41cdf0e10cSrcweir                         X11GlyphPeer();
42cdf0e10cSrcweir     virtual            ~X11GlyphPeer();
43cdf0e10cSrcweir 
44*248a599fSHerbert Dürr     Pixmap              GetPixmap( ServerFont&, sal_GlyphId, int nScreen );
45*248a599fSHerbert Dürr     const RawBitmap*    GetRawBitmap( ServerFont&, sal_GlyphId );
46cdf0e10cSrcweir     bool                ForcedAntialiasing( const ServerFont&, int nScreen ) const;
47cdf0e10cSrcweir 
48cdf0e10cSrcweir     GlyphSet            GetGlyphSet( ServerFont&, int nScreen );
49*248a599fSHerbert Dürr     XRenderGlyph        GetXRGlyph( ServerFont&, sal_GlyphId );
50cdf0e10cSrcweir 
51cdf0e10cSrcweir protected:
52cdf0e10cSrcweir     void                InitAntialiasing();
53cdf0e10cSrcweir 
54cdf0e10cSrcweir     virtual void        RemovingFont( ServerFont& );
55*248a599fSHerbert Dürr     virtual void        RemovingGlyph( ServerFont&, GlyphData&, sal_GlyphId );
56cdf0e10cSrcweir 
57cdf0e10cSrcweir     MultiScreenGlyph*   PrepareForMultiscreen( ExtGlyphData& ) const;
58cdf0e10cSrcweir     void                SetRenderGlyph( GlyphData&, Glyph ) const;
59cdf0e10cSrcweir     void                SetRawBitmap( GlyphData&, const RawBitmap* ) const;
60cdf0e10cSrcweir     void                SetPixmap( GlyphData&, Pixmap, int nScreen ) const;
61*248a599fSHerbert Dürr     XRenderGlyph        GetRenderGlyph( const GlyphData& ) const;
62cdf0e10cSrcweir     const RawBitmap*    GetRawBitmap( const GlyphData& ) const;
63cdf0e10cSrcweir     Pixmap              GetPixmap( const GlyphData&, int nScreen ) const;
64cdf0e10cSrcweir 
65cdf0e10cSrcweir private:
66cdf0e10cSrcweir     Display*            mpDisplay;
67cdf0e10cSrcweir 
68cdf0e10cSrcweir     // thirty-two screens should be enough for everyone...
69cdf0e10cSrcweir     static const int MAX_GCACH_SCREENS = 32;
70cdf0e10cSrcweir     int                 mnMaxScreens;
71cdf0e10cSrcweir     int                 mnDefaultScreen;
72cdf0e10cSrcweir     int                 mnExtByteCount;
73cdf0e10cSrcweir     RawBitmap           maRawBitmap;
74cdf0e10cSrcweir     sal_uInt32          mnForcedAA;
75cdf0e10cSrcweir     sal_uInt32          mnUsingXRender;
76cdf0e10cSrcweir };
77cdf0e10cSrcweir 
78cdf0e10cSrcweir class X11GlyphCache : public GlyphCache
79cdf0e10cSrcweir {
80cdf0e10cSrcweir public:
GetPeer()81cdf0e10cSrcweir     X11GlyphPeer&      GetPeer() { return reinterpret_cast<X11GlyphPeer&>( mrPeer ); }
82cdf0e10cSrcweir static X11GlyphCache&  GetInstance();
83cdf0e10cSrcweir static void            KillInstance();
84cdf0e10cSrcweir 
85cdf0e10cSrcweir private:
86cdf0e10cSrcweir                        X11GlyphCache( X11GlyphPeer& );
87cdf0e10cSrcweir };
88cdf0e10cSrcweir 
89cdf0e10cSrcweir #endif // _SV_GCACH_XPEER_HXX
90