chart2/source/view/inc/DummyXShape.hxx | 6 +++-- chart2/source/view/main/DummyXShape.cxx | 28 ++++++++++++++++++++++- chart2/source/view/main/OpenGLRender.cxx | 30 ++----------------------- chart2/source/view/main/OpenGLRender.hxx | 2 - chart2/source/view/main/OpenglShapeFactory.cxx | 2 - 5 files changed, 35 insertions(+), 33 deletions(-)
New commits: commit 2899198a720c1254ba862ce8615054800dbcfd71 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Sun Jan 5 07:04:18 2014 +0100 integrate Area2D rendering path into OpenGL backend Change-Id: Iaf226c4f60ba497defb6e2dbd127e78d3fe09517 diff --git a/chart2/source/view/inc/DummyXShape.hxx b/chart2/source/view/inc/DummyXShape.hxx index 0676cb9..71a8b20 100644 --- a/chart2/source/view/inc/DummyXShape.hxx +++ b/chart2/source/view/inc/DummyXShape.hxx @@ -305,10 +305,12 @@ private: class DummyArea2D : public DummyXShape { public: - DummyArea2D(const drawing::PolyPolygonShape3D& rShape); + DummyArea2D(const drawing::PointSequenceSequence& rShape); + + virtual void render() SAL_OVERRIDE; private: - drawing::PolyPolygonShape3D maShapes; + drawing::PointSequenceSequence maShapes; }; class DummySymbol2D : public DummyXShape diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx index 8e8d2c8..f17dc2a 100644 --- a/chart2/source/view/main/DummyXShape.cxx +++ b/chart2/source/view/main/DummyXShape.cxx @@ -357,11 +357,37 @@ DummyArea3D::DummyArea3D(const drawing::PolyPolygonShape3D& rShape, double fDept { } -DummyArea2D::DummyArea2D(const drawing::PolyPolygonShape3D& rShape): +DummyArea2D::DummyArea2D(const drawing::PointSequenceSequence& rShape): maShapes(rShape) { } +void DummyArea2D::render() +{ + DummyChart* pChart = getRootShape(); + sal_Int32 nPointssCount = maShapes.getLength(); + for(sal_Int32 i = 0; i < nPointssCount; i++) + { + const com::sun::star::uno::Sequence<com::sun::star::awt::Point>& points = maShapes[i]; + sal_Int32 nPointsCount = points.getLength(); + for(sal_Int32 j = 0; j < nPointsCount; j++) + { + const com::sun::star::awt::Point& p = points[j]; + pChart->m_GLRender.SetArea2DShapePoint((float)p.X, (float)p.Y, nPointsCount); + } + } + + std::map<OUString, uno::Any>::const_iterator itr = maProperties.find(UNO_NAME_FILLCOLOR); + if(itr != maProperties.end()) + { + sal_Int32 nColor = itr->second.get<sal_Int32>(); + pChart->m_GLRender.SetColor(nColor); + } + + //render the shape + pChart->m_GLRender.RenderArea2DShape(); +} + DummySymbol2D::DummySymbol2D(const drawing::Position3D& rPos, const drawing::Direction3D& rSize, sal_Int32 nStandardSymbol, sal_Int32 , sal_Int32 ): mnStandardSymbol(nStandardSymbol) diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx index 5d5b2cc..fdc5a16 100644 --- a/chart2/source/view/main/OpenGLRender.cxx +++ b/chart2/source/view/main/OpenGLRender.cxx @@ -1520,33 +1520,7 @@ int OpenGLRender::CreateBMPHeaderRGBA(sal_uInt8 *bmpHeader, int xsize, int ysize return 0; } -int OpenGLRender::ProcessArea2D(uno::Reference< drawing::XShape > &xShape) -{ - //get point from shape - uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY ); - com::sun::star::uno::Sequence<drawing::PointSequence> pointss; - com::sun::star::uno::Any value = xProp->getPropertyValue(UNO_NAME_POLYPOLYGON); - value >>= pointss; - int pointsscount = pointss.getLength(); - - uno::Any co = xProp->getPropertyValue(UNO_NAME_FILLCOLOR); - long *colorvalue = (long*)co.getValue(); - SetColor(*colorvalue); - for(int i = 0; i < pointsscount; i++) - { - com::sun::star::uno::Sequence<com::sun::star::awt::Point> points = pointss[i]; - int pointscount = points.getLength(); - for(int j = 0; j < pointscount; j++) - { - com::sun::star::awt::Point p = points[j]; - SetArea2DShapePoint((float)p.X, (float)p.Y, pointscount); - } - } - //render the shape - RenderArea2DShape(); - m_fZStep += 0.01f; - return 0; -} + int OpenGLRender::SetArea2DShapePoint(float x, float y, int listLength) { if (!m_Area2DPointList.pointBuf) @@ -1576,6 +1550,7 @@ int OpenGLRender::SetArea2DShapePoint(float x, float y, int listLength) } return 0; } + int OpenGLRender::RenderArea2DShape() { glDisable(GL_MULTISAMPLE); @@ -1617,6 +1592,7 @@ int OpenGLRender::RenderArea2DShape() free(pointList.pointBuf); } glEnable(GL_MULTISAMPLE); + m_fZStep += 0.01f; return 0; } diff --git a/chart2/source/view/main/OpenGLRender.hxx b/chart2/source/view/main/OpenGLRender.hxx index 88adfe9..d7ebfe1 100644 --- a/chart2/source/view/main/OpenGLRender.hxx +++ b/chart2/source/view/main/OpenGLRender.hxx @@ -185,8 +185,6 @@ public: int RenderTextShape(); int SetArea2DShapePoint(float x, float y, int listLength); - int ProcessArea2D(com::sun::star::uno::Reference< - com::sun::star::drawing::XShape > &xShape); int RenderArea2DShape(); private: GLint LoadShaders(const char *vertexShader,const char *fragmentShader); diff --git a/chart2/source/view/main/OpenglShapeFactory.cxx b/chart2/source/view/main/OpenglShapeFactory.cxx index f22dc84..7008777 100644 --- a/chart2/source/view/main/OpenglShapeFactory.cxx +++ b/chart2/source/view/main/OpenglShapeFactory.cxx @@ -257,7 +257,7 @@ uno::Reference< drawing::XShape > OpenglShapeFactory::createArea2D( const uno::Reference< drawing::XShapes >& xTarget , const drawing::PolyPolygonShape3D& rPolyPolygon ) { - dummy::DummyArea2D* pArea = new dummy::DummyArea2D(rPolyPolygon); + dummy::DummyArea2D* pArea = new dummy::DummyArea2D(PolyToPointSequence(rPolyPolygon)); xTarget->add(pArea); return pArea; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits