Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
4007df6c
Kaydet (Commit)
4007df6c
authored
Kas 08, 2014
tarafından
Louis-Francis Ratté-Boulianne
Kaydeden (comit)
Markus Mohrhard
Kas 10, 2014
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
vcl: Initial work to have native widgets rendered with OpenGL
Change-Id: I8b244a5bdd12a64a65ca1bab14dfe6917a175ccf
üst
81798ea6
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
350 additions
and
131 deletions
+350
-131
OpenGLHelper.hxx
include/vcl/opengl/OpenGLHelper.hxx
+1
-0
Library_vclplug_gen.mk
vcl/Library_vclplug_gen.mk
+3
-0
gdiimpl.hxx
vcl/inc/opengl/x11/gdiimpl.hxx
+42
-0
openglgdiimpl.hxx
vcl/inc/openglgdiimpl.hxx
+8
-7
salgdiimpl.hxx
vcl/inc/salgdiimpl.hxx
+0
-4
pixmap.hxx
vcl/inc/unx/pixmap.hxx
+2
-0
salgdi.h
vcl/inc/unx/salgdi.h
+2
-0
x11gdiimpl.h
vcl/inc/unx/x11/x11gdiimpl.h
+27
-0
gdiimpl.cxx
vcl/opengl/gdiimpl.cxx
+0
-38
textureFragmentShader.glsl
vcl/opengl/textureFragmentShader.glsl
+1
-1
gdiimpl.cxx
vcl/opengl/x11/gdiimpl.cxx
+139
-0
OpenGLHelper.cxx
vcl/source/opengl/OpenGLHelper.cxx
+50
-0
gdiimpl.cxx
vcl/unx/generic/gdi/gdiimpl.cxx
+57
-4
gdiimpl.hxx
vcl/unx/generic/gdi/gdiimpl.hxx
+9
-7
salgdi.cxx
vcl/unx/generic/gdi/salgdi.cxx
+4
-22
salgdi2.cxx
vcl/unx/generic/gdi/salgdi2.cxx
+5
-48
No files found.
include/vcl/opengl/OpenGLHelper.hxx
Dosyayı görüntüle @
4007df6c
...
@@ -60,6 +60,7 @@ public:
...
@@ -60,6 +60,7 @@ public:
#if defined UNX && !defined MACOSX && !defined IOS && !defined ANDROID
#if defined UNX && !defined MACOSX && !defined IOS && !defined ANDROID
static
bool
GetVisualInfo
(
Display
*
pDisplay
,
int
nScreen
,
XVisualInfo
&
rVI
);
static
bool
GetVisualInfo
(
Display
*
pDisplay
,
int
nScreen
,
XVisualInfo
&
rVI
);
static
GLXFBConfig
GetPixmapFBConfig
(
Display
*
pDisplay
,
bool
&
bInverted
);
#endif
#endif
};
};
...
...
vcl/Library_vclplug_gen.mk
Dosyayı görüntüle @
4007df6c
...
@@ -63,6 +63,8 @@ $(eval $(call gb_Library_add_libs,vclplug_gen,\
...
@@ -63,6 +63,8 @@ $(eval $(call gb_Library_add_libs,vclplug_gen,\
-lXext \
-lXext \
-lSM \
-lSM \
-lICE \
-lICE \
-lGL \
-lGLU \
))
))
$(eval $(call gb_Library_add_exception_objects,vclplug_gen,\
$(eval $(call gb_Library_add_exception_objects,vclplug_gen,\
...
@@ -104,6 +106,7 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_gen,\
...
@@ -104,6 +106,7 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_gen,\
vcl/unx/generic/window/salobj \
vcl/unx/generic/window/salobj \
vcl/unx/x11/x11sys \
vcl/unx/x11/x11sys \
vcl/unx/x11/xlimits \
vcl/unx/x11/xlimits \
vcl/opengl/x11/gdiimpl \
))
))
# ultimately we want to split the x11 dependencies out
# ultimately we want to split the x11 dependencies out
...
...
vcl/inc/opengl/x11/gdiimpl.hxx
0 → 100644
Dosyayı görüntüle @
4007df6c
/* -*- 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_X11_GDIIMPL_HXX
#define INCLUDED_VCL_INC_OPENGL_X11_GDIIMPL_HXX
#include <vcl/dllapi.h>
#include "unx/salgdi.h"
#include "unx/x11/x11gdiimpl.h"
#include "openglgdiimpl.hxx"
class
VCL_PLUGIN_PUBLIC
X11OpenGLSalGraphicsImpl
:
public
OpenGLSalGraphicsImpl
,
public
X11GraphicsImpl
{
private
:
X11SalGraphics
&
mrParent
;
public
:
X11OpenGLSalGraphicsImpl
(
X11SalGraphics
&
rParent
);
virtual
~
X11OpenGLSalGraphicsImpl
();
protected
:
GLfloat
GetWidth
()
const
SAL_OVERRIDE
;
GLfloat
GetHeight
()
const
SAL_OVERRIDE
;
public
:
// implementation of X11GraphicsImpl
void
Init
()
SAL_OVERRIDE
;
X11Pixmap
*
GetPixmapFromScreen
(
const
Rectangle
&
rRect
)
SAL_OVERRIDE
;
bool
RenderPixmapToScreen
(
X11Pixmap
*
pPixmap
,
int
nX
,
int
nY
)
SAL_OVERRIDE
;
};
#endif // INCLUDED_VCL_INC_OPENGL_X11_GDIIMPL_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
vcl/inc/openglgdiimpl.hxx
Dosyayı görüntüle @
4007df6c
...
@@ -30,7 +30,7 @@ class SalVirtualDevice;
...
@@ -30,7 +30,7 @@ class SalVirtualDevice;
class
VCL_PLUGIN_PUBLIC
OpenGLSalGraphicsImpl
:
public
SalGraphicsImpl
class
VCL_PLUGIN_PUBLIC
OpenGLSalGraphicsImpl
:
public
SalGraphicsImpl
{
{
pr
ivate
:
pr
otected
:
OpenGLContext
maContext
;
OpenGLContext
maContext
;
SalFrame
*
mpFrame
;
SalFrame
*
mpFrame
;
...
@@ -55,9 +55,6 @@ private:
...
@@ -55,9 +55,6 @@ private:
GLuint
mnMaskUniform
;
GLuint
mnMaskUniform
;
GLuint
mnMaskColorUniform
;
GLuint
mnMaskColorUniform
;
inline
GLfloat
GetWidth
()
const
;
inline
GLfloat
GetHeight
()
const
;
bool
CreateSolidProgram
(
void
);
bool
CreateSolidProgram
(
void
);
bool
CreateTextureProgram
(
void
);
bool
CreateTextureProgram
(
void
);
bool
CreateMaskedTextureProgram
(
void
);
bool
CreateMaskedTextureProgram
(
void
);
...
@@ -81,6 +78,13 @@ private:
...
@@ -81,6 +78,13 @@ private:
void
DrawTextureWithMask
(
GLuint
nTexture
,
GLuint
nMask
,
const
SalTwoRect
&
rPosAry
);
void
DrawTextureWithMask
(
GLuint
nTexture
,
GLuint
nMask
,
const
SalTwoRect
&
rPosAry
);
void
DrawMask
(
GLuint
nMask
,
SalColor
nMaskColor
,
const
SalTwoRect
&
rPosAry
);
void
DrawMask
(
GLuint
nMask
,
SalColor
nMaskColor
,
const
SalTwoRect
&
rPosAry
);
protected
:
// get the width of the device
virtual
GLfloat
GetWidth
()
const
=
0
;
// get the height of the device
virtual
GLfloat
GetHeight
()
const
=
0
;
public
:
public
:
virtual
~
OpenGLSalGraphicsImpl
();
virtual
~
OpenGLSalGraphicsImpl
();
...
@@ -89,9 +93,6 @@ public:
...
@@ -89,9 +93,6 @@ public:
virtual
void
freeResources
()
SAL_OVERRIDE
;
virtual
void
freeResources
()
SAL_OVERRIDE
;
virtual
void
Init
(
SalFrame
*
pFrame
)
SAL_OVERRIDE
;
virtual
void
Init
(
SalVirtualDevice
*
pVDev
)
SAL_OVERRIDE
;
virtual
bool
setClipRegion
(
const
vcl
::
Region
&
)
SAL_OVERRIDE
;
virtual
bool
setClipRegion
(
const
vcl
::
Region
&
)
SAL_OVERRIDE
;
//
//
// get the depth of the device
// get the depth of the device
...
...
vcl/inc/salgdiimpl.hxx
Dosyayı görüntüle @
4007df6c
...
@@ -44,10 +44,6 @@ public:
...
@@ -44,10 +44,6 @@ public:
virtual
~
SalGraphicsImpl
();
virtual
~
SalGraphicsImpl
();
virtual
void
Init
(
SalFrame
*
pFrame
)
=
0
;
virtual
void
Init
(
SalVirtualDevice
*
pVDev
)
=
0
;
virtual
void
freeResources
()
=
0
;
virtual
void
freeResources
()
=
0
;
virtual
bool
setClipRegion
(
const
vcl
::
Region
&
)
=
0
;
virtual
bool
setClipRegion
(
const
vcl
::
Region
&
)
=
0
;
...
...
vcl/inc/unx/pixmap.hxx
Dosyayı görüntüle @
4007df6c
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
#include <prex.h>
#include <prex.h>
#include <postx.h>
#include <postx.h>
#include <tools/gen.hxx>
#include <unx/saltype.h>
#include <unx/saltype.h>
#include <vclpluginapi.h>
#include <vclpluginapi.h>
...
@@ -27,6 +28,7 @@ public:
...
@@ -27,6 +28,7 @@ public:
Drawable
GetDrawable
()
const
{
return
mpPixmap
;
};
Drawable
GetDrawable
()
const
{
return
mpPixmap
;
};
int
GetWidth
()
const
{
return
mnWidth
;
};
int
GetWidth
()
const
{
return
mnWidth
;
};
int
GetHeight
()
const
{
return
mnHeight
;
};
int
GetHeight
()
const
{
return
mnHeight
;
};
Size
GetSize
()
const
{
return
Size
(
mnWidth
,
mnHeight
);
};
int
GetDepth
()
const
{
return
mnDepth
;
};
int
GetDepth
()
const
{
return
mnDepth
;
};
SalX11Screen
GetScreen
()
const
{
return
mnScreen
;
}
SalX11Screen
GetScreen
()
const
{
return
mnScreen
;
}
...
...
vcl/inc/unx/salgdi.h
Dosyayı görüntüle @
4007df6c
...
@@ -45,6 +45,7 @@ class SalFrame;
...
@@ -45,6 +45,7 @@ class SalFrame;
class
X11Pixmap
;
class
X11Pixmap
;
class
X11SalVirtualDevice
;
class
X11SalVirtualDevice
;
class
X11SalGraphicsImpl
;
class
X11SalGraphicsImpl
;
class
X11OpenGLSalGraphicsImpl
;
class
PspSalPrinter
;
class
PspSalPrinter
;
class
PspSalInfoPrinter
;
class
PspSalInfoPrinter
;
class
ServerFont
;
class
ServerFont
;
...
@@ -63,6 +64,7 @@ class VCLPLUG_GEN_PUBLIC X11SalGraphics : public SalGraphics
...
@@ -63,6 +64,7 @@ class VCLPLUG_GEN_PUBLIC X11SalGraphics : public SalGraphics
{
{
friend
class
ServerFontLayout
;
friend
class
ServerFontLayout
;
friend
class
X11SalGraphicsImpl
;
friend
class
X11SalGraphicsImpl
;
friend
class
X11OpenGLSalGraphicsImpl
;
friend
class
X11CairoTextRender
;
friend
class
X11CairoTextRender
;
private
:
private
:
...
...
vcl/inc/unx/x11/x11gdiimpl.h
0 → 100644
Dosyayı görüntüle @
4007df6c
/* -*- 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_UNX_X11_X11GDIIMPL_HXX
#define INCLUDED_VCL_INC_UNX_X11_X11GDIIMPL_HXX
#include "unx/pixmap.hxx"
class
X11GraphicsImpl
{
public
:
virtual
~
X11GraphicsImpl
()
{};
virtual
void
Init
()
=
0
;
virtual
X11Pixmap
*
GetPixmapFromScreen
(
const
Rectangle
&
rRect
)
=
0
;
virtual
bool
RenderPixmapToScreen
(
X11Pixmap
*
pPixmap
,
int
nX
,
int
nY
)
=
0
;
};
#endif // INCLUDED_VCL_INC_UNX_X11_X11GDIIMPL_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
vcl/opengl/gdiimpl.cxx
Dosyayı görüntüle @
4007df6c
...
@@ -49,16 +49,6 @@ void OpenGLSalGraphicsImpl::freeResources()
...
@@ -49,16 +49,6 @@ void OpenGLSalGraphicsImpl::freeResources()
// Delete shaders, programs and textures if not shared
// Delete shaders, programs and textures if not shared
}
}
void
OpenGLSalGraphicsImpl
::
Init
(
SalFrame
*
pFrame
)
{
mpFrame
=
pFrame
;
}
void
OpenGLSalGraphicsImpl
::
Init
(
SalVirtualDevice
*
pVDev
)
{
mpVDev
=
pVDev
;
}
bool
OpenGLSalGraphicsImpl
::
setClipRegion
(
const
vcl
::
Region
&
rClip
)
bool
OpenGLSalGraphicsImpl
::
setClipRegion
(
const
vcl
::
Region
&
rClip
)
{
{
const
basegfx
::
B2DPolyPolygon
aClip
(
rClip
.
GetAsB2DPolyPolygon
()
);
const
basegfx
::
B2DPolyPolygon
aClip
(
rClip
.
GetAsB2DPolyPolygon
()
);
...
@@ -94,34 +84,6 @@ long OpenGLSalGraphicsImpl::GetGraphicsWidth() const
...
@@ -94,34 +84,6 @@ long OpenGLSalGraphicsImpl::GetGraphicsWidth() const
return
GetWidth
();
return
GetWidth
();
}
}
inline
GLfloat
OpenGLSalGraphicsImpl
::
GetWidth
()
const
{
if
(
mpFrame
)
return
mpFrame
->
maGeometry
.
nWidth
;
else
if
(
mpVDev
)
{
long
nWidth
=
0
;
long
nHeight
=
0
;
mpVDev
->
GetSize
(
nWidth
,
nHeight
);
return
nWidth
;
}
return
1
;
}
inline
GLfloat
OpenGLSalGraphicsImpl
::
GetHeight
()
const
{
if
(
mpFrame
)
return
mpFrame
->
maGeometry
.
nHeight
;
else
if
(
mpVDev
)
{
long
nWidth
=
0
;
long
nHeight
=
0
;
mpVDev
->
GetSize
(
nWidth
,
nHeight
);
return
nHeight
;
}
return
1
;
}
// set the clip region to empty
// set the clip region to empty
void
OpenGLSalGraphicsImpl
::
ResetClipRegion
()
void
OpenGLSalGraphicsImpl
::
ResetClipRegion
()
{
{
...
...
vcl/opengl/textureFragmentShader.glsl
Dosyayı görüntüle @
4007df6c
...
@@ -12,7 +12,7 @@ varying vec2 tex_coord;
...
@@ -12,7 +12,7 @@ varying vec2 tex_coord;
uniform
sampler2D
sampler
;
uniform
sampler2D
sampler
;
void
main
()
{
void
main
()
{
gl_FragColor
=
texture2D
(
sampler
,
tex_coord
);
gl_FragColor
=
texture2D
(
sampler
,
tex_coord
);
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
vcl/opengl/x11/gdiimpl.cxx
0 → 100644
Dosyayı görüntüle @
4007df6c
/* -*- 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 "vcl/salbtype.hxx"
#include "unx/pixmap.hxx"
#include "unx/saldisp.hxx"
#include "unx/salframe.h"
#include "unx/salgdi.h"
#include "unx/salvd.h"
#include "opengl/x11/gdiimpl.hxx"
#include <vcl/opengl/OpenGLContext.hxx>
#include <vcl/opengl/OpenGLHelper.hxx>
X11OpenGLSalGraphicsImpl
::
X11OpenGLSalGraphicsImpl
(
X11SalGraphics
&
rParent
)
:
OpenGLSalGraphicsImpl
(),
mrParent
(
rParent
)
{
}
X11OpenGLSalGraphicsImpl
::~
X11OpenGLSalGraphicsImpl
()
{
}
GLfloat
X11OpenGLSalGraphicsImpl
::
GetWidth
()
const
{
if
(
mrParent
.
m_pFrame
)
return
mrParent
.
m_pFrame
->
maGeometry
.
nWidth
;
else
if
(
mrParent
.
m_pVDev
)
{
long
nWidth
=
0
;
long
nHeight
=
0
;
mrParent
.
m_pVDev
->
GetSize
(
nWidth
,
nHeight
);
return
nWidth
;
}
return
1
;
}
GLfloat
X11OpenGLSalGraphicsImpl
::
GetHeight
()
const
{
if
(
mrParent
.
m_pFrame
)
return
mrParent
.
m_pFrame
->
maGeometry
.
nHeight
;
else
if
(
mrParent
.
m_pVDev
)
{
long
nWidth
=
0
;
long
nHeight
=
0
;
mrParent
.
m_pVDev
->
GetSize
(
nWidth
,
nHeight
);
return
nHeight
;
}
return
1
;
}
void
X11OpenGLSalGraphicsImpl
::
Init
()
{
if
(
mrParent
.
m_pFrame
&&
dynamic_cast
<
X11WindowProvider
*>
(
mrParent
.
m_pFrame
)
)
{
Window
aWin
=
dynamic_cast
<
X11WindowProvider
*>
(
mrParent
.
m_pFrame
)
->
GetX11Window
();
maContext
.
init
(
mrParent
.
GetXDisplay
(),
aWin
,
mrParent
.
m_nXScreen
.
getXScreen
());
}
else
if
(
mrParent
.
m_pVDev
)
{
maContext
.
init
(
mrParent
.
GetXDisplay
(),
mrParent
.
m_pVDev
->
GetDrawable
(),
mrParent
.
m_pVDev
->
GetWidth
(),
mrParent
.
m_pVDev
->
GetHeight
(),
mrParent
.
m_nXScreen
.
getXScreen
()
);
}
else
{
SAL_WARN
(
"vcl.opengl"
,
"what happened here?"
);
}
}
X11Pixmap
*
X11OpenGLSalGraphicsImpl
::
GetPixmapFromScreen
(
const
Rectangle
&
rRect
)
{
Display
*
pDisplay
=
mrParent
.
GetXDisplay
();
SalX11Screen
nScreen
=
mrParent
.
GetScreenNumber
();
SAL_INFO
(
"vcl.opengl"
,
"GetPixmapFromScreen"
);
return
new
X11Pixmap
(
pDisplay
,
nScreen
,
rRect
.
GetWidth
(),
rRect
.
GetHeight
(),
24
);
}
bool
X11OpenGLSalGraphicsImpl
::
RenderPixmapToScreen
(
X11Pixmap
*
pPixmap
,
int
nX
,
int
nY
)
{
const
int
aAttribs
[]
=
{
GLX_TEXTURE_TARGET_EXT
,
GLX_TEXTURE_2D_EXT
,
GLX_TEXTURE_FORMAT_EXT
,
GLX_TEXTURE_FORMAT_RGB_EXT
,
None
};
Display
*
pDisplay
=
mrParent
.
GetXDisplay
();
GLXFBConfig
pFbConfig
;
GLXPixmap
pGlxPixmap
;
GLuint
nTexture
;
SalTwoRect
aPosAry
;
bool
bInverted
;
SAL_INFO
(
"vcl.opengl"
,
"RenderPixmapToScreen ("
<<
nX
<<
" "
<<
nY
<<
")"
);
aPosAry
.
mnSrcX
=
0
;
aPosAry
.
mnSrcY
=
0
;
aPosAry
.
mnDestX
=
nX
;
aPosAry
.
mnDestY
=
nY
;
aPosAry
.
mnSrcWidth
=
aPosAry
.
mnDestWidth
=
pPixmap
->
GetWidth
();
aPosAry
.
mnSrcHeight
=
aPosAry
.
mnDestHeight
=
pPixmap
->
GetHeight
();
XSync
(
pDisplay
,
0
);
pFbConfig
=
OpenGLHelper
::
GetPixmapFBConfig
(
pDisplay
,
bInverted
);
pGlxPixmap
=
glXCreatePixmap
(
pDisplay
,
pFbConfig
,
pPixmap
->
GetPixmap
(),
aAttribs
);
XSync
(
pDisplay
,
0
);
maContext
.
makeCurrent
();
glViewport
(
0
,
0
,
GetWidth
(),
GetHeight
()
);
glGenTextures
(
1
,
&
nTexture
);
glActiveTexture
(
GL_TEXTURE0
);
glBindTexture
(
GL_TEXTURE_2D
,
nTexture
);
//TODO: lfrb: glXGetProc to get the functions
glXBindTexImageEXT
(
pDisplay
,
pGlxPixmap
,
GLX_FRONT_LEFT_EXT
,
NULL
);
glTexParameteri
(
GL_TEXTURE_2D
,
GL_TEXTURE_MIN_FILTER
,
GL_LINEAR
);
glTexParameteri
(
GL_TEXTURE_2D
,
GL_TEXTURE_MAG_FILTER
,
GL_LINEAR
);
DrawTexture
(
nTexture
,
pPixmap
->
GetSize
(),
aPosAry
);
glXReleaseTexImageEXT
(
pDisplay
,
pGlxPixmap
,
GLX_FRONT_LEFT_EXT
);
glDeleteTextures
(
1
,
&
nTexture
);
glXDestroyPixmap
(
pDisplay
,
pGlxPixmap
);
return
true
;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
vcl/source/opengl/OpenGLHelper.cxx
Dosyayı görüntüle @
4007df6c
...
@@ -387,6 +387,56 @@ bool OpenGLHelper::GetVisualInfo(Display* pDisplay, int nScreen, XVisualInfo& rV
...
@@ -387,6 +387,56 @@ bool OpenGLHelper::GetVisualInfo(Display* pDisplay, int nScreen, XVisualInfo& rV
return
true
;
return
true
;
}
}
GLXFBConfig
OpenGLHelper
::
GetPixmapFBConfig
(
Display
*
pDisplay
,
bool
&
bInverted
)
{
int
nScreen
=
DefaultScreen
(
pDisplay
);
GLXFBConfig
*
aFbConfigs
;
int
i
,
nFbConfigs
,
nValue
;
aFbConfigs
=
glXGetFBConfigs
(
pDisplay
,
nScreen
,
&
nFbConfigs
);
for
(
i
=
0
;
i
<
nFbConfigs
;
i
++
)
{
glXGetFBConfigAttrib
(
pDisplay
,
aFbConfigs
[
i
],
GLX_DRAWABLE_TYPE
,
&
nValue
);
if
(
!
(
nValue
&
GLX_PIXMAP_BIT
)
)
continue
;
glXGetFBConfigAttrib
(
pDisplay
,
aFbConfigs
[
i
],
GLX_BIND_TO_TEXTURE_TARGETS_EXT
,
&
nValue
);
if
(
!
(
nValue
&
GLX_TEXTURE_2D_BIT_EXT
)
)
continue
;
glXGetFBConfigAttrib
(
pDisplay
,
aFbConfigs
[
i
],
GLX_DEPTH_SIZE
,
&
nValue
);
if
(
nValue
!=
24
)
continue
;
glXGetFBConfigAttrib
(
pDisplay
,
aFbConfigs
[
i
],
GLX_RED_SIZE
,
&
nValue
);
if
(
nValue
!=
8
)
continue
;
SAL_INFO
(
"vcl.opengl"
,
"Red is "
<<
nValue
);
// TODO: lfrb: Make it configurable wrt RGB/RGBA
glXGetFBConfigAttrib
(
pDisplay
,
aFbConfigs
[
i
],
GLX_BIND_TO_TEXTURE_RGB_EXT
,
&
nValue
);
if
(
nValue
==
False
)
{
glXGetFBConfigAttrib
(
pDisplay
,
aFbConfigs
[
i
],
GLX_BIND_TO_TEXTURE_RGBA_EXT
,
&
nValue
);
if
(
nValue
==
False
)
continue
;
}
glXGetFBConfigAttrib
(
pDisplay
,
aFbConfigs
[
i
],
GLX_Y_INVERTED_EXT
,
&
nValue
);
bInverted
=
(
nValue
==
True
)
?
true
:
false
;
break
;
}
if
(
i
==
nFbConfigs
)
{
SAL_WARN
(
"vcl.opengl"
,
"Unable to find FBconfig for pixmap texturing"
);
return
0
;
}
return
aFbConfigs
[
i
];
}
#endif
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
vcl/unx/generic/gdi/gdiimpl.cxx
Dosyayı görüntüle @
4007df6c
...
@@ -153,16 +153,69 @@ X11SalGraphicsImpl::~X11SalGraphicsImpl()
...
@@ -153,16 +153,69 @@ X11SalGraphicsImpl::~X11SalGraphicsImpl()
{
{
}
}
void
X11SalGraphicsImpl
::
Init
(
SalFrame
*
/*pFrame*/
)
void
X11SalGraphicsImpl
::
Init
()
{
{
mnPenPixel
=
mrParent
.
GetPixel
(
mnPenColor
);
mnPenPixel
=
mrParent
.
GetPixel
(
mnPenColor
);
mnBrushPixel
=
mrParent
.
GetPixel
(
mnBrushColor
);
mnBrushPixel
=
mrParent
.
GetPixel
(
mnBrushColor
);
}
}
void
X11SalGraphicsImpl
::
Init
(
SalVirtualDevice
*
/*pVDev*/
)
X11Pixmap
*
X11SalGraphicsImpl
::
GetPixmapFromScreen
(
const
Rectangle
&
rRect
)
{
{
mnPenPixel
=
mrParent
.
GetPixel
(
mnPenColor
);
//TODO lfrb: don't hardcode the depth
mnBrushPixel
=
mrParent
.
GetPixel
(
mnBrushColor
);
Display
*
pDpy
=
mrParent
.
GetXDisplay
();
X11Pixmap
*
pPixmap
=
new
X11Pixmap
(
pDpy
,
mrParent
.
GetScreenNumber
(),
rRect
.
GetWidth
(),
rRect
.
GetHeight
(),
24
);
GC
aTmpGC
=
XCreateGC
(
pDpy
,
pPixmap
->
GetPixmap
(),
0
,
NULL
);
if
(
!
pPixmap
||
!
aTmpGC
)
{
if
(
pPixmap
)
delete
pPixmap
;
if
(
aTmpGC
)
XFreeGC
(
pDpy
,
aTmpGC
);
SAL_WARN
(
"vcl"
,
"Could not get valid pixmap from screen"
);
return
NULL
;
}
// Copy the background of the screen into a composite pixmap
mrParent
.
CopyScreenArea
(
mrParent
.
GetXDisplay
(),
mrParent
.
GetDrawable
(),
mrParent
.
GetScreenNumber
(),
mrParent
.
GetVisual
().
GetDepth
(),
pPixmap
->
GetDrawable
(),
pPixmap
->
GetScreen
(),
pPixmap
->
GetDepth
(),
aTmpGC
,
rRect
.
Left
(),
rRect
.
Top
(),
rRect
.
GetWidth
(),
rRect
.
GetHeight
(),
0
,
0
);
XFreeGC
(
pDpy
,
aTmpGC
);
return
pPixmap
;
}
bool
X11SalGraphicsImpl
::
RenderPixmapToScreen
(
X11Pixmap
*
pPixmap
,
int
nX
,
int
nY
)
{
GC
aFontGC
=
mrParent
.
GetFontGC
();
// The GC can't be null, otherwise we'd have no clip region
if
(
aFontGC
==
NULL
)
{
SAL_WARN
(
"vcl"
,
"no valid GC to render pixmap"
);
return
false
;
}
if
(
!
pPixmap
)
return
false
;
mrParent
.
CopyScreenArea
(
mrParent
.
GetXDisplay
(),
pPixmap
->
GetDrawable
(),
pPixmap
->
GetScreen
(),
pPixmap
->
GetDepth
(),
mrParent
.
GetDrawable
(),
mrParent
.
m_nXScreen
,
mrParent
.
GetVisual
().
GetDepth
(),
aFontGC
,
0
,
0
,
pPixmap
->
GetWidth
(),
pPixmap
->
GetHeight
(),
nX
,
nY
);
return
true
;
}
}
XID
X11SalGraphicsImpl
::
GetXRenderPicture
()
XID
X11SalGraphicsImpl
::
GetXRenderPicture
()
...
...
vcl/unx/generic/gdi/gdiimpl.hxx
Dosyayı görüntüle @
4007df6c
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
#include <postx.h>
#include <postx.h>
#include "unx/saltype.h"
#include "unx/saltype.h"
#include "unx/x11/x11gdiimpl.h"
#include "salgdiimpl.hxx"
#include "salgdiimpl.hxx"
...
@@ -35,10 +36,8 @@ class SalPolyLine;
...
@@ -35,10 +36,8 @@ class SalPolyLine;
class
X11SalGraphics
;
class
X11SalGraphics
;
class
Gradient
;
class
Gradient
;
class
X11SalGraphicsImpl
:
public
SalGraphicsImpl
class
X11SalGraphicsImpl
:
public
SalGraphicsImpl
,
public
X11GraphicsImpl
{
{
friend
X11SalGraphics
;
private
:
private
:
X11SalGraphics
&
mrParent
;
X11SalGraphics
&
mrParent
;
...
@@ -108,10 +107,6 @@ public:
...
@@ -108,10 +107,6 @@ public:
virtual
~
X11SalGraphicsImpl
();
virtual
~
X11SalGraphicsImpl
();
virtual
void
Init
(
SalFrame
*
pFrame
)
SAL_OVERRIDE
;
virtual
void
Init
(
SalVirtualDevice
*
pVDev
)
SAL_OVERRIDE
;
virtual
bool
setClipRegion
(
const
vcl
::
Region
&
)
SAL_OVERRIDE
;
virtual
bool
setClipRegion
(
const
vcl
::
Region
&
)
SAL_OVERRIDE
;
//
//
// get the depth of the device
// get the depth of the device
...
@@ -269,6 +264,13 @@ public:
...
@@ -269,6 +264,13 @@ public:
virtual
bool
drawGradient
(
const
tools
::
PolyPolygon
&
rPolygon
,
const
Gradient
&
rGradient
)
SAL_OVERRIDE
;
virtual
bool
drawGradient
(
const
tools
::
PolyPolygon
&
rPolygon
,
const
Gradient
&
rGradient
)
SAL_OVERRIDE
;
virtual
bool
swapBuffers
()
SAL_OVERRIDE
{
return
false
;
}
virtual
bool
swapBuffers
()
SAL_OVERRIDE
{
return
false
;
}
public
:
// implementation of X11GraphicsImpl
void
Init
()
SAL_OVERRIDE
;
X11Pixmap
*
GetPixmapFromScreen
(
const
Rectangle
&
rRect
)
SAL_OVERRIDE
;
bool
RenderPixmapToScreen
(
X11Pixmap
*
pPixmap
,
int
nX
,
int
nY
)
SAL_OVERRIDE
;
};
};
#endif
#endif
...
...
vcl/unx/generic/gdi/salgdi.cxx
Dosyayı görüntüle @
4007df6c
...
@@ -48,13 +48,14 @@
...
@@ -48,13 +48,14 @@
#include "unx/salgdi.h"
#include "unx/salgdi.h"
#include "unx/salframe.h"
#include "unx/salframe.h"
#include "unx/salvd.h"
#include "unx/salvd.h"
#include "unx/x11/x11gdiimpl.h"
#include <unx/x11/xlimits.hxx>
#include <unx/x11/xlimits.hxx>
#include "salgdiimpl.hxx"
#include "salgdiimpl.hxx"
#include "unx/x11windowprovider.hxx"
#include "unx/x11windowprovider.hxx"
#include "textrender.hxx"
#include "textrender.hxx"
#include "gdiimpl.hxx"
#include "gdiimpl.hxx"
#include "openglgdiimpl.hxx"
#include "opengl
/x11/
gdiimpl.hxx"
#include "x11cairotextrender.hxx"
#include "x11cairotextrender.hxx"
#include "generic/printergfx.hxx"
#include "generic/printergfx.hxx"
...
@@ -86,7 +87,7 @@ X11SalGraphics::X11SalGraphics():
...
@@ -86,7 +87,7 @@ X11SalGraphics::X11SalGraphics():
static
bool
bOpenGLPossible
=
OpenGLHelper
::
supportsVCLOpenGL
();
static
bool
bOpenGLPossible
=
OpenGLHelper
::
supportsVCLOpenGL
();
bool
bUseOpenGL
=
bOpenGLPossible
?
officecfg
::
Office
::
Common
::
VCL
::
UseOpenGL
::
get
()
:
false
;
bool
bUseOpenGL
=
bOpenGLPossible
?
officecfg
::
Office
::
Common
::
VCL
::
UseOpenGL
::
get
()
:
false
;
if
(
bUseOpenGL
)
if
(
bUseOpenGL
)
mpImpl
.
reset
(
new
OpenGLSalGraphicsImpl
(
));
mpImpl
.
reset
(
new
X11OpenGLSalGraphicsImpl
(
*
this
));
else
else
mpImpl
.
reset
(
new
X11SalGraphicsImpl
(
*
this
));
mpImpl
.
reset
(
new
X11SalGraphicsImpl
(
*
this
));
...
@@ -142,26 +143,7 @@ void X11SalGraphics::SetDrawable( Drawable aDrawable, SalX11Screen nXScreen )
...
@@ -142,26 +143,7 @@ void X11SalGraphics::SetDrawable( Drawable aDrawable, SalX11Screen nXScreen )
if
(
hDrawable_
)
if
(
hDrawable_
)
{
{
OpenGLSalGraphicsImpl
*
pOpenGLImpl
=
dynamic_cast
<
OpenGLSalGraphicsImpl
*>
(
mpImpl
.
get
());
dynamic_cast
<
X11GraphicsImpl
*>
(
mpImpl
.
get
())
->
Init
();
if
(
pOpenGLImpl
)
{
if
(
m_pFrame
&&
dynamic_cast
<
X11WindowProvider
*>
(
m_pFrame
))
{
Window
aWin
=
dynamic_cast
<
X11WindowProvider
*>
(
m_pFrame
)
->
GetX11Window
();
pOpenGLImpl
->
GetOpenGLContext
().
init
(
GetXDisplay
(),
aWin
,
m_nXScreen
.
getXScreen
());
mpImpl
->
Init
(
m_pFrame
);
}
else
if
(
m_pVDev
)
{
pOpenGLImpl
->
GetOpenGLContext
().
init
(
GetXDisplay
(),
m_pVDev
->
GetDrawable
(),
m_pVDev
->
GetWidth
(),
m_pVDev
->
GetHeight
(),
m_nXScreen
.
getXScreen
());
mpImpl
->
Init
(
m_pVDev
);
}
else
SAL_WARN
(
"vcl.opengl"
,
"what happened here?"
);
}
// TODO: moggi: FIXME nTextPixel_ = GetPixel( nTextColor_ );
// TODO: moggi: FIXME nTextPixel_ = GetPixel( nTextColor_ );
}
}
}
}
...
...
vcl/unx/generic/gdi/salgdi2.cxx
Dosyayı görüntüle @
4007df6c
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
#include "unx/salgdi.h"
#include "unx/salgdi.h"
#include "unx/salframe.h"
#include "unx/salframe.h"
#include "unx/salvd.h"
#include "unx/salvd.h"
#include "unx/x11/x11gdiimpl.h"
#include <unx/x11/xlimits.hxx>
#include <unx/x11/xlimits.hxx>
#include "xrender_peer.hxx"
#include "xrender_peer.hxx"
...
@@ -84,59 +85,15 @@ void X11SalGraphics::CopyScreenArea( Display* pDisplay,
...
@@ -84,59 +85,15 @@ void X11SalGraphics::CopyScreenArea( Display* pDisplay,
X11Pixmap
*
X11SalGraphics
::
GetPixmapFromScreen
(
const
Rectangle
&
rRect
)
X11Pixmap
*
X11SalGraphics
::
GetPixmapFromScreen
(
const
Rectangle
&
rRect
)
{
{
Display
*
pDpy
=
GetXDisplay
();
X11GraphicsImpl
*
pImpl
=
dynamic_cast
<
X11GraphicsImpl
*>
(
mpImpl
.
get
());
X11Pixmap
*
pPixmap
=
new
X11Pixmap
(
pDpy
,
GetScreenNumber
(),
rRect
.
GetWidth
(),
rRect
.
GetHeight
(),
24
);
return
pImpl
->
GetPixmapFromScreen
(
rRect
);
GC
aTmpGC
=
XCreateGC
(
pDpy
,
pPixmap
->
GetPixmap
(),
0
,
NULL
);
if
(
!
pPixmap
||
!
aTmpGC
)
{
if
(
pPixmap
)
delete
pPixmap
;
if
(
aTmpGC
)
XFreeGC
(
pDpy
,
aTmpGC
);
SAL_WARN
(
"vcl"
,
"Could not get valid pixmap from screen"
);
return
NULL
;
}
// Copy the background of the screen into a composite pixmap
CopyScreenArea
(
GetXDisplay
(),
GetDrawable
(),
GetScreenNumber
(),
GetVisual
().
GetDepth
(),
pPixmap
->
GetDrawable
(),
pPixmap
->
GetScreen
(),
pPixmap
->
GetDepth
(),
aTmpGC
,
rRect
.
Left
(),
rRect
.
Top
(),
rRect
.
GetWidth
(),
rRect
.
GetHeight
(),
0
,
0
);
XFreeGC
(
pDpy
,
aTmpGC
);
return
pPixmap
;
}
}
bool
X11SalGraphics
::
RenderPixmapToScreen
(
X11Pixmap
*
pPixmap
,
int
nX
,
int
nY
)
bool
X11SalGraphics
::
RenderPixmapToScreen
(
X11Pixmap
*
pPixmap
,
int
nX
,
int
nY
)
{
{
SAL_INFO
(
"vcl"
,
"RenderPixmapToScreen"
);
SAL_INFO
(
"vcl"
,
"RenderPixmapToScreen"
);
/*if( UseOpenGL() )
X11GraphicsImpl
*
pImpl
=
dynamic_cast
<
X11GraphicsImpl
*>
(
mpImpl
.
get
());
{
return
pImpl
->
RenderPixmapToScreen
(
pPixmap
,
nX
,
nY
);
X11OpenGLTexture pTexture( pPixmap );
pTexture.Draw( nX, nY );
return true;
}*/
GC
aFontGC
=
GetFontGC
();
// The GC can't be null, otherwise we'd have no clip region
if
(
aFontGC
==
NULL
)
{
SAL_WARN
(
"vcl"
,
"no valid GC to render pixmap"
);
return
false
;
}
if
(
!
pPixmap
)
return
false
;
CopyScreenArea
(
GetXDisplay
(),
pPixmap
->
GetDrawable
(),
pPixmap
->
GetScreen
(),
pPixmap
->
GetDepth
(),
GetDrawable
(),
m_nXScreen
,
GetVisual
().
GetDepth
(),
aFontGC
,
0
,
0
,
pPixmap
->
GetWidth
(),
pPixmap
->
GetHeight
(),
nX
,
nY
);
return
true
;
}
}
extern
"C"
extern
"C"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment