[Libreoffice-commits] core.git: Branch 'feature/opengl-vcl' - vcl/inc vcl/opengl

2014-11-13 Thread Louis-Francis Ratté-Boulianne
 vcl/inc/openglgdiimpl.hxx|1 
 vcl/opengl/gdiimpl.cxx   |   67 +++
 vcl/opengl/linearGradientFragmentShader.glsl |2 
 3 files changed, 69 insertions(+), 1 deletion(-)

New commits:
commit fdbc95ee2a80b3660802cea5ac40e2032d78e15f
Author: Louis-Francis Ratté-Boulianne 
Date:   Fri Nov 14 01:16:28 2014 -0500

vcl: Implement axial gradients in OpenGL backend

Change-Id: I93b8c3c076c79d992d467b01ca5f5eca1ed626d3

diff --git a/vcl/inc/openglgdiimpl.hxx b/vcl/inc/openglgdiimpl.hxx
index 65ec12e..fa88a2a 100644
--- a/vcl/inc/openglgdiimpl.hxx
+++ b/vcl/inc/openglgdiimpl.hxx
@@ -108,6 +108,7 @@ public:
 void DrawTextureWithMask( OpenGLTexture& rTexture, OpenGLTexture& rMask, 
const SalTwoRect& rPosAry );
 void DrawMask( OpenGLTexture& rTexture, SalColor nMaskColor, const 
SalTwoRect& rPosAry );
 void DrawLinearGradient( const Gradient& rGradient, const Rectangle& rRect 
);
+void DrawAxialGradient( const Gradient& rGradient, const Rectangle& rRect 
);
 void DrawRadialGradient( const Gradient& rGradient, const Rectangle& rRect 
);
 
 public:
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index 0c47f33..09e80f8 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -772,6 +772,68 @@ void OpenGLSalGraphicsImpl::DrawLinearGradient( const 
Gradient& rGradient, const
 CHECK_GL_ERROR();
 }
 
+void OpenGLSalGraphicsImpl::DrawAxialGradient( const Gradient& rGradient, 
const Rectangle& rRect )
+{
+if( mnLinearGradientProgram == 0 )
+{
+if( !CreateLinearGradientProgram() )
+return;
+}
+
+glUseProgram( mnLinearGradientProgram );
+
+Color aStartCol = rGradient.GetStartColor();
+Color aEndCol = rGradient.GetEndColor();
+long nFactor = rGradient.GetStartIntensity();
+glUniformColorIntensity( mnLinearGradientStartColorUniform, aStartCol, 
nFactor );
+nFactor = rGradient.GetEndIntensity();
+glUniformColorIntensity( mnLinearGradientEndColorUniform, aEndCol, nFactor 
);
+
+/**
+ * Draw two rectangles with linear gradient.
+ *
+ *  1 *---* 2
+ *|  /|
+ *| / | Points 0 and 3 have start color
+ *  0 |/__| 3   Points 1, 2, 4 and 5 have end color
+ *|\  |
+ *| \ |
+ *|  \|
+ *  5 *---* 4
+ *
+ */
+
+Rectangle aRect;
+Point aCenter;
+rGradient.GetBoundRect( rRect, aRect, aCenter );
+
+// determine points 0 and 3
+Point aPt0( aRect.Left(), (aRect.Top() + aRect.Bottom() + 1) / 2 );
+Point aPt3( aRect.Right(), (aRect.Top() + aRect.Bottom() + 1) / 2 );
+
+Polygon aPoly( 7 );
+aPoly.SetPoint( aPt0,0 );
+aPoly.SetPoint( aRect.TopLeft(), 1 );
+aPoly.SetPoint( aRect.TopRight(),2 );
+aPoly.SetPoint( aPt3,3 );
+aPoly.SetPoint( aRect.BottomRight(), 4 );
+aPoly.SetPoint( aRect.BottomLeft(),  5 );
+aPoly.SetPoint( aPt0,6 );
+aPoly.Rotate( aCenter, rGradient.GetAngle() % 3600 );
+
+GLfloat aTexCoord[12] = { 0, 1, 1, 0, 2, 0, 3, 1, 4, 0, 5, 0 };
+GLfloat fMin = 1.0 - 100.0 / (100.0 - rGradient.GetBorder());
+aTexCoord[3] = aTexCoord[5] = aTexCoord[9] = aTexCoord[11] = fMin;
+glEnableVertexAttribArray( GL_ATTRIB_TEX );
+glVertexAttribPointer( GL_ATTRIB_TEX, 2, GL_FLOAT, GL_FALSE, 0, aTexCoord 
);
+
+DrawConvexPolygon( aPoly );
+
+glDisableVertexAttribArray( GL_ATTRIB_TEX );
+glUseProgram( 0 );
+CHECK_GL_ERROR();
+}
+
 void OpenGLSalGraphicsImpl::DrawRadialGradient( const Gradient& rGradient, 
const Rectangle& rRect )
 {
 if( mnRadialGradientProgram == 0 )
@@ -1365,6 +1427,7 @@ bool OpenGLSalGraphicsImpl::drawGradient(const 
tools::PolyPolygon& rPolyPoly,
 return true;
 
 if( rGradient.GetStyle() != GradientStyle_LINEAR &&
+rGradient.GetStyle() != GradientStyle_AXIAL &&
 rGradient.GetStyle() != GradientStyle_RADIAL )
 return false;
 
@@ -1402,6 +1465,10 @@ bool OpenGLSalGraphicsImpl::drawGradient(const 
tools::PolyPolygon& rPolyPoly,
 {
 DrawLinearGradient( rGradient, aBoundRect );
 }
+else if( rGradient.GetStyle() == GradientStyle_AXIAL )
+{
+DrawAxialGradient( rGradient, aBoundRect );
+}
 else if( rGradient.GetStyle() == GradientStyle_RADIAL )
 {
 DrawRadialGradient( rGradient, aBoundRect );
diff --git a/vcl/opengl/linearGradientFragmentShader.glsl 
b/vcl/opengl/linearGradientFragmentShader.glsl
index 7b84c06..bd1137c 100644
--- a/vcl/opengl/linearGradientFragmentShader.glsl
+++ b/vcl/opengl/linearGradientFragmentShader.glsl
@@ -16,7 +16,7 @@ varying vec2   tex_coord;
 
 void main(void)
 {
-gl_FragColor = mix(start_color, end_color,
+gl_FragColor = mix(end_color, start_color,
 clamp(tex_coord.t, 0.0, 1.0));
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.

[Libreoffice-commits] core.git: Branch 'feature/opengl-vcl' - vcl/inc vcl/opengl vcl/unx vcl/win

2014-11-13 Thread Louis-Francis Ratté-Boulianne
 vcl/inc/openglgdiimpl.hxx|4 +-
 vcl/opengl/gdiimpl.cxx   |   16 ++--
 vcl/unx/generic/gdi/openglx11cairotextrender.cxx |   45 +--
 vcl/win/source/gdi/winlayout.cxx |6 +--
 4 files changed, 29 insertions(+), 42 deletions(-)

New commits:
commit eefe932a05e2d8744242a1a715c4cd963f796646
Author: Louis-Francis Ratté-Boulianne 
Date:   Thu Nov 13 22:24:35 2014 -0500

vcl: Add DrawAlphaTexture to directly render Cairo surface

Change-Id: I7aa824578b14999d0ef667a5bcfccd731f1d3b64

diff --git a/vcl/inc/openglgdiimpl.hxx b/vcl/inc/openglgdiimpl.hxx
index 0d91d48..65ec12e 100644
--- a/vcl/inc/openglgdiimpl.hxx
+++ b/vcl/inc/openglgdiimpl.hxx
@@ -85,6 +85,7 @@ protected:
 bool CreateLinearGradientProgram( void );
 bool CreateRadialGradientProgram( void );
 
+public:
 void BeginSolid( SalColor nColor, sal_uInt8 nTransparency );
 void BeginSolid( SalColor nColor, double fTransparency );
 void BeginSolid( SalColor nColor );
@@ -103,12 +104,13 @@ protected:
 void DrawPolyPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon );
 void DrawTextureRect( OpenGLTexture& rTexture, const SalTwoRect& rPosAry, 
bool bInverted = false );
 void DrawTexture( OpenGLTexture& rTexture, const SalTwoRect& rPosAry, bool 
bInverted = false );
+void DrawAlphaTexture( OpenGLTexture& rTexture, const SalTwoRect& rPosAry, 
bool bInverted = false, bool pPremultiplied = false );
 void DrawTextureWithMask( OpenGLTexture& rTexture, OpenGLTexture& rMask, 
const SalTwoRect& rPosAry );
 void DrawMask( OpenGLTexture& rTexture, SalColor nMaskColor, const 
SalTwoRect& rPosAry );
 void DrawLinearGradient( const Gradient& rGradient, const Rectangle& rRect 
);
 void DrawRadialGradient( const Gradient& rGradient, const Rectangle& rRect 
);
 
-protected:
+public:
 // get the width of the device
 virtual GLfloat GetWidth() const = 0;
 
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index d05b08b..0c47f33 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -670,6 +670,17 @@ void OpenGLSalGraphicsImpl::DrawTexture( OpenGLTexture& 
rTexture, const SalTwoRe
 CHECK_GL_ERROR();
 }
 
+void OpenGLSalGraphicsImpl::DrawAlphaTexture( OpenGLTexture& rTexture, const 
SalTwoRect& rPosAry, bool bInverted, bool bPremultiplied )
+{
+glEnable( GL_BLEND );
+if( bPremultiplied )
+glBlendFunc( GL_ONE, GL_ONE_MINUS_SRC_ALPHA );
+else
+glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
+DrawTexture( rTexture, rPosAry, bInverted );
+glDisable( GL_BLEND );
+}
+
 void OpenGLSalGraphicsImpl::DrawTextureWithMask( OpenGLTexture& rTexture, 
OpenGLTexture& rMask, const SalTwoRect& pPosAry )
 {
 if( mnMaskedTextureProgram == 0 )
@@ -1301,10 +1312,7 @@ bool OpenGLSalGraphicsImpl::drawAlphaBitmap(
 
 SAL_INFO( "vcl.opengl", "::drawAlphaBitmap" );
 PreDraw();
-glEnable( GL_BLEND );
-glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
-DrawTexture( rTexture, rPosAry );
-glDisable( GL_BLEND );
+DrawAlphaTexture( rTexture, rPosAry );
 PostDraw();
 
 CHECK_GL_ERROR();
diff --git a/vcl/unx/generic/gdi/openglx11cairotextrender.cxx 
b/vcl/unx/generic/gdi/openglx11cairotextrender.cxx
index 36a76b0..38a7213 100644
--- a/vcl/unx/generic/gdi/openglx11cairotextrender.cxx
+++ b/vcl/unx/generic/gdi/openglx11cairotextrender.cxx
@@ -9,6 +9,7 @@
 
 #include "openglx11cairotextrender.hxx"
 
+#include "openglgdiimpl.hxx"
 #include "salbmp.hxx"
 #include 
 
@@ -33,40 +34,8 @@ void OpenGLX11CairoTextRender::drawSurface(cairo_t* cr)
 cairo_surface_t* pSurface = cairo_get_target(cr);
 int nWidth = cairo_image_surface_get_width( pSurface );
 int nHeight = cairo_image_surface_get_height( pSurface );
-SalBitmap* pBitmap = ImplGetSVData()->mpDefInst->CreateSalBitmap();
-pBitmap->Create(Size(nWidth, nHeight), 32, BitmapPalette());
-
 cairo_surface_flush( pSurface );
-BitmapBuffer* pBuffer = pBitmap->AcquireBuffer(false);
 unsigned char *pSrc = cairo_image_surface_get_data( pSurface );
-unsigned int nSrcStride = cairo_image_surface_get_stride( pSurface );
-unsigned int nDestStride = pBuffer->mnScanlineSize;
-for( unsigned long y = 0; y < (unsigned long) nHeight; y++ )
-{
-// Cairo surface is y-inverse
-sal_uInt32 *pSrcPix = (sal_uInt32 *)(pSrc + nSrcStride * (nHeight - y 
- 1));
-sal_uInt32 *pDestPix = (sal_uInt32 *)(pBuffer->mpBits + nDestStride * 
y);
-for( unsigned long x = 0; x < (unsigned long) nWidth; x++ )
-{
-sal_uInt8 nAlpha = (*pSrcPix >> 24);
-sal_uInt8 nR = (*pSrcPix >> 16) & 0xff;
-sal_uInt8 nG = (*pSrcPix >> 8) & 0xff;
-sal_uInt8 nB = *pSrcPix & 0xff;
-if( nAlpha != 0 && nAlpha != 255 )
-{
-// Cairo uses pre-multiplied alpha - we do not => re-multiply
- 

[Libreoffice-commits] core.git: Branch 'feature/opengl-vcl' - vcl/inc vcl/Library_vcl.mk vcl/win

2014-11-13 Thread Jan Holesovsky
 vcl/Library_vcl.mk   |1 
 vcl/inc/cairotextrender.hxx  |2 
 vcl/inc/textrender.hxx   |7 -
 vcl/inc/win/salgdi.h |   23 -
 vcl/inc/wintextrender.hxx|  140 +++
 vcl/win/source/gdi/salgdi.cxx|   30 +--
 vcl/win/source/gdi/salgdi3.cxx   |  131 ++--
 vcl/win/source/gdi/winlayout.cxx |8 +-
 vcl/win/source/gdi/wintextrender.cxx |   64 
 9 files changed, 330 insertions(+), 76 deletions(-)

New commits:
commit 309257ddadfdc3e46506036ed81f6e0695211ebe
Author: Jan Holesovsky 
Date:   Thu Nov 13 13:18:46 2014 +0100

vcl: Abstract the Windows text rendering into a TextRenderImpl descendant.

Change-Id: I7ee9d7e705bb0344ba59c3edd10ed85390636cd4

diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 81f774a..f15e5b6 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -660,6 +660,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
 vcl/win/source/gdi/salprn \
 vcl/win/source/gdi/salvd \
 vcl/win/source/gdi/winlayout \
+vcl/win/source/gdi/wintextrender \
 vcl/win/source/gdi/wntgdi \
 vcl/win/source/window/salframe \
 vcl/win/source/window/keynames \
diff --git a/vcl/inc/cairotextrender.hxx b/vcl/inc/cairotextrender.hxx
index e5db2ab..ea995bb 100644
--- a/vcl/inc/cairotextrender.hxx
+++ b/vcl/inc/cairotextrender.hxx
@@ -79,7 +79,7 @@ protected:
 virtual cairo_surface_t* getCairoSurface() = 0;
 virtual void drawSurface(cairo_t* cr) = 0;
 
-bool setFont( const FontSelectPattern *pEntry, int nFallbackLevel );
+bool setFont(const FontSelectPattern *pEntry, int nFallbackLevel);
 
 virtual void clipRegion(cairo_t* cr) = 0;
 
diff --git a/vcl/inc/textrender.hxx b/vcl/inc/textrender.hxx
index b18b630..a004143 100644
--- a/vcl/inc/textrender.hxx
+++ b/vcl/inc/textrender.hxx
@@ -17,8 +17,8 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_VCL_INC_UNX_CAIROFONTIMPL_HXX
-#define INCLUDED_VCL_INC_UNX_CAIROFONTIMPL_HXX
+#ifndef INCLUDED_VCL_INC_TEXTRENDER_HXX
+#define INCLUDED_VCL_INC_TEXTRENDER_HXX
 
 #include 
 #include 
@@ -29,9 +29,6 @@
 #include "salglyphid.hxx"
 #include "fontsubset.hxx"
 
-class PspSalPrinter;
-class PspSalInfoPrinter;
-class ServerFont;
 class ImplLayoutArgs;
 class ServerFontLayout;
 class PhysicalFontCollection;
diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h
index 69ea4cf..18709e1 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -25,7 +25,9 @@
 #include "outfont.hxx"
 #include "PhysicalFontFace.hxx"
 #include "impfont.hxx"
+#include 
 #include 
+#include 
 
 #include 
 #include 
@@ -148,6 +150,7 @@ class WinSalGraphics : public SalGraphics
 friend class ScopedFont;
 private:
 boost::scoped_ptr mpImpl;
+boost::scoped_ptr mpTextRenderImpl;
 
 HDC mhLocalDC;  // HDC
 boolmbPrinter : 1;  // is Printer
@@ -156,26 +159,13 @@ private:
 boolmbScreen : 1;   // is Screen compatible
 HWNDmhWnd;  // Window-Handle, when 
Window-Graphics
 
-HFONT   mhFonts[ MAX_FALLBACK ];// Font + Fallbacks
-const ImplWinFontData*  mpWinFontData[ MAX_FALLBACK ];  // pointer to the 
most recent font face
-ImplWinFontEntry*   mpWinFontEntry[ MAX_FALLBACK ]; // pointer to the 
most recent font instance
-float   mfFontScale[ MAX_FALLBACK ];// allows 
metrics emulation of huge font sizes
-float   mfCurrentFontScale;
 HRGNmhRegion;   // vcl::Region Handle
 HPENmhDefPen;   // DefaultPen
 HBRUSH  mhDefBrush; // DefaultBrush
-HFONT   mhDefFont;  // DefaultFont
 HPALETTEmhDefPal;   // DefaultPalette
 COLORREFmnTextColor;// TextColor
 RGNDATA*mpClipRgnData;  // ClipRegion-Data
 RGNDATA*mpStdClipRgnData;   // Cache 
Standard-ClipRegion-Data
-LOGFONTA*   mpLogFont;  // LOG-Font which is currently 
selected (only W9x)
-ImplFontAttrCache*  mpFontAttrCache;// Cache font attributes from 
files in so/share/fonts
-BYTE*   mpFontCharSets; // All Charsets for the 
current font
-BYTEmnFontCharSetCount; // Number of Charsets of the 
current font; 0 - if not queried
-boolmbFontKernInit; // FALSE: FontKerns must be 
queried
-KERNINGPAIR*mpFontKernPairs;// Kerning Pairs of the 
current Font
-sal_uIntPtr mnFontKernPairCount;// Number of Kerning Pairs 
of the current Font
 int mnPenWidth; // Linienbreite
 
 public:
@@ -28

[Libreoffice-commits] core.git: Branch 'feature/opengl-vcl' - vcl/inc vcl/opengl vcl/Package_opengl.mk

2014-11-11 Thread Louis-Francis Ratté-Boulianne
 vcl/Package_opengl.mk|1 
 vcl/inc/openglgdiimpl.hxx|9 +-
 vcl/opengl/gdiimpl.cxx   |  118 ++-
 vcl/opengl/radialGradientFragmentShader.glsl |   23 +
 4 files changed, 132 insertions(+), 19 deletions(-)

New commits:
commit f0565838389b4a0495450c3aa2ff09b0ca91e143
Author: Louis-Francis Ratté-Boulianne 
Date:   Tue Nov 11 15:54:03 2014 -0500

vcl: Add support for radial gradients in OpenGL backend

Change-Id: Ie47fb18ae7d5286fe7559c7dffbc54b0856d4d8e

diff --git a/vcl/Package_opengl.mk b/vcl/Package_opengl.mk
index da40d71..18c56fc 100644
--- a/vcl/Package_opengl.mk
+++ b/vcl/Package_opengl.mk
@@ -16,6 +16,7 @@ $(eval $(call 
gb_Package_add_files,vcl_opengl_shader,$(LIBO_ETC_FOLDER)/opengl,\
maskVertexShader.glsl \
maskedTextureFragmentShader.glsl \
maskedTextureVertexShader.glsl \
+   radialGradientFragmentShader.glsl \
solidFragmentShader.glsl \
solidVertexShader.glsl \
textureFragmentShader.glsl \
diff --git a/vcl/inc/openglgdiimpl.hxx b/vcl/inc/openglgdiimpl.hxx
index 535bc72..f80c969 100644
--- a/vcl/inc/openglgdiimpl.hxx
+++ b/vcl/inc/openglgdiimpl.hxx
@@ -63,13 +63,18 @@ protected:
 GLuint mnLinearGradientProgram;
 GLuint mnLinearGradientStartColorUniform;
 GLuint mnLinearGradientEndColorUniform;
-GLuint mnLinearGradientTransformUniform;
+
+GLuint mnRadialGradientProgram;
+GLuint mnRadialGradientStartColorUniform;
+GLuint mnRadialGradientEndColorUniform;
+GLuint mnRadialGradientCenterUniform;
 
 bool CreateSolidProgram( void );
 bool CreateTextureProgram( void );
 bool CreateMaskedTextureProgram( void );
 bool CreateMaskProgram( void );
 bool CreateLinearGradientProgram( void );
+bool CreateRadialGradientProgram( void );
 
 void BeginSolid( SalColor nColor, sal_uInt8 nTransparency );
 void BeginSolid( SalColor nColor, double fTransparency );
@@ -84,6 +89,7 @@ protected:
 void DrawConvexPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry );
 void DrawConvexPolygon( const Polygon& rPolygon );
 void DrawRect( long nX, long nY, long nWidth, long nHeight );
+void DrawRect( const Rectangle& rRect );
 void DrawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry );
 void DrawPolyPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon );
 void DrawTextureRect( const Size& rSize, const SalTwoRect& rPosAry, bool 
bInverted = false );
@@ -91,6 +97,7 @@ protected:
 void DrawTextureWithMask( GLuint nTexture, GLuint nMask, const Size& 
rSize, const SalTwoRect& rPosAry );
 void DrawMask( GLuint nMask, SalColor nMaskColor, const SalTwoRect& 
rPosAry );
 void DrawLinearGradient( const Gradient& rGradient, const Rectangle& rRect 
);
+void DrawRadialGradient( const Gradient& rGradient, const Rectangle& rRect 
);
 
 protected:
 // get the width of the device
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index 752741e..777cfa3 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -75,6 +75,13 @@ OpenGLSalGraphicsImpl::OpenGLSalGraphicsImpl()
 , mnMaskProgram(0)
 , mnMaskUniform(0)
 , mnMaskColorUniform(0)
+, mnLinearGradientProgram(0)
+, mnLinearGradientStartColorUniform(0)
+, mnLinearGradientEndColorUniform(0)
+, mnRadialGradientProgram(0)
+, mnRadialGradientStartColorUniform(0)
+, mnRadialGradientEndColorUniform(0)
+, mnRadialGradientCenterUniform(0)
 {
 }
 
@@ -295,7 +302,20 @@ bool OpenGLSalGraphicsImpl::CreateLinearGradientProgram( 
void )
 glBindAttribLocation( mnTextureProgram, GL_ATTRIB_TEX, "tex_coord_in" );
 mnLinearGradientStartColorUniform = glGetUniformLocation( 
mnLinearGradientProgram, "start_color" );
 mnLinearGradientEndColorUniform = glGetUniformLocation( 
mnLinearGradientProgram, "end_color" );
-mnLinearGradientTransformUniform = glGetUniformLocation( 
mnLinearGradientProgram, "transform" );
+return true;
+}
+
+bool OpenGLSalGraphicsImpl::CreateRadialGradientProgram( void )
+{
+mnRadialGradientProgram = OpenGLHelper::LoadShaders( 
"textureVertexShader", "radialGradientFragmentShader" );
+if( mnRadialGradientProgram == 0 )
+return false;
+
+glBindAttribLocation( mnTextureProgram, GL_ATTRIB_POS, "position" );
+glBindAttribLocation( mnTextureProgram, GL_ATTRIB_TEX, "tex_coord_in" );
+mnRadialGradientStartColorUniform = glGetUniformLocation( 
mnRadialGradientProgram, "start_color" );
+mnRadialGradientEndColorUniform = glGetUniformLocation( 
mnRadialGradientProgram, "end_color" );
+mnRadialGradientCenterUniform = glGetUniformLocation( 
mnRadialGradientProgram, "center" );
 return true;
 }
 
@@ -455,6 +475,18 @@ void OpenGLSalGraphicsImpl::DrawRect( long nX, long nY, 
long nWidth, long nHeigh
 DrawConvexPolygon( 4, aPoints );
 }
 
+void OpenGLSalGraphicsImpl::DrawRect( const Rectangle& rRect )
+{
+long nX1

[Libreoffice-commits] core.git: Branch 'feature/opengl-vcl' - vcl/inc vcl/opengl

2014-11-11 Thread Louis-Francis Ratté-Boulianne
 vcl/inc/openglgdiimpl.hxx  |4 ++--
 vcl/opengl/gdiimpl.cxx |   19 ++-
 vcl/opengl/x11/gdiimpl.cxx |   33 +++--
 3 files changed, 47 insertions(+), 9 deletions(-)

New commits:
commit 9ce55489da514d2769227c7b9904da1fdf216f21
Author: Louis-Francis Ratté-Boulianne 
Date:   Tue Nov 11 13:43:56 2014 -0500

vcl: Read back OpenGL FBO to create offscreen X11 pixmap

Change-Id: I330e7d62bf31b4a90b5866d9531f073f7c69c92a

diff --git a/vcl/inc/openglgdiimpl.hxx b/vcl/inc/openglgdiimpl.hxx
index c9e8b68..535bc72 100644
--- a/vcl/inc/openglgdiimpl.hxx
+++ b/vcl/inc/openglgdiimpl.hxx
@@ -86,8 +86,8 @@ protected:
 void DrawRect( long nX, long nY, long nWidth, long nHeight );
 void DrawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry );
 void DrawPolyPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon );
-void DrawTextureRect( const Size& rSize, const SalTwoRect& rPosAry );
-void DrawTexture( GLuint nTexture, const Size& rSize, const SalTwoRect& 
rPosAry );
+void DrawTextureRect( const Size& rSize, const SalTwoRect& rPosAry, bool 
bInverted = false );
+void DrawTexture( GLuint nTexture, const Size& rSize, const SalTwoRect& 
rPosAry, bool bInverted = false );
 void DrawTextureWithMask( GLuint nTexture, GLuint nMask, const Size& 
rSize, const SalTwoRect& rPosAry );
 void DrawMask( GLuint nMask, SalColor nMaskColor, const SalTwoRect& 
rPosAry );
 void DrawLinearGradient( const Gradient& rGradient, const Rectangle& rRect 
);
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index 7d76819..752741e 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -503,14 +503,23 @@ void OpenGLSalGraphicsImpl::DrawPolyPolygon( const 
basegfx::B2DPolyPolygon& rPol
 glDisableVertexAttribArray( GL_ATTRIB_POS );
 }
 
-void OpenGLSalGraphicsImpl::DrawTextureRect( const Size& rSize, const 
SalTwoRect& rPosAry )
+void OpenGLSalGraphicsImpl::DrawTextureRect( const Size& rSize, const 
SalTwoRect& rPosAry, bool bInverted )
 {
 GLfloat aTexCoord[8];
 
 aTexCoord[0] = aTexCoord[2] = rPosAry.mnSrcX / (double) rSize.Width();
 aTexCoord[4] = aTexCoord[6] = (rPosAry.mnSrcX + rPosAry.mnSrcWidth) / 
(double) rSize.Width();
-aTexCoord[3] = aTexCoord[5] = (rSize.Height() - rPosAry.mnSrcY) / (double) 
rSize.Height();
-aTexCoord[1] = aTexCoord[7] = (rSize.Height() - rPosAry.mnSrcY - 
rPosAry.mnSrcHeight) / (double) rSize.Height();
+
+if( !bInverted )
+{
+aTexCoord[3] = aTexCoord[5] = (rSize.Height() - rPosAry.mnSrcY) / 
(double) rSize.Height();
+aTexCoord[1] = aTexCoord[7] = (rSize.Height() - rPosAry.mnSrcY - 
rPosAry.mnSrcHeight) / (double) rSize.Height();
+}
+else
+{
+aTexCoord[1] = aTexCoord[7] = (rSize.Height() - rPosAry.mnSrcY) / 
(double) rSize.Height();
+aTexCoord[3] = aTexCoord[5] = (rSize.Height() - rPosAry.mnSrcY - 
rPosAry.mnSrcHeight) / (double) rSize.Height();
+}
 
 glEnableVertexAttribArray( GL_ATTRIB_TEX );
 glVertexAttribPointer( GL_ATTRIB_TEX, 2, GL_FLOAT, GL_FALSE, 0, aTexCoord 
);
@@ -520,7 +529,7 @@ void OpenGLSalGraphicsImpl::DrawTextureRect( const Size& 
rSize, const SalTwoRect
 glDisableVertexAttribArray( GL_ATTRIB_TEX );
 }
 
-void OpenGLSalGraphicsImpl::DrawTexture( GLuint nTexture, const Size& rSize, 
const SalTwoRect& pPosAry )
+void OpenGLSalGraphicsImpl::DrawTexture( GLuint nTexture, const Size& rSize, 
const SalTwoRect& pPosAry, bool bInverted )
 {
 if( mnTextureProgram == 0 )
 {
@@ -534,7 +543,7 @@ void OpenGLSalGraphicsImpl::DrawTexture( GLuint nTexture, 
const Size& rSize, con
 CHECK_GL_ERROR();
 glBindTexture( GL_TEXTURE_2D, nTexture );
 
-DrawTextureRect( rSize, pPosAry );
+DrawTextureRect( rSize, pPosAry, bInverted );
 CHECK_GL_ERROR();
 
 glBindTexture( GL_TEXTURE_2D, 0 );
diff --git a/vcl/opengl/x11/gdiimpl.cxx b/vcl/opengl/x11/gdiimpl.cxx
index 6e803bd..13b7049 100644
--- a/vcl/opengl/x11/gdiimpl.cxx
+++ b/vcl/opengl/x11/gdiimpl.cxx
@@ -83,9 +83,38 @@ X11Pixmap* X11OpenGLSalGraphicsImpl::GetPixmapFromScreen( 
const Rectangle& rRect
 {
 Display* pDisplay = mrParent.GetXDisplay();
 SalX11Screen nScreen = mrParent.GetScreenNumber();
+XVisualInfo aVisualInfo;
+X11Pixmap* pPixmap;
+XImage* pImage;
+sal_uInt8* pData;
 
 SAL_INFO( "vcl.opengl", "GetPixmapFromScreen" );
-return new X11Pixmap( pDisplay, nScreen, rRect.GetWidth(), 
rRect.GetHeight(), 24 );
+// TODO: lfrb: Use context depth
+pPixmap = new X11Pixmap( pDisplay, nScreen, rRect.GetWidth(), 
rRect.GetHeight(), 24 );
+
+if( !OpenGLHelper::GetVisualInfo( pDisplay, nScreen.getXScreen(), 
aVisualInfo ) )
+return pPixmap;
+
+// make sure everything is synced up before reading back
+maContext.makeCurrent();
+glXWaitX();
+
+// TODO: lfrb: What if offscreen?
+pData = new sal_uInt8[rRect.GetWidth() * rRect.GetHeight() * 4];
+glPixelStorei( GL_PACK_ALIGNM

[Libreoffice-commits] core.git: Branch 'feature/opengl-vcl' - vcl/inc vcl/opengl vcl/Package_opengl.mk

2014-11-11 Thread Louis-Francis Ratté-Boulianne
 vcl/Package_opengl.mk|1 
 vcl/inc/openglgdiimpl.hxx|9 ++
 vcl/opengl/gdiimpl.cxx   |  111 ++-
 vcl/opengl/linearGradientFragmentShader.glsl |   23 +
 4 files changed, 142 insertions(+), 2 deletions(-)

New commits:
commit 2e9e71ca3ece1cba70b6b12d0aa0d67bb0b89caf
Author: Louis-Francis Ratté-Boulianne 
Date:   Tue Nov 11 05:13:40 2014 -0500

vcl: Add initial support for linear gradient with OpenGL

Change-Id: Iccc12c94bfd68387dfc0161a5fde4f595edda0e1

diff --git a/vcl/Package_opengl.mk b/vcl/Package_opengl.mk
index 79dabb7..da40d71 100644
--- a/vcl/Package_opengl.mk
+++ b/vcl/Package_opengl.mk
@@ -11,6 +11,7 @@ $(eval $(call 
gb_Package_Package,vcl_opengl_shader,$(SRCDIR)/vcl/opengl))
 
 $(eval $(call 
gb_Package_add_files,vcl_opengl_shader,$(LIBO_ETC_FOLDER)/opengl,\
convolutionFragmentShader.glsl \
+   linearGradientFragmentShader.glsl \
maskFragmentShader.glsl \
maskVertexShader.glsl \
maskedTextureFragmentShader.glsl \
diff --git a/vcl/inc/openglgdiimpl.hxx b/vcl/inc/openglgdiimpl.hxx
index 6f920e5..c9e8b68 100644
--- a/vcl/inc/openglgdiimpl.hxx
+++ b/vcl/inc/openglgdiimpl.hxx
@@ -25,6 +25,7 @@
 
 #include "opengl/texture.hxx"
 
+#include 
 #include 
 
 class SalFrame;
@@ -59,10 +60,16 @@ protected:
 GLuint mnMaskUniform;
 GLuint mnMaskColorUniform;
 
+GLuint mnLinearGradientProgram;
+GLuint mnLinearGradientStartColorUniform;
+GLuint mnLinearGradientEndColorUniform;
+GLuint mnLinearGradientTransformUniform;
+
 bool CreateSolidProgram( void );
 bool CreateTextureProgram( void );
 bool CreateMaskedTextureProgram( void );
 bool CreateMaskProgram( void );
+bool CreateLinearGradientProgram( void );
 
 void BeginSolid( SalColor nColor, sal_uInt8 nTransparency );
 void BeginSolid( SalColor nColor, double fTransparency );
@@ -75,6 +82,7 @@ protected:
 void DrawLine( long nX1, long nY1, long nX2, long nY2 );
 void DrawLines( sal_uInt32 nPoints, const SalPoint* pPtAry, bool bClose );
 void DrawConvexPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry );
+void DrawConvexPolygon( const Polygon& rPolygon );
 void DrawRect( long nX, long nY, long nWidth, long nHeight );
 void DrawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry );
 void DrawPolyPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon );
@@ -82,6 +90,7 @@ protected:
 void DrawTexture( GLuint nTexture, const Size& rSize, const SalTwoRect& 
rPosAry );
 void DrawTextureWithMask( GLuint nTexture, GLuint nMask, const Size& 
rSize, const SalTwoRect& rPosAry );
 void DrawMask( GLuint nMask, SalColor nMaskColor, const SalTwoRect& 
rPosAry );
+void DrawLinearGradient( const Gradient& rGradient, const Rectangle& rRect 
);
 
 protected:
 // get the width of the device
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index 5856fb8..b00fa41 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -51,6 +51,13 @@
  ((float) SALCOLOR_BLUE( nColor )) / 255,  \
  (1.0f - fTransparency) )
 
+#define glUniformColorIntensity(nUniform, aColor, nFactor)  \
+glUniform4f( nUniform,  \
+ ((float) aColor.GetRed()) * nFactor / 25500.0,   \
+ ((float) aColor.GetGreen()) * nFactor / 25500.0, \
+ ((float) aColor.GetBlue()) * nFactor / 25500.0,  \
+ 1.0f )
+
 OpenGLSalGraphicsImpl::OpenGLSalGraphicsImpl()
 : mpFrame(NULL)
 , mbOffscreen(false)
@@ -278,6 +285,20 @@ bool OpenGLSalGraphicsImpl::CreateMaskProgram( void )
 return true;
 }
 
+bool OpenGLSalGraphicsImpl::CreateLinearGradientProgram( void )
+{
+mnLinearGradientProgram = OpenGLHelper::LoadShaders( 
"textureVertexShader", "linearGradientFragmentShader" );
+if( mnLinearGradientProgram == 0 )
+return false;
+
+glBindAttribLocation( mnTextureProgram, GL_ATTRIB_POS, "position" );
+glBindAttribLocation( mnTextureProgram, GL_ATTRIB_TEX, "tex_coord_in" );
+mnLinearGradientStartColorUniform = glGetUniformLocation( 
mnLinearGradientProgram, "start_color" );
+mnLinearGradientEndColorUniform = glGetUniformLocation( 
mnLinearGradientProgram, "end_color" );
+mnLinearGradientTransformUniform = glGetUniformLocation( 
mnLinearGradientProgram, "transform" );
+return true;
+}
+
 void OpenGLSalGraphicsImpl::BeginSolid( SalColor nColor, sal_uInt8 
nTransparency )
 {
 if( mnSolidProgram == 0 )
@@ -403,6 +424,25 @@ void OpenGLSalGraphicsImpl::DrawConvexPolygon( sal_uInt32 
nPoints, const SalPoin
 glDisableVertexAttribArray( GL_ATTRIB_POS );
 }
 
+void OpenGLSalGraphicsImpl::DrawConvexPolygon( const Polygon& rPolygon )
+{
+sal_uInt16 nPoints = rPolygon.GetSize() - 1;
+std::vector aVertices(nPoints * 2);
+sal_uInt32 i, j;
+
+for( i = 0, j = 0; i < nPoints; i++, j += 2 )

[Libreoffice-commits] core.git: Branch 'feature/opengl-vcl' - vcl/inc vcl/opengl

2014-11-11 Thread Jan Holesovsky
 vcl/inc/openglgdiimpl.hxx |1 +
 vcl/opengl/gdiimpl.cxx|   21 +
 2 files changed, 22 insertions(+)

New commits:
commit 9754b88b627b7391e3daf75a67f280014a7eab03
Author: Jan Holesovsky 
Date:   Tue Nov 11 10:24:37 2014 +0100

windows opengl: We need a constructor for OpenGLSalGraphicsImpl.

Otherwise we a get random value in mnSolidProgram, and we never initialize
that.

Change-Id: Ic648a1f6755021da25f5b9da306cf600a3f0c739

diff --git a/vcl/inc/openglgdiimpl.hxx b/vcl/inc/openglgdiimpl.hxx
index 56938b9..6f920e5 100644
--- a/vcl/inc/openglgdiimpl.hxx
+++ b/vcl/inc/openglgdiimpl.hxx
@@ -101,6 +101,7 @@ protected:
 
 
 public:
+OpenGLSalGraphicsImpl();
 virtual ~OpenGLSalGraphicsImpl ();
 
 OpenGLContext& GetOpenGLContext() { return maContext; }
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index 85252ef..5856fb8 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -51,6 +51,26 @@
  ((float) SALCOLOR_BLUE( nColor )) / 255,  \
  (1.0f - fTransparency) )
 
+OpenGLSalGraphicsImpl::OpenGLSalGraphicsImpl()
+: mpFrame(NULL)
+, mbOffscreen(false)
+, mnFramebufferId(0)
+, mpOffscreenTex(NULL)
+, mnLineColor(SALCOLOR_NONE)
+, mnFillColor(SALCOLOR_NONE)
+, mnSolidProgram(0)
+, mnColorUniform(0)
+, mnTextureProgram(0)
+, mnSamplerUniform(0)
+, mnMaskedTextureProgram(0)
+, mnMaskedSamplerUniform(0)
+, mnMaskSamplerUniform(0)
+, mnMaskProgram(0)
+, mnMaskUniform(0)
+, mnMaskColorUniform(0)
+{
+}
+
 OpenGLSalGraphicsImpl::~OpenGLSalGraphicsImpl()
 {
 }
@@ -209,6 +229,7 @@ void OpenGLSalGraphicsImpl::SetOffscreen( bool bOffscreen )
 
 bool OpenGLSalGraphicsImpl::CreateSolidProgram( void )
 {
+SAL_INFO( "vcl.opengl", "::CreateSolidProgram" );
 mnSolidProgram = OpenGLHelper::LoadShaders( "solidVertexShader", 
"solidFragmentShader" );
 if( mnSolidProgram == 0 )
 return false;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/opengl-vcl' - vcl/inc vcl/opengl vcl/unx

2014-11-10 Thread Louis-Francis Ratté-Boulianne
 vcl/inc/openglgdiimpl.hxx|5 ++
 vcl/inc/salgdiimpl.hxx   |5 ++
 vcl/inc/unx/salgdi.h |4 +
 vcl/opengl/gdiimpl.cxx   |   17 +++
 vcl/unx/generic/gdi/gdiimpl.cxx  |6 ++
 vcl/unx/generic/gdi/gdiimpl.hxx  |4 +
 vcl/unx/generic/gdi/openglx11cairotextrender.cxx |   53 +++
 vcl/unx/generic/gdi/salgdi2.cxx  |6 ++
 8 files changed, 91 insertions(+), 9 deletions(-)

New commits:
commit 6fad1cfc18b084ac2974fc07c81208b1d4ab631a
Author: Louis-Francis Ratté-Boulianne 
Date:   Mon Nov 10 23:30:02 2014 -0500

vcl: Fix text rendering with OpenGL

Change-Id: I7784fa81cb6f9a3d6437b2b628c37e7895c84733

diff --git a/vcl/inc/openglgdiimpl.hxx b/vcl/inc/openglgdiimpl.hxx
index 5a11952..56938b9 100644
--- a/vcl/inc/openglgdiimpl.hxx
+++ b/vcl/inc/openglgdiimpl.hxx
@@ -242,6 +242,11 @@ public:
 const SalBitmap& rSourceBitmap,
 const SalBitmap& rAlphaBitmap ) SAL_OVERRIDE;
 
+/** Render 32-bits bitmap with alpha channel */
+virtual bool drawAlphaBitmap(
+const SalTwoRect&,
+const SalBitmap& rBitmap ) SAL_OVERRIDE;
+
 /** draw transformed bitmap (maybe with alpha) where Null, X, Y define the 
coordinate system */
 virtual bool drawTransformedBitmap(
 const basegfx::B2DPoint& rNull,
diff --git a/vcl/inc/salgdiimpl.hxx b/vcl/inc/salgdiimpl.hxx
index 5d49952..4b4b735 100644
--- a/vcl/inc/salgdiimpl.hxx
+++ b/vcl/inc/salgdiimpl.hxx
@@ -181,6 +181,11 @@ public:
 const SalBitmap& rSourceBitmap,
 const SalBitmap& rAlphaBitmap ) = 0;
 
+/** Render 32-bits bitmap with alpha channel */
+virtual bool drawAlphaBitmap(
+const SalTwoRect&,
+const SalBitmap& rBitmap ) = 0;
+
 /** draw transformed bitmap (maybe with alpha) where Null, X, Y define the 
coordinate system */
 virtual bool drawTransformedBitmap(
 const basegfx::B2DPoint& rNull,
diff --git a/vcl/inc/unx/salgdi.h b/vcl/inc/unx/salgdi.h
index c288292..d532668 100644
--- a/vcl/inc/unx/salgdi.h
+++ b/vcl/inc/unx/salgdi.h
@@ -252,6 +252,10 @@ public:
 virtual booldrawAlphaBitmap( const SalTwoRect&,
  const SalBitmap& rSourceBitmap,
  const SalBitmap& rAlphaBitmap ) 
SAL_OVERRIDE;
+
+virtual booldrawAlphaBitmap( const SalTwoRect&,
+ const SalBitmap& rBitmap );
+
 virtual bool drawTransformedBitmap(
 const basegfx::B2DPoint& rNull,
 const basegfx::B2DPoint& rX,
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index 6413283..8c06769 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -1007,6 +1007,23 @@ bool OpenGLSalGraphicsImpl::drawAlphaBitmap(
 return true;
 }
 
+bool OpenGLSalGraphicsImpl::drawAlphaBitmap(
+const SalTwoRect& rPosAry,
+const SalBitmap& rSalBitmap )
+{
+const OpenGLSalBitmap& rBitmap = static_cast(rSalBitmap);
+const GLuint nTexture( rBitmap.GetTexture( maContext ) );
+
+SAL_INFO( "vcl.opengl", "::drawAlphaBitmap" );
+PreDraw();
+glEnable( GL_BLEND );
+glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
+DrawTexture( nTexture, rBitmap.GetSize(), rPosAry );
+glDisable( GL_BLEND );
+PostDraw();
+return true;
+}
+
 /** draw transformed bitmap (maybe with alpha) where Null, X, Y define the 
coordinate system */
 bool OpenGLSalGraphicsImpl::drawTransformedBitmap(
 const basegfx::B2DPoint& /*rNull*/,
diff --git a/vcl/unx/generic/gdi/gdiimpl.cxx b/vcl/unx/generic/gdi/gdiimpl.cxx
index 172ebd6..0f210b3 100644
--- a/vcl/unx/generic/gdi/gdiimpl.cxx
+++ b/vcl/unx/generic/gdi/gdiimpl.cxx
@@ -955,6 +955,12 @@ bool X11SalGraphicsImpl::drawAlphaBitmap( const 
SalTwoRect& rTR,
 return true;
 }
 
+bool X11SalGraphicsImpl::drawAlphaBitmap( const SalTwoRect& /*rTR*/,
+const SalBitmap& /*rBitmap*/ )
+{
+return false;
+}
+
 bool X11SalGraphicsImpl::drawTransformedBitmap(
 const basegfx::B2DPoint& rNull,
 const basegfx::B2DPoint& rX,
diff --git a/vcl/unx/generic/gdi/gdiimpl.hxx b/vcl/unx/generic/gdi/gdiimpl.hxx
index 252fe35..e6bfa86 100644
--- a/vcl/unx/generic/gdi/gdiimpl.hxx
+++ b/vcl/unx/generic/gdi/gdiimpl.hxx
@@ -242,6 +242,10 @@ public:
 const SalBitmap& rSourceBitmap,
 const SalBitmap& rAlphaBitmap ) SAL_OVERRIDE;
 
+virtual bool drawAlphaBitmap(
+const SalTwoRect&,
+const SalBitmap& rBitmap ) SAL_OVERRIDE;
+
 /** draw transformed bitmap (maybe with alpha) where Null, X, Y define the 
coordinate system */
 virtual bool drawTransformedBitmap(
 const basegfx::B2DPoint& rNull,
diff --git a/vcl/unx/ge

[Libreoffice-commits] core.git: Branch 'feature/opengl-vcl' - vcl/inc vcl/Library_vcl.mk vcl/opengl vcl/win

2014-11-09 Thread Markus Mohrhard
 vcl/Library_vcl.mk |1 +
 vcl/inc/opengl/win/gdiimpl.hxx |   34 ++
 vcl/opengl/win/gdiimpl.cxx |   28 
 vcl/win/source/gdi/salgdi.cxx  |4 ++--
 4 files changed, 65 insertions(+), 2 deletions(-)

New commits:
commit e413f745080328f38a0746f137b89692a39105fc
Author: Markus Mohrhard 
Date:   Mon Nov 10 00:42:48 2014 +0100

fix windows build

Change-Id: I4f8d4f9393b931f7593486f8e1fadee7ad35902a

diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index efe0986..81f774a 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -644,6 +644,7 @@ endif
 
 ifeq ($(OS),WNT)
 $(eval $(call gb_Library_add_exception_objects,vcl,\
+   vcl/opengl/win/gdiimpl \
 vcl/win/source/app/saldata \
 vcl/win/source/app/salinfo \
 vcl/win/source/app/salinst \
diff --git a/vcl/inc/opengl/win/gdiimpl.hxx b/vcl/inc/opengl/win/gdiimpl.hxx
new file mode 100644
index 000..0af7089
--- /dev/null
+++ b/vcl/inc/opengl/win/gdiimpl.hxx
@@ -0,0 +1,34 @@
+/* -*- 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 
+
+#include "openglgdiimpl.hxx"
+
+class WinOpenGLSalGraphicsImpl : public OpenGLSalGraphicsImpl
+{
+private:
+
+public:
+WinOpenGLSalGraphicsImpl();
+
+protected:
+virtual GLfloat GetWidth() const SAL_OVERRIDE;
+virtual GLfloat GetHeight() const SAL_OVERRIDE;
+
+public:
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/opengl/win/gdiimpl.cxx b/vcl/opengl/win/gdiimpl.cxx
new file mode 100644
index 000..17868c8
--- /dev/null
+++ b/vcl/opengl/win/gdiimpl.cxx
@@ -0,0 +1,28 @@
+/* -*- 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 "opengl/win/gdiimpl.hxx"
+
+WinOpenGLSalGraphicsImpl::WinOpenGLSalGraphicsImpl()
+{
+}
+
+GLfloat WinOpenGLSalGraphicsImpl::GetWidth() const
+{
+
+return 1;
+}
+
+GLfloat WinOpenGLSalGraphicsImpl::GetHeight() const
+{
+
+return 1;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/win/source/gdi/salgdi.cxx b/vcl/win/source/gdi/salgdi.cxx
index f185955..28394b5 100644
--- a/vcl/win/source/gdi/salgdi.cxx
+++ b/vcl/win/source/gdi/salgdi.cxx
@@ -34,7 +34,7 @@
 
 #include "salgdiimpl.hxx"
 #include "gdiimpl.hxx"
-#include "openglgdiimpl.hxx"
+#include "opengl/win/gdiimpl.hxx"
 
 #include 
 
@@ -592,7 +592,7 @@ WinSalGraphics::WinSalGraphics(WinSalGraphics::Type eType, 
bool bScreen, HWND hW
 static bool bOpenGLPossible = OpenGLHelper::supportsVCLOpenGL();
 bool bUseOpenGL = bOpenGLPossible && !mbPrinter ? 
officecfg::Office::Common::VCL::UseOpenGL::get() : false;
 if (bUseOpenGL)
-mpImpl.reset(new OpenGLSalGraphicsImpl());
+mpImpl.reset(new WinOpenGLSalGraphicsImpl());
 else
 mpImpl.reset(new WinSalGraphicsImpl(*this));
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/opengl-vcl' - vcl/inc

2014-10-28 Thread Markus Mohrhard
 vcl/inc/unx/x11windowprovider.hxx |   28 
 1 file changed, 28 insertions(+)

New commits:
commit f1f2c46e03c38861bcd2583ed1e04996a6815994
Author: Markus Mohrhard 
Date:   Tue Oct 28 14:18:03 2014 +0100

add missing header

Change-Id: I3378c7c0bfdf5a6901e4ce8ecc4ae807a0d893eb

diff --git a/vcl/inc/unx/x11windowprovider.hxx 
b/vcl/inc/unx/x11windowprovider.hxx
new file mode 100644
index 000..776c8e4
--- /dev/null
+++ b/vcl/inc/unx/x11windowprovider.hxx
@@ -0,0 +1,28 @@
+/* -*- 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_X11WINDOWPROVIDER
+#define INCLUDED_VCL_UNX_X11WINDOWPROVIDER
+
+#include 
+#include 
+
+#include 
+
+class VCL_PLUGIN_PUBLIC X11WindowProvider
+{
+public:
+virtual ~X11WindowProvider();
+
+virtual Window GetX11Window() = 0;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/opengl-vcl' - vcl/inc vcl/unx

2014-10-23 Thread Markus Mohrhard
 vcl/inc/openglgdiimpl.hxx  |3 ++-
 vcl/unx/generic/gdi/salgdi.cxx |4 
 2 files changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 13af2f5b06a6c5d744c22357dc373d74bea4ab28
Author: Markus Mohrhard 
Date:   Thu Oct 23 23:32:04 2014 +0200

integrate WIP OpenGL rendering to unix backend

for now can be enabled with USE_OPENGL environment variable

Change-Id: I3d2c49c3a1cf0c06678b22addcab95c846bb7bf9

diff --git a/vcl/inc/openglgdiimpl.hxx b/vcl/inc/openglgdiimpl.hxx
index 1384c6f..fcdd776 100644
--- a/vcl/inc/openglgdiimpl.hxx
+++ b/vcl/inc/openglgdiimpl.hxx
@@ -21,8 +21,9 @@
 #define INCLUDED_VCL_OPENGLGDIIMPL_HXX
 
 #include "salgdiimpl.hxx"
+#include 
 
-class OpenGLSalGraphicsImpl : public SalGraphicsImpl
+class VCL_PLUGIN_PUBLIC OpenGLSalGraphicsImpl : public SalGraphicsImpl
 {
 public:
 virtual ~OpenGLSalGraphicsImpl ();
diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx
index b824bbc..67b5ff2 100644
--- a/vcl/unx/generic/gdi/salgdi.cxx
+++ b/vcl/unx/generic/gdi/salgdi.cxx
@@ -52,6 +52,7 @@
 
 #include "salgdiimpl.hxx"
 #include "gdiimpl.hxx"
+#include "openglgdiimpl.hxx"
 
 #include "generic/printergfx.hxx"
 #include "xrender_peer.hxx"
@@ -61,6 +62,9 @@ X11SalGraphics::X11SalGraphics():
 m_nXScreen( 0 ),
 pFontGC_(NULL)
 {
+static const char* pOpenGL = getenv("USE_OPENGL");
+if (pOpenGL)
+mpImpl.reset(new OpenGLSalGraphicsImpl());
 m_pFrame= NULL;
 m_pVDev = NULL;
 m_pColormap = NULL;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/opengl-vcl' - vcl/inc vcl/Library_vcl.mk vcl/source

2014-10-21 Thread Markus Mohrhard
 vcl/Library_vcl.mk|1 
 vcl/inc/salgdiimpl.hxx|  196 ++
 vcl/source/gdi/salgdiimpl.cxx |   26 +
 3 files changed, 223 insertions(+)

New commits:
commit 68a6645f6d625bcff56ea93294754a9a695b01e0
Author: Markus Mohrhard 
Date:   Tue Oct 21 08:48:02 2014 +0200

add Impl version for SalGraphics

Using an Impl pattern here allows us to switch the rendering in each
plugin without introducing any additional plugins.

The SalGraphics subclass will just forward the rendering call to the
Impl which can either be the normal native one or the OpenGL one.

Change-Id: Id234c60335305bfb42bf3d2b912f02d1f542bd06

diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index dea1d8d..52a224c 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -273,6 +273,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
 vcl/source/gdi/region \
 vcl/source/gdi/regionband \
 vcl/source/gdi/salgdilayout \
+vcl/source/gdi/salgdiimpl \
 vcl/source/gdi/sallayout \
 vcl/source/gdi/salmisc \
 vcl/source/gdi/salnativewidgets-none \
diff --git a/vcl/inc/salgdiimpl.hxx b/vcl/inc/salgdiimpl.hxx
new file mode 100644
index 000..58d6c1a
--- /dev/null
+++ b/vcl/inc/salgdiimpl.hxx
@@ -0,0 +1,196 @@
+/* -*- 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 .
+ */
+
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+
+class SalGraphics;
+class SalBitmap;
+
+class SalGraphicsImpl
+{
+public:
+
+virtual ~SalGraphicsImpl();
+
+virtual bool setClipRegion( const vcl::Region& ) = 0;
+//
+// get the depth of the device
+virtual sal_uInt16  GetBitCount() const = 0;
+
+// get the width of the device
+virtual longGetGraphicsWidth() const = 0;
+
+// set the clip region to empty
+virtual voidResetClipRegion() = 0;
+
+// set the line color to transparent (= don't draw lines)
+
+virtual voidSetLineColor() = 0;
+
+// set the line color to a specific color
+virtual voidSetLineColor( SalColor nSalColor ) = 0;
+
+// set the fill color to transparent (= don't fill)
+virtual voidSetFillColor() = 0;
+
+// set the fill color to a specific color, shapes will be
+// filled accordingly
+virtual voidSetFillColor( SalColor nSalColor ) = 0;
+
+// enable/disable XOR drawing
+virtual voidSetXORMode( bool bSet, bool bInvertOnly ) = 0;
+
+// set line color for raster operations
+virtual voidSetROPLineColor( SalROPColor nROPColor ) = 0;
+
+// set fill color for raster operations
+virtual voidSetROPFillColor( SalROPColor nROPColor ) = 0;
+
+// draw --> LineColor and FillColor and RasterOp and ClipRegion
+virtual void drawPixel( long nX, long nY ) = 0;
+virtual void drawPixel( long nX, long nY, SalColor nSalColor ) = 0;
+
+virtual void drawLine( long nX1, long nY1, long nX2, long nY2 ) = 0;
+
+virtual void drawRect( long nX, long nY, long nWidth, long nHeight ) = 0;
+
+virtual void drawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAry ) = 
0;
+
+virtual void drawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry ) = 0;
+
+virtual void drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, 
PCONSTSALPOINT* pPtAry ) = 0;
+virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double 
fTransparency ) = 0;
+
+virtual bool drawPolyLine(
+const ::basegfx::B2DPolygon&,
+double fTransparency,
+const ::basegfx::B2DVector& rLineWidths,
+basegfx::B2DLineJoin,
+com::sun::star::drawing::LineCap) = 0;
+
+virtual bool drawPolyLineBezier(
+sal_uInt32 nPoints,
+const SalPoint* pPtAry,
+const sal_uInt8* pFlgAry ) = 0;
+
+virtual bool drawPolygonBezier(
+sal_uInt32 nPoints,
+const SalPoint* pPtAry,
+const sal_uInt8* pFlgAry ) =