diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2019-09-20 14:55:44 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2019-11-27 09:55:05 +0100 |
commit | 534d89fed30983bcc48387facc3410f13e230683 (patch) | |
tree | 68655d6fc7f3b66a43b0e3cd3687678515526bbe /vcl/unx | |
parent | 736e7ceee814eac3689e588b5032fe29cc229bf7 (diff) |
move opengl vcl files to opengl/
Better to have all of them together rather than scattered.
Change-Id: I1f8bbfb7018a6c28c87e4dfa2acbf4efde62894b
Diffstat (limited to 'vcl/unx')
-rw-r--r-- | vcl/unx/generic/gdi/openglx11cairotextrender.cxx | 84 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/openglx11cairotextrender.hxx | 27 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/salgdi.cxx | 4 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/x11cairotextrender.cxx | 3 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/x11cairotextrender.hxx | 46 |
5 files changed, 4 insertions, 160 deletions
diff --git a/vcl/unx/generic/gdi/openglx11cairotextrender.cxx b/vcl/unx/generic/gdi/openglx11cairotextrender.cxx deleted file mode 100644 index 4175634348b7..000000000000 --- a/vcl/unx/generic/gdi/openglx11cairotextrender.cxx +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- 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/. - */ - -#include "openglx11cairotextrender.hxx" - -#include <openglgdiimpl.hxx> - -#include <cairo.h> - -OpenGLX11CairoTextRender::OpenGLX11CairoTextRender(X11SalGraphics& rParent) - : X11CairoTextRender(rParent) -{ -} - -cairo_t* OpenGLX11CairoTextRender::getCairoContext() -{ - cairo_surface_t* surface = nullptr; - OpenGLSalGraphicsImpl *pImpl = dynamic_cast< OpenGLSalGraphicsImpl* >(mrParent.GetImpl()); - if( pImpl ) - { - tools::Rectangle aClipRect = pImpl->getClipRegion().GetBoundRect(); - if( aClipRect.GetWidth() == 0 || aClipRect.GetHeight() == 0 ) - { - aClipRect.setWidth( GetWidth() ); - aClipRect.setHeight( GetHeight() ); - } - surface = cairo_image_surface_create( CAIRO_FORMAT_ARGB32, aClipRect.GetWidth(), aClipRect.GetHeight() ); - } - if (!surface) - return nullptr; - cairo_t *cr = cairo_create(surface); - cairo_surface_destroy(surface); - return cr; -} - -void OpenGLX11CairoTextRender::getSurfaceOffset( double& nDX, double& nDY ) -{ - OpenGLSalGraphicsImpl *pImpl = dynamic_cast< OpenGLSalGraphicsImpl* >(mrParent.GetImpl()); - if( pImpl ) - { - tools::Rectangle aClipRect = pImpl->getClipRegion().GetBoundRect(); - nDX = -aClipRect.Left(); - nDY = -aClipRect.Top(); - } -} - -void OpenGLX11CairoTextRender::releaseCairoContext(cairo_t* cr) -{ - // XXX: lfrb: GLES 2.0 doesn't support GL_UNSIGNED_INT_8_8_8_8_REV - OpenGLSalGraphicsImpl *pImpl = dynamic_cast< OpenGLSalGraphicsImpl* >(mrParent.GetImpl()); - if(!pImpl) - { - cairo_destroy(cr); - return; - } - - cairo_surface_t* pSurface = cairo_get_target(cr); - int nWidth = cairo_image_surface_get_width( pSurface ); - int nHeight = cairo_image_surface_get_height( pSurface ); - cairo_surface_flush(pSurface); - unsigned char *pSrc = cairo_image_surface_get_data( pSurface ); - - // XXX: lfrb: GLES 2.0 doesn't support GL_UNSIGNED_INT_8_8_8_8_REV - tools::Rectangle aClipRect = pImpl->getClipRegion().GetBoundRect(); - - SalTwoRect aRect(0, 0, nWidth, nHeight, - aClipRect.Left(), aClipRect.Top(), nWidth, nHeight); - - // Cairo surface data is ARGB with premultiplied alpha and is Y-inverted - OpenGLTexture aTexture( nWidth, nHeight, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, pSrc ); - pImpl->PreDraw(); - pImpl->DrawAlphaTexture( aTexture, aRect, true, true ); - pImpl->PostDraw(); - - cairo_destroy(cr); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/gdi/openglx11cairotextrender.hxx b/vcl/unx/generic/gdi/openglx11cairotextrender.hxx deleted file mode 100644 index 46a11cba5a0e..000000000000 --- a/vcl/unx/generic/gdi/openglx11cairotextrender.hxx +++ /dev/null @@ -1,27 +0,0 @@ -/* -*- 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_UNX_GENERIC_GDI_OPENGLX11CAIROTEXTRENDER_HXX -#define INCLUDED_VCL_UNX_GENERIC_GDI_OPENGLX11CAIROTEXTRENDER_HXX - -#include "x11cairotextrender.hxx" - -class OpenGLX11CairoTextRender : public X11CairoTextRender -{ -public: - explicit OpenGLX11CairoTextRender(X11SalGraphics& rParent); - - virtual cairo_t* getCairoContext() override; - virtual void getSurfaceOffset(double& nDX, double& nDY) override; - virtual void releaseCairoContext(cairo_t* cr) override; -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx index fc5f3c394a30..5c1999661783 100644 --- a/vcl/unx/generic/gdi/salgdi.cxx +++ b/vcl/unx/generic/gdi/salgdi.cxx @@ -45,8 +45,8 @@ #include <salvd.hxx> #include "gdiimpl.hxx" #include <opengl/x11/gdiimpl.hxx> -#include "x11cairotextrender.hxx" -#include "openglx11cairotextrender.hxx" +#include <unx/x11/x11cairotextrender.hxx> +#include <opengl/x11/cairotextrender.hxx> #include <unx/x11/xrender_peer.hxx> #include "cairo_xlib_cairo.hxx" diff --git a/vcl/unx/generic/gdi/x11cairotextrender.cxx b/vcl/unx/generic/gdi/x11cairotextrender.cxx index 426a5222e143..91f82ac84b21 100644 --- a/vcl/unx/generic/gdi/x11cairotextrender.cxx +++ b/vcl/unx/generic/gdi/x11cairotextrender.cxx @@ -17,7 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "x11cairotextrender.hxx" +#include <unx/x11/x11cairotextrender.hxx> + #include <unx/glyphcache.hxx> #include <X11/Xregion.h> #include <cairo.h> diff --git a/vcl/unx/generic/gdi/x11cairotextrender.hxx b/vcl/unx/generic/gdi/x11cairotextrender.hxx deleted file mode 100644 index 666f09f8c0c9..000000000000 --- a/vcl/unx/generic/gdi/x11cairotextrender.hxx +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- 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_UNX_GENERIC_GDI_X11CAIROTEXTRENDER_HXX -#define INCLUDED_VCL_UNX_GENERIC_GDI_X11CAIROTEXTRENDER_HXX - -#include <unx/cairotextrender.hxx> -#include <unx/salgdi.h> - -class X11CairoTextRender : public CairoTextRender -{ -protected: - X11SalGraphics& mrParent; - -protected: - size_t GetWidth() const; - size_t GetHeight() const; - -public: - explicit X11CairoTextRender(X11SalGraphics& rParent); - - virtual cairo_t* getCairoContext() override; - virtual void getSurfaceOffset(double& nDX, double& nDY) override; - virtual void clipRegion(cairo_t* cr) override; - virtual void releaseCairoContext(cairo_t* cr) override; -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |