1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 2 /* 3 * This file is part of the LibreOffice project. 4 * 5 * This Source Code Form is subject to the terms of the Mozilla Public 6 * License, v. 2.0. If a copy of the MPL was not distributed with this 7 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 8 * 9 * This file incorporates work covered by the following license notice: 10 * 11 * Licensed to the Apache Software Foundation (ASF) under one or more 12 * contributor license agreements. See the NOTICE file distributed 13 * with this work for additional information regarding copyright 14 * ownership. The ASF licenses this file to you under the Apache 15 * License, Version 2.0 (the "License"); you may not use this file 16 * except in compliance with the License. You may obtain a copy of 17 * the License at http://www.apache.org/licenses/LICENSE-2.0 . 18 */ 19 20 #pragma once 21 22 #include <unotools/configitem.hxx> 23 #include <optional> 24 #include <set> 25 26 namespace basegfx { class B2IVector; } 27 28 namespace dxcanvas 29 { 30 /** Provide DX canvas config data 31 */ 32 class DXCanvasItem : public ::utl::ConfigItem 33 { 34 public: 35 DXCanvasItem(); 36 37 struct DeviceInfo 38 { 39 sal_Int32 nVendorId; 40 sal_Int32 nDeviceId; 41 sal_Int32 nDeviceSubSysId; 42 sal_Int32 nDeviceRevision; 43 44 sal_Int32 nDriverId; 45 sal_Int32 nDriverVersion; 46 sal_Int32 nDriverSubVersion; 47 sal_Int32 nDriverBuildId; 48 operator <dxcanvas::DXCanvasItem::DeviceInfo49 bool operator<( const DeviceInfo& rRHS ) const 50 { 51 return nVendorId != rRHS.nVendorId ? nVendorId < rRHS.nVendorId : 52 (nDeviceId != rRHS.nDeviceId ? nDeviceId < rRHS.nDeviceId : 53 (nDeviceSubSysId != rRHS.nDeviceSubSysId ? nDeviceSubSysId < rRHS.nDeviceSubSysId : 54 (nDeviceRevision != rRHS.nDeviceRevision ? nDeviceRevision < rRHS.nDeviceRevision : 55 (nDriverId != rRHS.nDriverId ? nDriverId < rRHS.nDriverId : 56 (nDriverVersion != rRHS.nDriverVersion ? nDriverVersion < rRHS.nDriverVersion : 57 (nDriverSubVersion != rRHS.nDriverSubVersion ? nDriverSubVersion < rRHS.nDriverSubVersion : 58 (nDriverBuildId != rRHS.nDriverBuildId && nDriverBuildId < rRHS.nDriverBuildId))))))); 59 } 60 }; 61 62 ~DXCanvasItem() override; 63 64 bool isDeviceUsable( const DeviceInfo& rDeviceInfo ) const; 65 bool isDenylistCurrentDevice() const; 66 void denylistDevice( const DeviceInfo& rDeviceInfo ); 67 void adaptMaxTextureSize( basegfx::B2IVector& io_maxTextureSize ) const; 68 virtual void Notify( const css::uno::Sequence<OUString>& aPropertyNames) override; 69 70 private: 71 virtual void ImplCommit() override; 72 typedef std::set< DeviceInfo > ValueSet; 73 ValueSet maValues; 74 std::optional<sal_Int32> maMaxTextureSize; 75 bool mbDenylistCurrentDevice; 76 bool mbValuesDirty; 77 }; 78 } 79 80 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 81