xref: /trunk/main/canvas/source/directx/dx_config.hxx (revision 91c99ff4)
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 _DXCANVAS_DXCONFIG_HXX
25 #define _DXCANVAS_DXCONFIG_HXX
26 
27 #include <unotools/configitem.hxx>
28 #include <boost/optional.hpp>
29 #include <set>
30 
31 namespace basegfx { class B2IVector; }
32 
33 namespace dxcanvas
34 {
35     /** Provide DX canvas config data
36      */
37     class DXCanvasItem : public ::utl::ConfigItem
38     {
39     public:
40         DXCanvasItem();
41 
42         struct DeviceInfo
43         {
44             sal_Int32 nVendorId;
45             sal_Int32 nDeviceId;
46             sal_Int32 nDeviceSubSysId;
47             sal_Int32 nDeviceRevision;
48 
49             sal_Int32 nDriverId;
50             sal_Int32 nDriverVersion;
51             sal_Int32 nDriverSubVersion;
52             sal_Int32 nDriverBuildId;
53 
operator <dxcanvas::DXCanvasItem::DeviceInfo54             bool operator<( const DeviceInfo& rRHS ) const
55             {
56                 return nVendorId != rRHS.nVendorId ? nVendorId < rRHS.nVendorId :
57                     (nDeviceId != rRHS.nDeviceId ? nDeviceId < rRHS.nDeviceId :
58                      (nDeviceSubSysId != rRHS.nDeviceSubSysId ? nDeviceSubSysId < rRHS.nDeviceSubSysId :
59                       (nDeviceRevision != rRHS.nDeviceRevision ? nDeviceRevision < rRHS.nDeviceRevision :
60                        (nDriverId != rRHS.nDriverId ? nDriverId < rRHS.nDriverId :
61                         (nDriverVersion != rRHS.nDriverVersion ? nDriverVersion < rRHS.nDriverVersion :
62                          (nDriverSubVersion != rRHS.nDriverSubVersion ? nDriverSubVersion < rRHS.nDriverSubVersion :
63                           (nDriverBuildId != rRHS.nDriverBuildId ? nDriverBuildId < rRHS.nDriverBuildId : false)))))));
64             }
65         };
66 
67         ~DXCanvasItem();
68 
69         bool isDeviceUsable( const DeviceInfo& rDeviceInfo ) const;
70         bool isBlacklistCurrentDevice() const;
71         void blacklistDevice( const DeviceInfo& rDeviceInfo );
72         void adaptMaxTextureSize( basegfx::B2IVector& io_maxTextureSize ) const;
73             virtual void            Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames);
74             virtual void            Commit();
75 
76     private:
77         typedef std::set< DeviceInfo > ValueSet;
78         ValueSet                   maValues;
79         boost::optional<sal_Int32> maMaxTextureSize;
80         bool                       mbBlacklistCurrentDevice;
81         bool                       mbValuesDirty;
82     };
83 }
84 
85 #endif /* #ifndef _DXCANVAS_DXCONFIG_HXX */
86