xref: /aoo41x/main/vcl/unx/generic/gdi/gcach_xpeer.hxx (revision 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
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 typedef Glyph XRenderGlyph;
36 
37 class X11GlyphPeer
38 : public GlyphCachePeer
39 {
40 public:
41                         X11GlyphPeer();
42     virtual            ~X11GlyphPeer();
43 
44     Pixmap              GetPixmap( ServerFont&, sal_GlyphId, int nScreen );
45     const RawBitmap*    GetRawBitmap( ServerFont&, sal_GlyphId );
46     bool                ForcedAntialiasing( const ServerFont&, int nScreen ) const;
47 
48     GlyphSet            GetGlyphSet( ServerFont&, int nScreen );
49     XRenderGlyph        GetXRGlyph( ServerFont&, sal_GlyphId );
50 
51 protected:
52     void                InitAntialiasing();
53 
54     virtual void        RemovingFont( ServerFont& );
55     virtual void        RemovingGlyph( ServerFont&, GlyphData&, sal_GlyphId );
56 
57     MultiScreenGlyph*   PrepareForMultiscreen( ExtGlyphData& ) const;
58     void                SetRenderGlyph( GlyphData&, Glyph ) const;
59     void                SetRawBitmap( GlyphData&, const RawBitmap* ) const;
60     void                SetPixmap( GlyphData&, Pixmap, int nScreen ) const;
61     XRenderGlyph        GetRenderGlyph( const GlyphData& ) const;
62     const RawBitmap*    GetRawBitmap( const GlyphData& ) const;
63     Pixmap              GetPixmap( const GlyphData&, int nScreen ) const;
64 
65 private:
66     Display*            mpDisplay;
67 
68     // thirty-two screens should be enough for everyone...
69     static const int MAX_GCACH_SCREENS = 32;
70     int                 mnMaxScreens;
71     int                 mnDefaultScreen;
72     int                 mnExtByteCount;
73     RawBitmap           maRawBitmap;
74     sal_uInt32          mnForcedAA;
75     sal_uInt32          mnUsingXRender;
76 };
77 
78 class X11GlyphCache : public GlyphCache
79 {
80 public:
GetPeer()81     X11GlyphPeer&      GetPeer() { return reinterpret_cast<X11GlyphPeer&>( mrPeer ); }
82 static X11GlyphCache&  GetInstance();
83 static void            KillInstance();
84 
85 private:
86                        X11GlyphCache( X11GlyphPeer& );
87 };
88 
89 #endif // _SV_GCACH_XPEER_HXX
90