[Libreoffice-commits] core.git: 5 commits - chart2/source officecfg/registry
Markus Mohrhard
markus.mohrhard at collabora.co.uk
Sat May 31 18:53:05 PDT 2014
chart2/source/view/inc/AbstractShapeFactory.hxx | 6
chart2/source/view/inc/GL3DRenderer.hxx | 1
chart2/source/view/inc/OpenglShapeFactory.hxx | 3
chart2/source/view/inc/ShapeFactory.hxx | 3
chart2/source/view/main/ChartView.cxx | 8
chart2/source/view/main/DummyXShape.cxx | 5
chart2/source/view/main/DummyXShape.hxx | 2
chart2/source/view/main/GL3DRenderer.cxx | 38 --
chart2/source/view/main/OpenGLRender.cxx | 182 ----------
chart2/source/view/main/OpenGLRender.hxx | 27 -
chart2/source/view/main/OpenglShapeFactory.cxx | 99 +----
officecfg/registry/data/org/openoffice/Office/UI/WriterFormWindowState.xcu | 17
12 files changed, 70 insertions(+), 321 deletions(-)
New commits:
commit df48d00ffb4fb1bf206ea41ba704373fcc35c749
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Sun Jun 1 03:46:58 2014 +0200
remove the framebuffer rendering
Change-Id: I2510a00b24a6a3c045a6ee2ccb21c022d3404000
diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx
index 8e4943f..d9caddd 100644
--- a/chart2/source/view/main/DummyXShape.cxx
+++ b/chart2/source/view/main/DummyXShape.cxx
@@ -1189,7 +1189,6 @@ void DummyChart::render()
#else
DummyXShapes::render();
#endif
- m_GLRender.renderToBitmap();
}
void DummyChart::clear()
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index d9a74fb..da7a60f 100644
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -116,15 +116,6 @@ GLfloat texCoords[] = {
int OpenGLRender::InitOpenGL()
{
- //TODO: moggi: get the information from the context
- mbArbMultisampleSupported = true;
-
- if (glewIsSupported("framebuffer_object") != GLEW_OK)
- {
- SAL_WARN("chart2.opengl", "GL stack has no framebuffer support");
- return -1;
- }
-
glEnable(GL_TEXTURE_2D);
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
@@ -344,28 +335,6 @@ void OpenGLRender::renderDebug()
void OpenGLRender::prepareToRender()
{
glViewport(0, 0, m_iWidth, m_iHeight);
- if (!m_FboID[0])
- {
- // create a texture object
- CreateTextureObj(m_iWidth, m_iHeight);
- //create render buffer object
- CreateRenderObj(m_iWidth, m_iHeight);
- //create fbo
- CreateFrameBufferObj();
- if (mbArbMultisampleSupported)
- {
- CreateMultiSampleFrameBufObj();
- }
- }
- //bind fbo
- if (mbArbMultisampleSupported)
- {
- glBindFramebuffer(GL_FRAMEBUFFER,m_frameBufferMS);
- }
- else
- {
- glBindFramebuffer(GL_FRAMEBUFFER, m_FboID[0]);
- }
// Clear the screen
glClearDepth(1.0f);
@@ -373,43 +342,6 @@ void OpenGLRender::prepareToRender()
m_fZStep = 0;
}
-void OpenGLRender::renderToBitmap()
-{
-}
-
-int OpenGLRender::CreateTextureObj(int width, int height)
-{
- glGenTextures(2, m_TextureObj);
- for (int i = 0; i < 2; i++)
- {
- glBindTexture(GL_TEXTURE_2D, m_TextureObj[i]);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
- CHECK_GL_ERROR();
- glBindTexture(GL_TEXTURE_2D, 0);
- }
- return 0;
-}
-
-int OpenGLRender::CreateRenderObj(int width, int height)
-{
- glGenRenderbuffers(2, m_RboID);
- for (int i = 0; i < 2; i++)
- {
- CHECK_GL_ERROR();
- glBindRenderbuffer(GL_RENDERBUFFER, m_RboID[i]);
- CHECK_GL_ERROR();
- glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, width, height);
- CHECK_GL_ERROR();
- glBindRenderbuffer(GL_RENDERBUFFER, 0);
- CHECK_GL_ERROR();
- }
- return 0;
-}
-
int OpenGLRender::MoveModelf(PosVecf3 trans, PosVecf3 angle, PosVecf3 scale)
{
glm::mat4 aTranslationMatrix = glm::translate(glm::vec3(trans.x, trans.y, trans.z));
@@ -419,29 +351,6 @@ int OpenGLRender::MoveModelf(PosVecf3 trans, PosVecf3 angle, PosVecf3 scale)
return 0;
}
-int OpenGLRender::CreateFrameBufferObj()
-{
- // create a framebuffer object, you need to delete them when program exits.
- glGenFramebuffers(2, m_FboID);
- glCheckFramebufferStatus(GL_FRAMEBUFFER);
- for (int i = 0; i < 2; i++)
- {
- glBindFramebuffer(GL_FRAMEBUFFER, m_FboID[i]);
- glBindTexture(GL_TEXTURE_2D, m_TextureObj[i]);
- // attach a texture to FBO color attachement point
- glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_TextureObj[i], 0);
- glCheckFramebufferStatus(GL_FRAMEBUFFER);
- glBindTexture(GL_TEXTURE_2D, 0);
- // attach a renderbuffer to depth attachment point
- glBindRenderbuffer(GL_RENDERBUFFER, m_RboID[i]);
- glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_RboID[i]);
- glCheckFramebufferStatus(GL_FRAMEBUFFER);
- glBindRenderbuffer(GL_RENDERBUFFER, 0);
- glBindFramebuffer(GL_FRAMEBUFFER, 0);
- }
- return 0;
-}
-
void OpenGLRender::Release()
{
glDeleteBuffers(1, &m_VertexBuffer);
@@ -451,12 +360,6 @@ void OpenGLRender::Release()
glDeleteProgram(m_TextProID);
glDeleteProgram(m_BackgroundProID);
glDeleteProgram(m_SymbolProID);
- glDeleteFramebuffers(2, m_FboID);
- glDeleteFramebuffers(1, &m_frameBufferMS);
- glDeleteTextures(2, m_TextureObj);
- glDeleteRenderbuffers(2, m_RboID);
- glDeleteRenderbuffers(1, &m_renderBufferColorMS);
- glDeleteRenderbuffers(1, &m_renderBufferDepthMS);
}
OpenGLRender::OpenGLRender()
@@ -468,18 +371,8 @@ OpenGLRender::OpenGLRender()
, m_MatrixID(0)
, m_RenderVertexBuf(0)
, m_RenderTexCoordBuf(0)
-#if 0
- , m_iPointNum(0)
-#endif
, m_fLineWidth(0.001f)
- , mbArbMultisampleSupported(false)
-#if defined( _WIN32 )
- , m_iArbMultisampleFormat(0)
-#endif
, m_2DColor(glm::vec4(1.0, 0.0, 0.0, 1.0))
- , m_frameBufferMS(0)
- , m_renderBufferColorMS(0)
- , m_renderBufferDepthMS(0)
, m_CommonProID(0)
, m_2DVertexID(0)
, m_2DColorID(0)
@@ -502,12 +395,6 @@ OpenGLRender::OpenGLRender()
{
//TODO: moggi: use STL
memset(&m_Line2DPointList, 0, sizeof(Line2DPointList));
- m_FboID[0] = 0;
- m_FboID[1] = 0;
- m_TextureObj[0] = 0;
- m_TextureObj[1] = 0;
- m_RboID[0] = 0;
- m_RboID[1] = 0;
memset(&m_Bubble2DCircle, 0, sizeof(m_Bubble2DCircle));
@@ -582,27 +469,6 @@ void OpenGLRender::SetColor(sal_uInt32 color, sal_uInt8 nAlpha)
m_2DColor = glm::vec4((float)r / 255.0f, (float)g / 255.0f, (float)b / 255.0f, nAlpha/ 255.f);
}
-int OpenGLRender::CreateMultiSampleFrameBufObj()
-{
- glGenFramebuffers(1, &m_frameBufferMS);
- glBindFramebuffer(GL_FRAMEBUFFER, m_frameBufferMS);
-
- glGenRenderbuffers(1, &m_renderBufferColorMS);
- glBindRenderbuffer(GL_RENDERBUFFER, m_renderBufferColorMS);
- glRenderbufferStorageMultisample(GL_RENDERBUFFER, 8, GL_RGB, m_iWidth, m_iHeight);
- glBindRenderbuffer(GL_RENDERBUFFER, 0);
- glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, m_renderBufferColorMS);
-
- glGenRenderbuffers(1, &m_renderBufferDepthMS);
- glBindRenderbuffer(GL_RENDERBUFFER, m_renderBufferDepthMS);
- glRenderbufferStorageMultisample(GL_RENDERBUFFER, 8, GL_DEPTH_COMPONENT24, m_iWidth, m_iHeight);
- glBindRenderbuffer(GL_RENDERBUFFER, 0);
- glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_renderBufferDepthMS);
- glBindFramebuffer(GL_FRAMEBUFFER, 0);
-
- return 0;
-}
-
int OpenGLRender::Create2DCircle(int detail)
{
float angle;
diff --git a/chart2/source/view/main/OpenGLRender.hxx b/chart2/source/view/main/OpenGLRender.hxx
index 2b4b11b..23c397e 100644
--- a/chart2/source/view/main/OpenGLRender.hxx
+++ b/chart2/source/view/main/OpenGLRender.hxx
@@ -92,7 +92,6 @@ public:
int RenderBubble2FBO(int wholeFlag);
void prepareToRender();
- void renderToBitmap();
int RenderRectangleShape(bool bBorder, bool bFill);
int RectangleShapePoint(float x, float y, float directionX, float directionY);
@@ -134,10 +133,6 @@ private:
int m_iHeight;
private:
- int CreateTextureObj(int width, int height);
- int CreateRenderObj(int width, int height);
- int CreateFrameBufferObj();
- int CreateMultiSampleFrameBufObj();
int Create2DCircle(int detail);
private:
// Projection matrix : default 45 degree Field of View, 4:3 ratio, display range : 0.1 unit <-> 100 units
@@ -169,30 +164,13 @@ private:
GLuint m_RenderTexCoordBuf;
- GLuint m_TextureObj[2];
-
- GLuint m_FboID[2];
-
- GLuint m_RboID[2];
-#if 0
- int m_iPointNum;
-#endif
Line2DPointList m_Line2DPointList;
float m_fLineWidth;
std::list <Line2DPointList> m_Line2DShapePointList;
-
- bool mbArbMultisampleSupported;
-#if defined( _WIN32 )
- int m_iArbMultisampleFormat;
-#endif
-
glm::vec4 m_2DColor;
- GLuint m_frameBufferMS;
- GLuint m_renderBufferColorMS;
- GLuint m_renderBufferDepthMS;
Bubble2DCircle m_Bubble2DCircle;
commit 43de2fa02bbbf364326c3452a58c600bc2cb2688
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Sun Jun 1 03:45:34 2014 +0200
don't add the changes toolbar to the forms window, fdo#76752
Change-Id: I1a5d62b0995343a73fd8d6941f0fa380bb19e783
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/WriterFormWindowState.xcu b/officecfg/registry/data/org/openoffice/Office/UI/WriterFormWindowState.xcu
index 49f3fe3..7d02379 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/WriterFormWindowState.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterFormWindowState.xcu
@@ -697,23 +697,6 @@
<value>true</value>
</prop>
</node>
- <node oor:name="private:resource/toolbar/changes" oor:op="replace">
- <prop oor:name="UIName" oor:type="xs:string">
- <value xml:lang="en-US">Changes</value>
- </prop>
- <prop oor:name="Docked" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- <prop oor:name="DockingArea" oor:type="xs:int">
- <value>2</value>
- </prop>
- <prop oor:name="DockPos" oor:type="xs:string">
- <value>0,0</value>
- </prop>
- <prop oor:name="Visible" oor:type="xs:boolean">
- <value>true</value>
- </prop>
- </node>
</node>
</node>
</oor:component-data>
commit 8822b255e55dc3e65417c52a809a981716ee485c
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Sun Jun 1 01:28:06 2014 +0200
move to OpenGLWindow step one
Change-Id: I9f019a397f8b0daf27f0969b1f23539438eb6422
diff --git a/chart2/source/view/inc/AbstractShapeFactory.hxx b/chart2/source/view/inc/AbstractShapeFactory.hxx
index b9b247f..8d5fdc6 100644
--- a/chart2/source/view/inc/AbstractShapeFactory.hxx
+++ b/chart2/source/view/inc/AbstractShapeFactory.hxx
@@ -29,6 +29,8 @@
#include <rtl/ustring.hxx>
+class OpenGLWindow;
+
namespace chart {
@@ -239,6 +241,9 @@ public:
*/
virtual void render(com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage > xDrawPage) = 0;
+ virtual bool preRender(OpenGLWindow* pWindow) = 0;
+ virtual void postRender(OpenGLWindow* pWindow) = 0;
+
virtual void clearPage(com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage > xDrawPage) = 0;
static ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
@@ -284,6 +289,7 @@ public:
};
}
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/inc/OpenglShapeFactory.hxx b/chart2/source/view/inc/OpenglShapeFactory.hxx
index c93199f..97f1955 100644
--- a/chart2/source/view/inc/OpenglShapeFactory.hxx
+++ b/chart2/source/view/inc/OpenglShapeFactory.hxx
@@ -186,6 +186,9 @@ public:
virtual void render(com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage > xDrawPage) SAL_OVERRIDE;
+ virtual bool preRender(OpenGLWindow* pWindow) SAL_OVERRIDE;
+ virtual void postRender(OpenGLWindow* pWindow) SAL_OVERRIDE;
+
virtual void clearPage(com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage > xDrawPage) SAL_OVERRIDE;
};
diff --git a/chart2/source/view/inc/ShapeFactory.hxx b/chart2/source/view/inc/ShapeFactory.hxx
index 87a4387..c427c38 100644
--- a/chart2/source/view/inc/ShapeFactory.hxx
+++ b/chart2/source/view/inc/ShapeFactory.hxx
@@ -199,6 +199,9 @@ public:
*/
virtual void render(com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage > ) SAL_OVERRIDE {}
+ virtual bool preRender(OpenGLWindow*) SAL_OVERRIDE { return true; }
+ virtual void postRender(OpenGLWindow*) SAL_OVERRIDE {}
+
virtual void clearPage(com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage > ) SAL_OVERRIDE {}
private:
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index 3ad0db6..7b71206 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -2615,7 +2615,13 @@ void ChartView::createShapes()
//cleanup: remove all empty group shapes to avoid grey border lines:
lcl_removeEmptyGroupShapes( mxRootShape );
- pShapeFactory->render( m_xDrawPage );
+ OpenGLWindow* pWindow = mrChartModel.getOpenGLWindow();
+ bool bRender = pShapeFactory->preRender(pWindow);
+ if(bRender)
+ {
+ pShapeFactory->render(m_xDrawPage);
+ pShapeFactory->postRender(pWindow);
+ }
if(maTimeBased.bTimeBased && maTimeBased.nFrame % 60 == 0)
{
diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx
index a0c78b3..8e4943f 100644
--- a/chart2/source/view/main/DummyXShape.cxx
+++ b/chart2/source/view/main/DummyXShape.cxx
@@ -1145,9 +1145,9 @@ void DummyXShapes::render()
}
}
-DummyChart::DummyChart(uno::Reference< drawing::XShape > xTarget):
+DummyChart::DummyChart():
mbNotInit(true),
- m_GLRender(xTarget)
+ m_GLRender()
{
SAL_INFO("chart2.opengl", "DummyXShape::DummyChart()-----test: ");
setName("com.sun.star.chart2.shapes");
diff --git a/chart2/source/view/main/DummyXShape.hxx b/chart2/source/view/main/DummyXShape.hxx
index 779247b..5fc71e6 100644
--- a/chart2/source/view/main/DummyXShape.hxx
+++ b/chart2/source/view/main/DummyXShape.hxx
@@ -387,7 +387,7 @@ protected:
class DummyChart : public DummyXShapes
{
public:
- DummyChart(com::sun::star::uno::Reference< com::sun::star::drawing::XShape > xDrawPage);
+ DummyChart();
virtual ~DummyChart();
virtual DummyChart* getRootShape() SAL_OVERRIDE;
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index 02f770f..d9a74fb 100644
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -375,49 +375,6 @@ void OpenGLRender::prepareToRender()
void OpenGLRender::renderToBitmap()
{
- if (mbArbMultisampleSupported)
- {
- GLenum status;
- glBindFramebuffer(GL_FRAMEBUFFER, 0);
- glBindFramebuffer(GL_READ_FRAMEBUFFER, m_frameBufferMS);
- status = glCheckFramebufferStatus(GL_READ_FRAMEBUFFER);
- if (status != GL_FRAMEBUFFER_COMPLETE)
- {
- SAL_INFO("chart2.opengl", "The frame buffer status is not complete!");
- }
- glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_FboID[0]);
- status = glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER);
- if (status != GL_FRAMEBUFFER_COMPLETE)
- {
- SAL_INFO("chart2.opengl", "The frame buffer status is not complete!");
- }
- glBlitFramebuffer(0, 0 ,m_iWidth, m_iHeight, 0, 0,m_iWidth ,m_iHeight, GL_COLOR_BUFFER_BIT, GL_LINEAR);
- glBindFramebuffer(GL_READ_FRAMEBUFFER,0);
- glBindFramebuffer(GL_DRAW_FRAMEBUFFER,0);
- }
- glBindFramebuffer(GL_FRAMEBUFFER, m_FboID[0]);
-
- BitmapEx aBitmap = GetAsBitmap();
-#if RENDER_TO_FILE
- static int nIdx = 0;
- OUString aName = OUString( "file:///home/moggi/Documents/work/text" ) + OUString::number( nIdx++ ) + ".png";
- try {
- vcl::PNGWriter aWriter( aBitmap );
- SvFileStream sOutput( aName, STREAM_WRITE );
- aWriter.Write( sOutput );
- sOutput.Close();
- } catch (...) {
- SAL_WARN("chart2.opengl", "Error writing png to " << aName);
- }
-#else
- Graphic aGraphic(aBitmap);
- uno::Reference< awt::XBitmap> xBmp( aGraphic.GetXGraphic(), uno::UNO_QUERY );
- uno::Reference < beans::XPropertySet > xPropSet ( mxTarget, uno::UNO_QUERY );
- xPropSet->setPropertyValue("Graphic", uno::makeAny(aGraphic.GetXGraphic()));
- mxTarget->setSize(awt::Size(m_iWidth*OPENGL_SCALE_VALUE, m_iHeight*OPENGL_SCALE_VALUE));
- mxTarget->setPosition(awt::Point(0,0));
-#endif
- glBindFramebuffer(GL_FRAMEBUFFER, 0);
}
int OpenGLRender::CreateTextureObj(int width, int height)
@@ -502,9 +459,8 @@ void OpenGLRender::Release()
glDeleteRenderbuffers(1, &m_renderBufferDepthMS);
}
-OpenGLRender::OpenGLRender(uno::Reference< drawing::XShape > xTarget)
- : mxTarget(xTarget)
- , m_iWidth(1600)
+OpenGLRender::OpenGLRender()
+ : m_iWidth(1600)
, m_iHeight(900)
, m_Model(glm::mat4(1.0f))
, m_VertexBuffer(0)
diff --git a/chart2/source/view/main/OpenGLRender.hxx b/chart2/source/view/main/OpenGLRender.hxx
index e5f0799..2b4b11b 100644
--- a/chart2/source/view/main/OpenGLRender.hxx
+++ b/chart2/source/view/main/OpenGLRender.hxx
@@ -73,7 +73,7 @@ typedef std::vector<GLfloat> PointList;
class OpenGLRender
{
public:
- OpenGLRender(com::sun::star::uno::Reference< com::sun::star::drawing::XShape > xTarget);
+ OpenGLRender();
~OpenGLRender();
int InitOpenGL();
int MoveModelf(PosVecf3 trans, PosVecf3 angle, PosVecf3 scale);
@@ -125,9 +125,6 @@ public:
private:
-
- com::sun::star::uno::Reference< com::sun::star::drawing::XShape > mxTarget;
-
#if 0
//for performance
double m_dFreq;
diff --git a/chart2/source/view/main/OpenglShapeFactory.cxx b/chart2/source/view/main/OpenglShapeFactory.cxx
index 56beb5e..7616cd0 100644
--- a/chart2/source/view/main/OpenglShapeFactory.cxx
+++ b/chart2/source/view/main/OpenglShapeFactory.cxx
@@ -48,6 +48,7 @@
#include <svx/svdocirc.hxx>
#include <svx/svdopath.hxx>
#include <vcl/opengl/IOpenGLRenderer.hxx>
+#include <vcl/openglwin.hxx>
#include <basegfx/point/b2dpoint.hxx>
#include <basegfx/matrix/b3dhommatrix.hxx>
@@ -64,24 +65,6 @@ extern "C" {
{ return new opengl::OpenglShapeFactory();}
}
-class OpenGLChartAdapter : public IOpenGLRenderer
-{
-public:
- OpenGLChartAdapter(uno::Reference<drawing::XShapes> xShapes):
- mxShapes(xShapes) {}
-
- virtual ~OpenGLChartAdapter() {}
-
- uno::Reference<drawing::XShapes> getShapes()
- {
- return mxShapes;
- }
-
-private:
- uno::Reference<drawing::XShapes> mxShapes; // here to fix lifetime
-};
-
-
using dummy::DummyXShape;
using dummy::DummyXShapes;
using dummy::DummyCylinder;
@@ -93,8 +76,10 @@ namespace opengl {
namespace {
-IOpenGLRenderer* getRenderer(const uno::Reference< drawing::XDrawPage>& xDrawPage )
+uno::Reference< drawing::XShapes > getChartShape(
+ const uno::Reference< drawing::XDrawPage>& xDrawPage )
{
+ uno::Reference< drawing::XShapes > xRet;
uno::Reference< drawing::XShapes > xShapes( xDrawPage, uno::UNO_QUERY );
if( xShapes.is() )
{
@@ -104,33 +89,20 @@ IOpenGLRenderer* getRenderer(const uno::Reference< drawing::XDrawPage>& xDrawPag
{
if( xShapes->getByIndex( nN ) >>= xShape )
{
+
OUString aRet;
uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
xProp->getPropertyValue( UNO_NAME_MISC_OBJ_NAME ) >>= aRet;
if( aRet.equals("com.sun.star.chart2.shapes") )
{
- SvxOpenGLObject* pGLObj = dynamic_cast<SvxOpenGLObject*>(xShape.get());
- IOpenGLRenderer* pRenderer = pGLObj ? pGLObj->getRenderer() : NULL;
- if (pRenderer)
- return pRenderer;
+ xRet = dynamic_cast<SvxDummyShapeContainer*>(xShape.get())->getWrappedShape();
+ break;
}
}
}
}
-
- return NULL;
-}
-
-uno::Reference< drawing::XShapes > getChartShape(
- const uno::Reference< drawing::XDrawPage>& xDrawPage )
-{
- IOpenGLRenderer* pRenderer = getRenderer(xDrawPage);
- OpenGLChartAdapter* pAdapter = dynamic_cast<OpenGLChartAdapter*>(pRenderer);
- if(pAdapter)
- return pAdapter->getShapes();
-
- return uno::Reference< drawing::XShapes> ();
+ return xRet;
}
}
@@ -144,20 +116,11 @@ uno::Reference< drawing::XShapes > OpenglShapeFactory::getOrCreateChartRootShape
//create the root shape
SAL_WARN("chart2.opengl", "getOrCreateChartRootShape");
- uno::Reference< drawing::XShape > xTarget (m_xShapeFactory->createInstance(
- "com.sun.star.drawing.OpenGLObject" ), uno::UNO_QUERY );
- uno::Reference<drawing::XShapes> xChart(new dummy::DummyChart(xTarget));
- xDrawPage->add(xTarget);
- uno::Any aName;
- aName <<= OUString("com.sun.star.chart2.shapes");
- uno::Reference<beans::XPropertySet> xPropSet( xTarget, uno::UNO_QUERY_THROW );
- xPropSet->setPropertyValue( UNO_NAME_MISC_OBJ_NAME, aName );
-
- SvxOpenGLObject* pObj = dynamic_cast<SvxOpenGLObject*>(xTarget.get());
- if (pObj)
- pObj->setRenderer(new OpenGLChartAdapter(xChart));
-
- xRet = getChartShape( xDrawPage );
+ dummy::DummyChart *pChart = new dummy::DummyChart();
+ SvxDummyShapeContainer* pContainer = new SvxDummyShapeContainer(pChart);
+ pContainer->setSize(awt::Size(0,0));
+ xRet = pChart;
+ xDrawPage->add(pContainer);
}
return xRet;
}
@@ -486,32 +449,32 @@ uno::Reference< drawing::XShape >
void OpenglShapeFactory::render(uno::Reference< drawing::XDrawPage > xDrawPage)
{
- IOpenGLRenderer* pRenderer = getRenderer(xDrawPage);
- if(!pRenderer)
- return;
-
- if(!pRenderer->isOpenGLInitialized())
- return;
-
- OpenGLChartAdapter* pAdapter = dynamic_cast<OpenGLChartAdapter*>(pRenderer);
- if(!pAdapter)
- return;
-
- uno::Reference< drawing::XShapes > xRootShape = pAdapter->getShapes();
+ uno::Reference< drawing::XShapes > xRootShape = getChartShape(xDrawPage);
dummy::DummyChart* pChart = dynamic_cast<dummy::DummyChart*>(xRootShape.get());
assert(pChart);
pChart->render();
}
-void OpenglShapeFactory::clearPage(uno::Reference< drawing::XDrawPage > xDrawPage)
+bool OpenglShapeFactory::preRender(OpenGLWindow* pWindow)
{
- IOpenGLRenderer* pRenderer = getRenderer(xDrawPage);
+ if(!pWindow)
+ return false;
+
+ pWindow->Show();
+ pWindow->getContext()->makeCurrent();
+ Size aSize = pWindow->GetSizePixel();
+ pWindow->getContext()->setWinSize(aSize);
+ return true;
+}
- OpenGLChartAdapter* pAdapter = dynamic_cast<OpenGLChartAdapter*>(pRenderer);
- if(!pAdapter)
- return;
+void OpenglShapeFactory::postRender(OpenGLWindow* pWindow)
+{
+ pWindow->getContext()->swapBuffers();
+}
- uno::Reference< drawing::XShapes > xRootShape = pAdapter->getShapes();
+void OpenglShapeFactory::clearPage(uno::Reference< drawing::XDrawPage > xDrawPage)
+{
+ uno::Reference< drawing::XShapes > xRootShape = getChartShape(xDrawPage);
dummy::DummyChart* pChart = dynamic_cast<dummy::DummyChart*>(xRootShape.get());
assert(pChart);
pChart->clear();
commit adde0537865430e0f9a49325087ff65c6db89112
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Sun Jun 1 01:23:10 2014 +0200
no need for that include
Change-Id: Ifd3438224a824c190b87ea011e6c02668ad0a3e2
diff --git a/chart2/source/view/inc/GL3DRenderer.hxx b/chart2/source/view/inc/GL3DRenderer.hxx
index 61d297b..e56d6d7 100644
--- a/chart2/source/view/inc/GL3DRenderer.hxx
+++ b/chart2/source/view/inc/GL3DRenderer.hxx
@@ -20,7 +20,6 @@
#include <tools/gen.hxx>
#include <vcl/bitmapex.hxx>
-#include <vcl/opengl/IOpenGLRenderer.hxx>
#include <vector>
#include <list>
commit b179ed7f59697333c3a0b8ea64eb8f6ccc682834
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Sat May 31 23:21:16 2014 +0200
we don't support the simple backgriund anymore
Change-Id: I4a0238f5a2729f8b7ace3988c3fe890fba2a4341
diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx
index 5281387..55ed103 100644
--- a/chart2/source/view/main/GL3DRenderer.cxx
+++ b/chart2/source/view/main/GL3DRenderer.cxx
@@ -1692,34 +1692,24 @@ void OpenGL3DRenderer::CreateSceneBoxView()
void OpenGL3DRenderer::ClearBuffer()
{
- static bool bOldRender = getenv("OLDRENDER");
- if (!bOldRender) // gradient background
- {
- glDisable(GL_DEPTH_TEST);
- glDisable(GL_LIGHTING);
+ glDisable(GL_DEPTH_TEST);
+ glDisable(GL_LIGHTING);
- glClearDepth(1.0f);
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+ glClearDepth(1.0f);
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- glBegin (GL_QUADS);
- glColor3f(0.3,0.3,0.3);
- glVertex3f (-1.0f, -1.0f, -1.0f);
- glVertex3f (1.0f, -1.0f, -1.0f);
+ glBegin (GL_QUADS);
+ glColor3f(0.3,0.3,0.3);
+ glVertex3f (-1.0f, -1.0f, -1.0f);
+ glVertex3f (1.0f, -1.0f, -1.0f);
- glColor3f(0.0,0.0,0.0);
- glVertex3f (1.0f, 1.0f, -1.0f);
- glVertex3f (-1.0f, 1.0f, -1.0f);
- glEnd ();
+ glColor3f(0.0,0.0,0.0);
+ glVertex3f (1.0f, 1.0f, -1.0f);
+ glVertex3f (-1.0f, 1.0f, -1.0f);
+ glEnd ();
- glEnable(GL_LIGHTING);
- glEnable(GL_DEPTH_TEST);
- }
- else
- {
- glClearDepth(1.0f);
- glClearColor (1.0, 0.5, 0.5, 1.0);
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- }
+ glEnable(GL_LIGHTING);
+ glEnable(GL_DEPTH_TEST);
}
void OpenGL3DRenderer::ProcessUnrenderedShape(bool bNewScene)
More information about the Libreoffice-commits
mailing list