diff options
Diffstat (limited to '')
-rw-r--r-- | vcl/inc/opengl/win/WinDeviceInfo.hxx | 103 | ||||
-rw-r--r-- | vcl/inc/opengl/win/gdiimpl.hxx | 97 | ||||
-rw-r--r-- | vcl/inc/opengl/win/winlayout.hxx | 51 |
3 files changed, 251 insertions, 0 deletions
diff --git a/vcl/inc/opengl/win/WinDeviceInfo.hxx b/vcl/inc/opengl/win/WinDeviceInfo.hxx new file mode 100644 index 000000000..04d97406b --- /dev/null +++ b/vcl/inc/opengl/win/WinDeviceInfo.hxx @@ -0,0 +1,103 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_VCL_OPENGL_WIN_WINDEVICEINFO_HXX +#define INCLUDED_VCL_OPENGL_WIN_WINDEVICEINFO_HXX + +#include <vcl/dllapi.h> + +#include <opengl/DeviceInfo.hxx> +#include <driverblocklist.hxx> + +#include <rtl/ustring.hxx> +#include <vector> +#include <cstdint> + +class VCL_DLLPUBLIC WinOpenGLDeviceInfo : public OpenGLDeviceInfo +{ +private: + OUString maDriverVersion; + OUString maDriverVersion2; + + OUString maDriverDate; + OUString maDriverDate2; + + OUString maDeviceID; + OUString maDeviceID2; + + OUString maAdapterVendorID; + OUString maAdapterDeviceID; + OUString maAdapterSubsysID; + + OUString maAdapterVendorID2; + OUString maAdapterDeviceID2; + OUString maAdapterSubsysID2; + + OUString maDeviceKey; + OUString maDeviceKey2; + + OUString maDeviceString; + OUString maDeviceString2; + + bool mbHasDualGPU; + bool mbRDP; + + void GetData(); + bool FindBlocklistedDeviceInList(); + +public: + WinOpenGLDeviceInfo(); + + virtual ~WinOpenGLDeviceInfo() override; + + virtual bool isDeviceBlocked() override; + + const OUString& GetDriverVersion() const + { + return maDriverVersion; + } + + const OUString& GetDriverDate() const + { + return maDriverDate; + } + + const OUString& GetDeviceID() const + { + return maDeviceID; + } + + const OUString& GetAdapterVendorID() const + { + return maAdapterVendorID; + } + + const OUString& GetAdapterDeviceID() const + { + return maAdapterDeviceID; + } + + const OUString& GetAdapterSubsysID() const + { + return maAdapterSubsysID; + } + const OUString& GetDeviceKey() const + { + return maDeviceKey; + } + + const OUString& GetDeviceString() const + { + return maDeviceString; + } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/opengl/win/gdiimpl.hxx b/vcl/inc/opengl/win/gdiimpl.hxx new file mode 100644 index 000000000..dff47ef7e --- /dev/null +++ b/vcl/inc/opengl/win/gdiimpl.hxx @@ -0,0 +1,97 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_VCL_INC_OPENGL_WIN_GDIIMPL_HXX +#define INCLUDED_VCL_INC_OPENGL_WIN_GDIIMPL_HXX + +#include <memory> +#include <vcl/dllapi.h> + +#include <opengl/gdiimpl.hxx> +#include <svdata.hxx> +#include <win/salgdi.h> +#include <win/wingdiimpl.hxx> +#include <o3tl/lru_map.hxx> +#include <vcl/opengl/OpenGLContext.hxx> +#include <ControlCacheKey.hxx> + +class OpenGLCompatibleDC : public CompatibleDC +{ +public: + OpenGLCompatibleDC(SalGraphics &rGraphics, int x, int y, int width, int height); + + virtual std::unique_ptr<Texture> getAsMaskTexture() const override; + // caller must delete + OpenGLTexture* getOpenGLTexture() const; + + /// Copy bitmap data to the texture. Texture must be initialized and the correct size to hold the bitmap. + bool copyToTexture(Texture& aTexture) const; + + struct Texture; +}; + +struct OpenGLCompatibleDC::Texture : public CompatibleDC::Texture +{ + OpenGLTexture texture; + virtual bool isValid() const { return !!texture; } + virtual int GetWidth() const { return texture.GetWidth(); } + virtual int GetHeight() const { return texture.GetHeight(); } +}; + +class WinOpenGLSalGraphicsImpl : public OpenGLSalGraphicsImpl, public WinSalGraphicsImplBase +{ + friend class WinLayout; +private: + WinSalGraphics& mrWinParent; + + bool RenderCompatibleDC(OpenGLCompatibleDC& rWhite, OpenGLCompatibleDC& rBlack, + int nX, int nY, TextureCombo& rCombo); + +public: + WinOpenGLSalGraphicsImpl(WinSalGraphics& rGraphics, + SalGeometryProvider *mpProvider); + +protected: + virtual rtl::Reference<OpenGLContext> CreateWinContext() override; + + bool RenderTextureCombo(TextureCombo const & rCombo, int nX, int nY); + +public: + virtual void Init() override; + virtual void copyBits( const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics ) override; + + virtual bool UseTextDraw() const override { return true; } + virtual void PreDrawText() override; + virtual void PostDrawText() override; + virtual void DrawTextMask( CompatibleDC::Texture* rTexture, Color nMaskColor, const SalTwoRect& rPosAry ) override; + using OpenGLSalGraphicsImpl::DrawMask; + virtual void DeferredTextDraw(const CompatibleDC::Texture* pTexture, Color nMaskColor, const SalTwoRect& rPosAry) override; + + virtual bool UseRenderNativeControl() const override { return true; } + virtual bool TryRenderCachedNativeControl(ControlCacheKey const & rControlCacheKey, int nX, int nY) override; + virtual bool RenderAndCacheNativeControl(CompatibleDC& rWhite, CompatibleDC& rBlack, + int nX, int nY , ControlCacheKey& aControlCacheKey) override; + +}; + +typedef std::pair<ControlCacheKey, std::unique_ptr<TextureCombo>> OpenGLControlCachePair; +typedef o3tl::lru_map<ControlCacheKey, std::unique_ptr<TextureCombo>, ControlCacheHashFunction> OpenGLControlCacheType; + +class OpenGLControlsCache { + OpenGLControlCacheType cache; + + OpenGLControlsCache(); + +public: + static OpenGLControlCacheType & get(); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/opengl/win/winlayout.hxx b/vcl/inc/opengl/win/winlayout.hxx new file mode 100644 index 000000000..d017bc250 --- /dev/null +++ b/vcl/inc/opengl/win/winlayout.hxx @@ -0,0 +1,51 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_VCL_INC_OPENGL_WIN_WINLAYOUT_HXX +#define INCLUDED_VCL_INC_OPENGL_WIN_WINLAYOUT_HXX + +#include <win/winlayout.hxx> +#include <opengl/PackedTextureAtlas.hxx> + +struct OpenGLGlobalWinGlyphCache : public GlobalWinGlyphCache +{ + OpenGLGlobalWinGlyphCache() + : maPackedTextureAtlas(2048, 2048) + { + } + + PackedTextureAtlasManager maPackedTextureAtlas; + + virtual bool AllocateTexture(WinGlyphDrawElement& rElement, CompatibleDC* dc) override; + virtual void Prune() override; +}; + +class OpenGLWinGlyphCache : public WinGlyphCache +{ +public: + void RemoveTextures(std::vector<GLuint>& rTextureIDs); + +private: + // This class just "adds" RemoveTextures() to the base class, it's never instantiated. + OpenGLWinGlyphCache() = delete; +}; + +#endif // INCLUDED_VCL_INC_OPENGL_WIN_WINLAYOUT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |