[Libreoffice-commits] core.git: 5 commits - chart2/opengl chart2/Package_opengl.mk chart2/source
Markus Mohrhard
markus.mohrhard at collabora.co.uk
Sat Feb 15 03:49:31 CET 2014
chart2/Package_opengl.mk | 2
chart2/opengl/renderFragmentShader.glsl | 18 ----
chart2/opengl/renderVertexShader.glsl | 20 ----
chart2/source/view/inc/DummyXShape.hxx | 1
chart2/source/view/main/DummyXShape.cxx | 5 +
chart2/source/view/main/OpenGLRender.cxx | 130 -------------------------------
chart2/source/view/main/OpenGLRender.hxx | 22 -----
7 files changed, 11 insertions(+), 187 deletions(-)
New commits:
commit 4e20762265ccc6b69090486072ccd8427754fff4
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Sat Feb 15 03:47:55 2014 +0100
remove unused shader
Change-Id: Ib30ff20e099f4b3403a3ca7689f7d8d75d888763
diff --git a/chart2/Package_opengl.mk b/chart2/Package_opengl.mk
index 9c3a663..ef33ebb 100644
--- a/chart2/Package_opengl.mk
+++ b/chart2/Package_opengl.mk
@@ -16,8 +16,6 @@ $(eval $(call gb_Package_add_files,chart2_opengl_shader,$(LIBO_BIN_FOLDER)/openg
commonVertexShader.glsl \
debugFragmentShader.glsl \
debugVertexShader.glsl \
- renderFragmentShader.glsl \
- renderVertexShader.glsl \
symbolFragmentShader.glsl \
symbolVertexShader.glsl \
textFragmentShader.glsl \
diff --git a/chart2/opengl/renderFragmentShader.glsl b/chart2/opengl/renderFragmentShader.glsl
deleted file mode 100644
index a6c71f4..0000000
--- a/chart2/opengl/renderFragmentShader.glsl
+++ /dev/null
@@ -1,18 +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/.
- */
-
-uniform sampler2D RenderTex;
-varying vec2 vTexCoord;
-
-void main()
-{
- gl_FragColor = vec4(texture2D(RenderTex, vTexCoord).rgb, 1.0);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/opengl/renderVertexShader.glsl b/chart2/opengl/renderVertexShader.glsl
deleted file mode 100644
index 8c55629..0000000
--- a/chart2/opengl/renderVertexShader.glsl
+++ /dev/null
@@ -1,20 +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/.
- */
-
-attribute vec4 vPosition;
-attribute vec2 texCoord;
-varying vec2 vTexCoord;
-
-void main()
-{
- gl_Position = vPosition;
- vTexCoord = texCoord;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 38f8f1b78232c69e3927ebfc852dc2712bfd72da
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Sat Feb 15 03:46:52 2014 +0100
remove more unused code
Change-Id: I36ec2e2960072120a064805f171e20703f0508c0
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index e6e04cf..55feba5 100755
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -281,13 +281,6 @@ int OpenGLRender::InitOpenGL(GLWindow aWindow)
CHECK_GL_ERROR();
- m_RenderProID = LoadShaders("renderVertexShader", "renderFragmentShader");
- m_RenderVertexID = glGetAttribLocation(m_RenderProID, "vPosition");
- m_RenderTexCoordID = glGetAttribLocation(m_RenderProID, "texCoord");
- m_RenderTexID = glGetUniformLocation(m_RenderProID, "RenderTex");
-
- CHECK_GL_ERROR();
-
m_CommonProID = LoadShaders("commonVertexShader", "commonFragmentShader");
m_MatrixID = glGetUniformLocation(m_CommonProID, "MVP");
m_2DVertexID = glGetAttribLocation(m_CommonProID, "vPosition");
@@ -323,15 +316,6 @@ int OpenGLRender::InitOpenGL(GLWindow aWindow)
CHECK_GL_ERROR();
- glGenBuffers(1, &m_RenderVertexBuf);
- glBindBuffer(GL_ARRAY_BUFFER, m_RenderVertexBuf);
- glBindBuffer(GL_ARRAY_BUFFER, 0);
-
- glGenBuffers(1, &m_RenderTexCoordBuf);
- glBindBuffer(GL_ARRAY_BUFFER, m_RenderTexCoordBuf);
- glBufferData(GL_ARRAY_BUFFER, sizeof(texCoords), texCoords, GL_STATIC_DRAW);
- glBindBuffer(GL_ARRAY_BUFFER, 0);
-
glGenBuffers(1, &m_TextTexCoordBuf);
glBindBuffer(GL_ARRAY_BUFFER, m_TextTexCoordBuf);
glBufferData(GL_ARRAY_BUFFER, sizeof(texCoords), texCoords, GL_STATIC_DRAW);
@@ -650,9 +634,6 @@ void OpenGLRender::Release()
{
glDeleteBuffers(1, &m_VertexBuffer);
glDeleteBuffers(1, &m_ColorBuffer);
- glDeleteBuffers(1, &m_RenderVertexBuf);
- glDeleteBuffers(1, &m_RenderTexCoordBuf);
- glDeleteProgram(m_RenderProID);
glDeleteProgram(m_CommonProID);
glDeleteProgram(m_TextProID);
glDeleteProgram(m_BackgroundProID);
@@ -704,7 +685,7 @@ OpenGLRender::OpenGLRender(uno::Reference< drawing::XShape > xTarget)
, m_TextProID(0)
, m_TextMatrixID(0)
, m_TextVertexID(0)
- , m_TextTexCoordID(1)
+ , m_TextTexCoordID(0)
, m_TextTexCoordBuf(0)
, m_TextTexID(0)
, m_BackgroundProID(0)
diff --git a/chart2/source/view/main/OpenGLRender.hxx b/chart2/source/view/main/OpenGLRender.hxx
index cd2d8bc..2a934cf 100755
--- a/chart2/source/view/main/OpenGLRender.hxx
+++ b/chart2/source/view/main/OpenGLRender.hxx
@@ -205,25 +205,12 @@ private:
// Our ModelViewProjection : multiplication of our 3 matrices
glm::mat4 m_MVP;
- GLint m_RenderProID;
-
-
GLuint m_VertexBuffer;
GLuint m_ColorBuffer;
GLint m_MatrixID;
- GLint m_RenderVertexID;
-
- GLint m_RenderTexCoordID;
-
- GLint m_RenderTexID;
-
- GLuint m_RenderVertexBuf;
-
- GLuint m_RenderTexCoordBuf;
-
GLuint m_TextureObj;
GLuint m_FboID;
commit a3dfd7f5fbcfcfb6a9c2e760d78446470c89688c
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Sat Feb 15 03:32:53 2014 +0100
remove more unused code
Change-Id: I57c5bc1fd436df4e917d460a31d671e361fd47b3
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index f48223d..e6e04cf 100755
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -1251,7 +1251,7 @@ int OpenGLRender::RenderRectangleShape(bool bBorder, bool bFill)
}
-int OpenGLRender::CreateTextTexture(const BitmapEx& rBitmapEx, awt::Point aPos, awt::Size aSize, long rotation,
+int OpenGLRender::CreateTextTexture(const BitmapEx& rBitmapEx, const awt::Point&, const awt::Size& aSize, long rotation,
const drawing::HomogenMatrix3& rTrans)
{
#if DEBUG_PNG // debug PNG writing
@@ -1291,9 +1291,6 @@ int OpenGLRender::CreateTextTexture(const BitmapEx& rBitmapEx, awt::Point aPos,
}
TextInfo aTextInfo;
- aTextInfo.x = (float)(aPos.X + aSize.Width / 2);
- aTextInfo.y = (float)(aPos.Y + aSize.Height / 2);
- aTextInfo.z = m_fZStep;
aTextInfo.rotation = -(double)rotation * GL_PI / 18000.0f;
aTextInfo.vertex[0] = rTrans.Line1.Column3 / OPENGL_SCALE_VALUE;
aTextInfo.vertex[1] = rTrans.Line2.Column3 / OPENGL_SCALE_VALUE;
@@ -1314,19 +1311,7 @@ int OpenGLRender::CreateTextTexture(const BitmapEx& rBitmapEx, awt::Point aPos,
//if has ratotion, we must re caculate the central pos
if (!rtl::math::approxEqual(0, rotation))
{
- //use left top
- double r = sqrt((double)(aSize.Width * aSize.Width + aSize.Height * aSize.Height)) / 2;
- double sinOrgAngle = aTextInfo.vertex[1] / r / 2;
- double cosOrgAngle = aTextInfo.vertex[0] / r / 2;
- double sinDiataAngle = sin(aTextInfo.rotation);
- double cosDiataAngle = cos(aTextInfo.rotation);
- double x = r * (cosOrgAngle * cosDiataAngle - sinOrgAngle * sinDiataAngle);
- double y = r * (sinOrgAngle * cosDiataAngle + cosOrgAngle * sinDiataAngle);
- double diataX = x - aTextInfo.vertex[0];
- double diataY = y - aTextInfo.vertex[1];
- aTextInfo.x = aTextInfo.x - diataX;
- aTextInfo.y = aTextInfo.y - diataY;
-
+ // handle rotation
}
CHECK_GL_ERROR();
@@ -1684,6 +1669,7 @@ int OpenGLRender::RenderSymbol2DShape(float x, float y, float , float , sal_Int3
0, // stride
(void*)0 // array buffer offset
);
+
glDrawArrays(GL_POINTS, 0, 1);
glDisableVertexAttribArray(m_SymbolVertexID);
diff --git a/chart2/source/view/main/OpenGLRender.hxx b/chart2/source/view/main/OpenGLRender.hxx
index fb66cc3..cd2d8bc 100755
--- a/chart2/source/view/main/OpenGLRender.hxx
+++ b/chart2/source/view/main/OpenGLRender.hxx
@@ -79,9 +79,6 @@ struct RectanglePointList
struct TextInfo
{
GLuint texture;
- float x;
- float y;
- float z;
double rotation;
float vertex[12];
};
@@ -168,8 +165,8 @@ public:
int RectangleShapePoint(float x, float y, float directionX, float directionY);
int CreateTextTexture(const BitmapEx& rBitmapEx,
- com::sun::star::awt::Point aPos, com::sun::star::awt::Size aSize, long rotation,
- const com::sun::star::drawing::HomogenMatrix3& rTrans);
+ const com::sun::star::awt::Point& aPos, const com::sun::star::awt::Size& aSize,
+ long rotation, const com::sun::star::drawing::HomogenMatrix3& rTrans);
int RenderTextShape();
int SetArea2DShapePoint(float x, float y, int listLength);
commit 5c7bbb11aed16e09ba67222f53e4c2ffe5687fb3
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Sat Feb 15 03:24:45 2014 +0100
set transformation matrix as property with fixed size
Change-Id: I3853ea0f6f3b82dc6ea7b402dec58d528b639684
diff --git a/chart2/source/view/inc/DummyXShape.hxx b/chart2/source/view/inc/DummyXShape.hxx
index 4ce530a..3a9dccb 100644
--- a/chart2/source/view/inc/DummyXShape.hxx
+++ b/chart2/source/view/inc/DummyXShape.hxx
@@ -355,7 +355,6 @@ private:
chart2::XFormattedString > > maFormattedString;
};
-
class DummyXShapes : public DummyXShape, public com::sun::star::drawing::XShapes
{
public:
diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx
index a4bf7b8..3508f19 100644
--- a/chart2/source/view/main/DummyXShape.cxx
+++ b/chart2/source/view/main/DummyXShape.cxx
@@ -742,6 +742,11 @@ DummyText::DummyText(const OUString& rText, const tNameSequence& rNames,
drawing::HomogenMatrix3 aTrans = rTrans.get<drawing::HomogenMatrix3>();
setSize(awt::Size(20*bmpWidth, 20*bmpHeight));
setPosition(awt::Point(aTrans.Line1.Column3, aTrans.Line2.Column3));
+ aTrans.Line1.Column1 = 20 * bmpWidth;
+ aTrans.Line2.Column2 = 20 * bmpHeight;
+ uno::Any aNewTrans;
+ aNewTrans <<= aTrans;
+ setPropertyValue("Transformation", aNewTrans);
}
else
setSize(awt::Size(20*bmpWidth, 20*bmpHeight));
commit 10e8194dd84ca58dfcbbff7f727e79fb8561a105
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Sat Feb 15 03:24:04 2014 +0100
remove unused functions
Change-Id: I5e176c705cc373333831e4b833386ed707418d2e
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index 963d6b0..f48223d 100755
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -588,95 +588,6 @@ void OpenGLRender::renderToBitmap()
glFlush();
}
-int OpenGLRender::RenderTexture2FBO(GLuint TexID)
-{
- CHECK_GL_ERROR();
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- glDepthMask(GL_FALSE);
- glUseProgram(m_RenderProID);
- glEnableVertexAttribArray(m_RenderVertexID);
- glBindBuffer(GL_ARRAY_BUFFER, m_RenderVertexBuf);
- glVertexAttribPointer(
- m_RenderVertexID, // attribute. No particular reason for 0, but must match the layout in the shader.
- 3, // size
- GL_FLOAT, // type
- GL_FALSE, // normalized?
- 0, // stride
- (void*)0 // array buffer offset
- );
- glEnableVertexAttribArray(m_RenderTexCoordID);
- glBindBuffer(GL_ARRAY_BUFFER, m_RenderTexCoordBuf);
- glVertexAttribPointer(
- m_RenderTexCoordID, // attribute. No particular reason for 0, but must match the layout in the shader.
- 2, // size
- GL_FLOAT, // type
- GL_FALSE, // normalized?
- 0, // stride
- (void*)0 // array buffer offset
- );
- glBindTexture(GL_TEXTURE_2D, TexID);
- glUniform1i(m_RenderTexID, 0);
- //TODO: moggi: get rid fo GL_QUADS
- glDrawArrays(GL_QUADS, 0, 4);
- glDisableVertexAttribArray(m_RenderTexCoordID);
- glDisableVertexAttribArray(m_RenderVertexID);
- glBindTexture(GL_TEXTURE_2D, 0);
- glUseProgram(0);
- glDepthMask(GL_TRUE);
- CHECK_GL_ERROR();
-
- m_fZStep += Z_STEP;
- return 0;
-}
-
-
-int OpenGLRender::RenderTexture(GLuint TexID)
-{
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- glUseProgram(m_RenderProID);
-
- glEnableVertexAttribArray(m_RenderVertexID);
- glBindBuffer(GL_ARRAY_BUFFER, m_RenderVertexBuf);
- glVertexAttribPointer(
- m_RenderVertexID, // attribute. No particular reason for 0, but must match the layout in the shader.
- 3, // size
- GL_FLOAT, // type
- GL_FALSE, // normalized?
- 0, // stride
- (void*)0 // array buffer offset
- );
- glEnableVertexAttribArray(m_RenderTexCoordID);
- glBindBuffer(GL_ARRAY_BUFFER, m_RenderTexCoordBuf);
- glVertexAttribPointer(
- m_RenderTexCoordID, // attribute. No particular reason for 0, but must match the layout in the shader.
- 2, // size
- GL_FLOAT, // type
- GL_FALSE, // normalized?
- 0, // stride
- (void*)0 // array buffer offset
- );
- glBindTexture(GL_TEXTURE_2D, TexID);
- glUniform1i(m_RenderTexID, 0);
- //TODO: moggi: get rid fo GL_QUADS
- glDrawArrays(GL_QUADS, 0, 4);
- glDisableVertexAttribArray(m_RenderTexCoordID);
- glDisableVertexAttribArray(m_RenderVertexID);
- glBindTexture(GL_TEXTURE_2D, 0);
- glUseProgram(0);
-#if defined( WNT )
- SwapBuffers(glWin.hDC);
-#elif defined( MACOSX )
-
-#elif defined( UNX )
- glXSwapBuffers(glWin.dpy, glWin.win);
-#endif
- glFlush();
- m_fZStep += Z_STEP;
- return 0;
-}
-
-
int OpenGLRender::CreateTextureObj(int width, int height)
{
glGenTextures(1, &m_TextureObj);
diff --git a/chart2/source/view/main/OpenGLRender.hxx b/chart2/source/view/main/OpenGLRender.hxx
index a67309d..fb66cc3 100755
--- a/chart2/source/view/main/OpenGLRender.hxx
+++ b/chart2/source/view/main/OpenGLRender.hxx
@@ -191,8 +191,6 @@ private:
int CreateTextureObj(int width, int height);
int CreateRenderObj(int width, int height);
int CreateFrameBufferObj();
- int RenderTexture(GLuint TexID);
- int RenderTexture2FBO(GLuint TexID);
#if defined( _WIN32 )
int InitTempWindow(HWND *hwnd, int width, int height, PIXELFORMATDESCRIPTOR inPfd);
bool WGLisExtensionSupported(const char *extension);
More information about the Libreoffice-commits
mailing list