[Libreoffice-commits] core.git: 6 commits - chart2/source
Markus Mohrhard
markus.mohrhard at collabora.co.uk
Fri Jul 11 19:46:55 PDT 2014
chart2/source/view/charttypes/GL3DBarChart.cxx | 267 +++++++++++++++----------
chart2/source/view/inc/GL3DBarChart.hxx | 20 +
chart2/source/view/main/OpenGLRender.cxx | 79 -------
chart2/source/view/main/OpenGLRender.hxx | 20 -
4 files changed, 184 insertions(+), 202 deletions(-)
New commits:
commit 664fb35ab522c40d298012922f059f6d48006355
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Fri Jul 11 05:34:41 2014 +0200
first part for threaded chart rendering, fdo#81110
It is nor working correctly yet.
Change-Id: Ic592eb2f50265886ad6d97539d2c52d7c45179e6
diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index f80ea99..8ce235f 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -23,6 +23,108 @@ using namespace com::sun::star;
namespace chart {
+const size_t STEPS = 200;
+
+class RenderThread : public salhelper::Thread
+{
+public:
+ RenderThread(GL3DBarChart* pChart);
+
+protected:
+
+ void renderFrame();
+ GL3DBarChart* mpChart;
+};
+
+RenderThread::RenderThread(GL3DBarChart* pChart):
+ salhelper::Thread("RenderThread"),
+ mpChart(pChart)
+{
+}
+
+void RenderThread::renderFrame()
+{
+ if(!mpChart->mbValidContext)
+ return;
+
+ mpChart->mrWindow.getContext().makeCurrent();
+ Size aSize = mpChart->mrWindow.GetSizePixel();
+ mpChart->mpRenderer->SetSize(aSize);
+ if(mpChart->mbNeedsNewRender)
+ {
+ for(boost::ptr_vector<opengl3D::Renderable3DObject>::iterator itr = mpChart->maShapes.begin(),
+ itrEnd = mpChart->maShapes.end(); itr != itrEnd; ++itr)
+ {
+ itr->render();
+ }
+ }
+ else
+ {
+ mpChart->mpCamera->render();
+ }
+ mpChart->mpRenderer->ProcessUnrenderedShape(mpChart->mbNeedsNewRender);
+ mpChart->mbNeedsNewRender = false;
+ mpChart->mrWindow.getContext().swapBuffers();
+
+}
+
+class RenderOneFrameThread : public RenderThread
+{
+public:
+ RenderOneFrameThread(GL3DBarChart* pChart):
+ RenderThread(pChart)
+ {}
+
+protected:
+
+ virtual void execute() SAL_OVERRIDE;
+};
+
+void RenderOneFrameThread::execute()
+{
+ osl::MutexGuard aGuard(mpChart->maMutex);
+ renderFrame();
+}
+
+class RenderAnimationThread : public RenderThread
+{
+public:
+ RenderAnimationThread(GL3DBarChart* pChart, const glm::vec3& rStartPos, const glm::vec3& rEndPos,
+ const sal_Int32 nSteps = STEPS):
+ RenderThread(pChart),
+ maStartPos(rStartPos),
+ maEndPos(rEndPos),
+ mnSteps(nSteps)
+ {
+ }
+
+protected:
+
+ virtual void execute() SAL_OVERRIDE;
+
+private:
+ glm::vec3 maStartPos;
+ glm::vec3 maEndPos;
+ sal_Int32 mnSteps;
+
+};
+
+void RenderAnimationThread::execute()
+{
+ osl::MutexGuard aGuard(mpChart->maMutex);
+ glm::vec3 aStep = (maEndPos - maStartPos)/(float)mnSteps;
+ for(sal_Int32 i = 0; i < mnSteps; ++i)
+ {
+ mpChart->maCameraPosition += aStep;
+ mpChart->mpCamera->setPosition(mpChart->maCameraPosition);
+ /*
+ mpChart->maCameraDirection += mpChart->maStepDirection;
+ mpChart->mpCamera->setDirection(mpChart->maCameraDirection);
+ */
+ renderFrame();
+ }
+}
+
GL3DBarChart::GL3DBarChart(
const css::uno::Reference<css::chart2::XChartType>& xChartType,
OpenGLWindow& rWindow) :
@@ -32,8 +134,6 @@ GL3DBarChart::GL3DBarChart(
mpCamera(NULL),
mbValidContext(true),
mpTextCache(new opengl3D::TextCache()),
- mnStep(0),
- mnStepsTotal(0),
mnMaxX(0),
mnMaxY(0),
mnDistance(0.0),
@@ -59,6 +159,9 @@ GL3DBarChart::BarInformation::BarInformation(const glm::vec3& rPos, float nVal,
GL3DBarChart::~GL3DBarChart()
{
+ if(mpRenderThread.is())
+ mpRenderThread->join();
+ osl::MutexGuard aGuard(maMutex);
if(mbValidContext)
mrWindow.setRenderer(NULL);
}
@@ -67,7 +170,6 @@ namespace {
const float TEXT_HEIGHT = 10.0f;
float DEFAULT_CAMERA_HEIGHT = 500.0f;
-const size_t STEPS = 200;
const sal_uLong TIMEOUT = 5;
const sal_uInt32 ID_STEP = 10;
@@ -108,6 +210,7 @@ double findMaxValue(const boost::ptr_vector<VDataSeries>& rDataSeriesContainer)
void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSeriesContainer,
ExplicitCategoriesProvider& rCatProvider)
{
+ osl::MutexGuard aGuard(maMutex);
mpRenderer->ReleaseShapes();
// Each series of data flows from left to right, and multiple series are
// stacked vertically along y axis.
@@ -297,35 +400,14 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSer
mbNeedsNewRender = true;
}
-void GL3DBarChart::render()
+void GL3DBarChart::update()
{
- if(!mbValidContext)
- return;
-
- mrWindow.getContext().makeCurrent();
+ if(mpRenderThread.is())
+ mpRenderThread->join();
Size aSize = mrWindow.GetSizePixel();
- mpRenderer->SetSize(aSize);
mrWindow.getContext().setWinSize(aSize);
- if(mbNeedsNewRender)
- {
- for(boost::ptr_vector<opengl3D::Renderable3DObject>::iterator itr = maShapes.begin(),
- itrEnd = maShapes.end(); itr != itrEnd; ++itr)
- {
- itr->render();
- }
- }
- else
- {
- mpCamera->render();
- }
- mpRenderer->ProcessUnrenderedShape(mbNeedsNewRender);
- mbNeedsNewRender = false;
- mrWindow.getContext().swapBuffers();
-}
-
-void GL3DBarChart::update()
-{
- render();
+ mpRenderThread = rtl::Reference<RenderThread>(new RenderOneFrameThread(this));
+ mpRenderThread->launch();
}
namespace {
@@ -352,26 +434,31 @@ public:
void GL3DBarChart::moveToDefault()
{
- mnStepsTotal = STEPS;
- mnStep = 0;
- mbBlockUserInput = true;
- glm::vec3 maTargetPosition = maDefaultCameraPosition;
- maStep = (maTargetPosition - maCameraPosition)/((float)mnStepsTotal);
+ osl::MutexGuard aGuard(maMutex);
+ if(mpRenderThread.is())
+ mpRenderThread->join();
+ Size aSize = mrWindow.GetSizePixel();
+ mrWindow.getContext().setWinSize(aSize);
+ mpRenderThread = rtl::Reference<RenderThread>(new RenderAnimationThread(this, maCameraPosition, maDefaultCameraPosition, STEPS));
+ mpRenderThread->launch();
+
+ /*
+ * TODO: moggi: add to thread
glm::vec3 maTargetDirection = maDefaultCameraDirection;
maStepDirection = (maTargetDirection - maCameraDirection)/((float)mnStepsTotal);
- maTimer.SetTimeout(TIMEOUT);
- maTimer.SetTimeoutHdl(LINK(this, GL3DBarChart, MoveToBar));
- maTimer.Start();
+ */
}
void GL3DBarChart::clickedAt(const Point& rPos, sal_uInt16 nButtons)
{
if(mbBlockUserInput)
return;
+
if (nButtons == MOUSE_RIGHT)
{
moveToDefault();
+ return;
}
if(nButtons != MOUSE_LEFT)
@@ -380,10 +467,12 @@ void GL3DBarChart::clickedAt(const Point& rPos, sal_uInt16 nButtons)
sal_uInt32 nId = 5;
{
PickingModeSetter aPickingModeSetter(mpRenderer.get());
- render();
+ update();
+ mpRenderThread->join();
nId = mpRenderer->GetPixelColorFromPoint(rPos.X(), rPos.Y());
}
+ osl::MutexGuard aGuard(maMutex);
std::map<sal_uInt32, const BarInformation>::const_iterator itr =
maBarMap.find(nId);
@@ -393,30 +482,39 @@ void GL3DBarChart::clickedAt(const Point& rPos, sal_uInt16 nButtons)
mbBlockUserInput = true;
const BarInformation& rBarInfo = itr->second;
- mnStepsTotal = STEPS;
- mnStep = 0;
- render();
+
+ if(mpRenderThread.is())
+ mpRenderThread->join();
+
+ maShapes.push_back(new opengl3D::ScreenText(mpRenderer.get(), *mpTextCache,
+ OUString("Value: ") + OUString::number(rBarInfo.mnVal), 0));
+ opengl3D::ScreenText* pScreenText = static_cast<opengl3D::ScreenText*>(&maShapes.back());
+ pScreenText->setPosition(glm::vec2(-0.9f, 0.9f), glm::vec2(-0.6f, 0.8f));
+ pScreenText->render();
glm::vec3 maTargetPosition = rBarInfo.maPos;
maTargetPosition.z += 240;
maTargetPosition.y += BAR_SIZE_Y / 2.0f;
- maStep = (maTargetPosition - maCameraPosition)/((float)mnStepsTotal);
+ Size aSize = mrWindow.GetSizePixel();
+ mrWindow.getContext().setWinSize(aSize);
+ mpRenderThread = rtl::Reference<RenderThread>(new RenderAnimationThread(this, maCameraPosition, maTargetPosition, STEPS));
+ mpRenderThread->launch();
+ /*
+ * TODO: moggi: add to thread
glm::vec3 maTargetDirection = rBarInfo.maPos;
maTargetDirection.x += BAR_SIZE_X / 2.0f;
maTargetDirection.y += BAR_SIZE_Y / 2.0f;
maStepDirection = (maTargetDirection - maCameraDirection)/((float)mnStepsTotal);
+ */
- maTimer.SetTimeout(TIMEOUT);
- maTimer.SetTimeoutHdl(LINK(this, GL3DBarChart, MoveToBar));
- maTimer.Start();
+}
- maShapes.push_back(new opengl3D::ScreenText(mpRenderer.get(), *mpTextCache,
- OUString("Value: ") + OUString::number(rBarInfo.mnVal), 0));
- opengl3D::ScreenText* pScreenText = static_cast<opengl3D::ScreenText*>(&maShapes.back());
- pScreenText->setPosition(glm::vec2(-0.9f, 0.9f), glm::vec2(-0.6f, 0.8f));
- pScreenText->render();
+void GL3DBarChart::render()
+{
+ osl::MutexGuard aGuard(maMutex);
+ update();
}
void GL3DBarChart::mouseDragMove(const Point& rStartPos, const Point& rEndPos, sal_uInt16 )
@@ -473,76 +571,33 @@ glm::vec3 GL3DBarChart::getCornerPosition(sal_Int8 nId)
void GL3DBarChart::moveToCorner()
{
- mnStepsTotal = STEPS;
- maStep = (getCornerPosition(mnCornerId) - maCameraPosition) / float(mnStepsTotal);
-
- maStepDirection = (glm::vec3(mnMaxX/2.0f, mnMaxY/2.0f, 0) - maCameraDirection)/ float(mnStepsTotal);
- maTimer.SetTimeout(TIMEOUT);
- maTimer.SetTimeoutHdl(LINK(this, GL3DBarChart, MoveCamera));
- maTimer.Start();
-}
-
-IMPL_LINK_NOARG(GL3DBarChart, MoveCamera)
-{
- maTimer.Stop();
- if(mnStep < mnStepsTotal)
- {
- ++mnStep;
- maCameraPosition += maStep;
- mpCamera->setPosition(maCameraPosition);
- maCameraDirection += maStepDirection;
- mpCamera->setDirection(maCameraDirection);
- render();
- maTimer.SetTimeout(TIMEOUT);
- maTimer.Start();
- }
- else
- {
- mbBlockUserInput = false;
- mnStep = 0;
- }
+ osl::MutexGuard aGuard(maMutex);
+ if(mpRenderThread.is())
+ mpRenderThread->join();
- return 0;
-}
-
-IMPL_LINK_NOARG(GL3DBarChart, MoveToBar)
-{
- maTimer.Stop();
- if(mnStep < mnStepsTotal)
- {
- ++mnStep;
- maCameraPosition += maStep;
- mpCamera->setPosition(maCameraPosition);
- maCameraDirection += maStepDirection;
- mpCamera->setDirection(maCameraDirection);
- render();
- maTimer.SetTimeout(TIMEOUT);
- maTimer.Start();
- }
- else
- {
- maShapes.pop_back();
- mpRenderer->ReleaseScreenTextShapes();
- mbBlockUserInput = false;
- mnStep = 0;
- }
+ Size aSize = mrWindow.GetSizePixel();
+ mrWindow.getContext().setWinSize(aSize);
+ mpRenderThread = rtl::Reference<RenderThread>(new RenderAnimationThread(this, getCornerPosition(mnCornerId),
+ maCameraPosition, STEPS));
+ mpRenderThread->launch();
- return 0;
+ // TODO: moggi: add to thread
+ // maStepDirection = (glm::vec3(mnMaxX/2.0f, mnMaxY/2.0f, 0) - maCameraDirection)/ float(mnStepsTotal);
}
void GL3DBarChart::scroll(long nDelta)
{
- if(mbBlockUserInput)
- return;
+ osl::MutexGuard aGuard(maMutex);
glm::vec3 maDir = glm::normalize(maCameraPosition - maCameraDirection);
maCameraPosition -= (float((nDelta/10)) * maDir);
mpCamera->setPosition(maCameraPosition);
- render();
+ update();
}
void GL3DBarChart::contextDestroyed()
{
+ osl::MutexGuard aGuard(maMutex);
mbValidContext = false;
}
diff --git a/chart2/source/view/inc/GL3DBarChart.hxx b/chart2/source/view/inc/GL3DBarChart.hxx
index b14de46..2517627 100644
--- a/chart2/source/view/inc/GL3DBarChart.hxx
+++ b/chart2/source/view/inc/GL3DBarChart.hxx
@@ -21,6 +21,9 @@
#include <vcl/timer.hxx>
#include <vcl/openglwin.hxx>
+#include <rtl/ref.hxx>
+#include <salhelper/thread.hxx>
+
namespace chart {
class ExplicitCategoriesProvider;
@@ -34,8 +37,15 @@ class Camera;
}
+class RenderThread;
+class RenderOneFrameThread;
+class RenderAnimationThread;
+
class GL3DBarChart : public GL3DPlotterBase, public IRenderer
{
+ friend class RenderThread;
+ friend class RenderOneFrameThread;
+ friend class RenderAnimationThread;
public:
GL3DBarChart(
const css::uno::Reference<css::chart2::XChartType>& xChartType,
@@ -61,9 +71,6 @@ private:
void moveToDefault();
glm::vec3 getCornerPosition(sal_Int8 nCornerId);
- DECL_LINK(MoveCamera, void*);
- DECL_LINK(MoveToBar, void*);
-
css::uno::Reference<css::chart2::XChartType> mxChartType;
boost::ptr_vector<opengl3D::Renderable3DObject> maShapes;
@@ -81,11 +88,7 @@ private:
glm::vec3 maDefaultCameraPosition;
glm::vec3 maDefaultCameraDirection;
- Timer maTimer;
- glm::vec3 maStep;
glm::vec3 maStepDirection;
- size_t mnStep;
- size_t mnStepsTotal;
float mnMaxX;
float mnMaxY;
float mnDistance;
@@ -112,6 +115,9 @@ private:
bool mbBlockUserInput;
bool mbNeedsNewRender;
bool mbCameraInit;
+
+ osl::Mutex maMutex;
+ rtl::Reference<RenderThread> mpRenderThread;
};
}
commit b75f6baa3ae3c9c505068c5e4fc50bf261a43253
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Wed Jul 9 07:55:47 2014 +0200
remove unused defines
Change-Id: Ic9118c390f4ba69e245cb16032d3cbe19c741b11
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index 63dd0d5..2c93d36 100644
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -43,9 +43,6 @@
using namespace com::sun::star;
#define DEBUG_PNG 0
-#if RENDER_TO_FILE
-#define BMP_HEADER_LEN 54
-#endif
#if DEBUG_PNG
#include <vcl/pngwrite.hxx>
@@ -53,11 +50,6 @@ using namespace com::sun::star;
#define GL_PI 3.14159f
-#if defined( _WIN32 )
-#define WGL_SAMPLE_BUFFERS_ARB 0x2041
-#define WGL_SAMPLES_ARB 0x2042
-#endif
-
#define Z_STEP 0.001f
static GLfloat squareVertices[] = {
diff --git a/chart2/source/view/main/OpenGLRender.hxx b/chart2/source/view/main/OpenGLRender.hxx
index 20f7a222..f2482f0 100644
--- a/chart2/source/view/main/OpenGLRender.hxx
+++ b/chart2/source/view/main/OpenGLRender.hxx
@@ -25,8 +25,6 @@
#include "glm/gtx/euler_angles.hpp"
#include "glm/gtx/quaternion.hpp"
-#define BMP_HEADER_LEN 54
-
#define OPENGL_SCALE_VALUE 20
#define DEBUG_POSITIONING 0
#define RENDER_TO_FILE 0
commit fc2a20fe8e1ced0a065e3c08e51216da85f46ca7
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Wed Jul 9 07:41:44 2014 +0200
using memset on a vector is just so wrong
Change-Id: Ia022f5d0200a60d993c74f2c9f29f906c6284f0f
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index a05715a..63dd0d5 100644
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -371,16 +371,10 @@ OpenGLRender::OpenGLRender()
, m_SymbolShapeID(0)
{
//TODO: moggi: use STL
- memset(&m_Line2DPointList, 0, sizeof(PointList));
-
- memset(&m_Bubble2DCircle, 0, sizeof(m_Bubble2DCircle));
-
- //TODO: moggi: use STL
for (size_t i = 0; i < sizeof(m_BackgroundColor) / sizeof(float); i++)
{
m_BackgroundColor[i] = 1.0;
}
- memset(&m_Area2DPointList, 0, sizeof(m_Area2DPointList));
}
OpenGLRender::~OpenGLRender()
commit 40e22a429b85029a6282daefd1c91a6c090108c9
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Wed Jul 9 07:41:05 2014 +0200
we only need one typedef for PointList
Change-Id: Ic64f871e014bd48c5eadb6f92b69c6466d812925
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index a028683..a05715a 100644
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -240,7 +240,7 @@ int OpenGLRender::RenderLine2FBO(int)
m_MVP = m_Projection * m_View * m_Model;
for (size_t i = 0; i < listNum; i++)
{
- Line2DPointList &pointList = m_Line2DShapePointList.front();
+ PointList &pointList = m_Line2DShapePointList.front();
//fill vertex buffer
glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
CHECK_GL_ERROR();
@@ -371,7 +371,7 @@ OpenGLRender::OpenGLRender()
, m_SymbolShapeID(0)
{
//TODO: moggi: use STL
- memset(&m_Line2DPointList, 0, sizeof(Line2DPointList));
+ memset(&m_Line2DPointList, 0, sizeof(PointList));
memset(&m_Bubble2DCircle, 0, sizeof(m_Bubble2DCircle));
@@ -858,7 +858,7 @@ int OpenGLRender::SetArea2DShapePoint(float x, float y, int listLength)
namespace {
// only 2D
-bool checkCCW(const Area2DPointList& rPoints)
+bool checkCCW(const PointList& rPoints)
{
if(rPoints.size() < 3)
return true;
@@ -893,7 +893,7 @@ int OpenGLRender::RenderArea2DShape()
m_MVP = m_Projection * m_View * m_Model;
for (size_t i = 0; i < listNum; ++i)
{
- Area2DPointList &pointList = m_Area2DShapePointList.front();
+ PointList &pointList = m_Area2DShapePointList.front();
bool bIsCCW = checkCCW(pointList); // is it counter clockwise (CCW) or clockwise (CW)
if(!bIsCCW)
glFrontFace(GL_CW);
@@ -979,7 +979,7 @@ void OpenGLRender::SetChartTransparencyGradient(long transparencyGradient)
void OpenGLRender::GeneratePieSegment2D(double fInnerRadius, double fOutterRadius, double nAngleStart, double nAngleWidth)
{
double nAngleStep = 1;
- PieSegment2DPointList aPointList;
+ PointList aPointList;
// TODO: moggi: GL_TRIANGLE_FAN seems not to work
bool bInnerRadiusNotZero = true; //!rtl::math::approxEqual(0.0, fInnerRadius);
size_t nVectorSize = 3*(nAngleWidth/nAngleStep);
@@ -1026,7 +1026,7 @@ int OpenGLRender::RenderPieSegment2DShape(float fSize, float fPosX, float fPosY)
for (int i = 0; i < listNum; i++)
{
- PieSegment2DPointList &pointList = m_PieSegment2DShapePointList.back();
+ PointList &pointList = m_PieSegment2DShapePointList.back();
//fill vertex buffer
glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
glBufferData(GL_ARRAY_BUFFER, pointList.size() * sizeof(float), &pointList[0] , GL_STATIC_DRAW);
diff --git a/chart2/source/view/main/OpenGLRender.hxx b/chart2/source/view/main/OpenGLRender.hxx
index 7812e32..20f7a222 100644
--- a/chart2/source/view/main/OpenGLRender.hxx
+++ b/chart2/source/view/main/OpenGLRender.hxx
@@ -38,8 +38,6 @@ struct PosVecf3
float z;
};
-typedef std::vector<GLfloat> Line2DPointList;
-
struct Bubble2DPointList
{
float x;
@@ -64,8 +62,6 @@ struct TextInfo
float nDy;
};
-typedef std::vector<GLfloat> Area2DPointList;
-typedef std::vector<GLfloat> PieSegment2DPointList;
typedef std::vector<GLfloat> PointList;
// for 3D, use vector to save the points
@@ -159,11 +155,11 @@ private:
GLuint m_RenderTexCoordBuf;
- Line2DPointList m_Line2DPointList;
+ PointList m_Line2DPointList;
float m_fLineWidth;
- std::list <Line2DPointList> m_Line2DShapePointList;
+ std::list <PointList> m_Line2DShapePointList;
glm::vec4 m_2DColor;
@@ -186,8 +182,8 @@ private:
GLuint m_TextTexCoordBuf;
GLint m_TextTexID;
- Area2DPointList m_Area2DPointList;
- std::list <Area2DPointList> m_Area2DShapePointList;
+ PointList m_Area2DPointList;
+ std::list <PointList> m_Area2DShapePointList;
GLint m_BackgroundProID;
GLint m_BackgroundMatrixID;
@@ -196,7 +192,7 @@ private:
float m_BackgroundColor[16];
- std::list <PieSegment2DPointList> m_PieSegment2DShapePointList;
+ std::list <PointList> m_PieSegment2DShapePointList;
PointList m_Symbol2DPointList;
std::list<PointList> m_Symbol2DShapePointList;
commit 6162e32edd89d7ac3358b12e114781b397d11f52
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Wed Jul 9 07:30:48 2014 +0200
killed this method again
This method must be a zombie as it reappears again and again despite
being killed.
Change-Id: Ic41e3259f2125eca7d114f54b032553e53bf71a2
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index 6abb825..a028683 100644
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -396,38 +396,6 @@ void OpenGLRender::SetSize(int width, int height)
m_Projection = glm::ortho(0.f, float(m_iWidth), 0.f, float(m_iHeight), -4.f, 3.f);
}
-#if RENDER_TO_FILE
-int OpenGLRender::CreateBMPHeader(sal_uInt8 *bmpHeader, int xsize, int ysize)
-{
- unsigned char header[BMP_HEADER_LEN] = {
- 0x42, 0x4d, 0, 0, 0, 0, 0, 0, 0, 0,
- 54, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 24, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0
- };
-
- long file_size = (long)xsize * (long)ysize * 3 + 54;
- header[2] = (unsigned char)(file_size &0x000000ff);
- header[3] = (file_size >> 8) & 0x000000ff;
- header[4] = (file_size >> 16) & 0x000000ff;
- header[5] = (file_size >> 24) & 0x000000ff;
-
- long width = xsize;
- header[18] = width & 0x000000ff;
- header[19] = (width >> 8) &0x000000ff;
- header[20] = (width >> 16) &0x000000ff;
- header[21] = (width >> 24) &0x000000ff;
-
- long height = -ysize;
- header[22] = height &0x000000ff;
- header[23] = (height >> 8) &0x000000ff;
- header[24] = (height >> 16) &0x000000ff;
- header[25] = (height >> 24) &0x000000ff;
- memcpy(bmpHeader, header, BMP_HEADER_LEN);
- return 0;
-}
-#endif
-
void OpenGLRender::SetLine2DColor(sal_uInt8 r, sal_uInt8 g, sal_uInt8 b, sal_uInt8 nAlpha)
{
m_2DColor = glm::vec4((float)r / 255.0f, (float)g / 255.0f, (float)b / 255.0f, nAlpha/255.f);
diff --git a/chart2/source/view/main/OpenGLRender.hxx b/chart2/source/view/main/OpenGLRender.hxx
index d68ffff..7812e32 100644
--- a/chart2/source/view/main/OpenGLRender.hxx
+++ b/chart2/source/view/main/OpenGLRender.hxx
@@ -79,9 +79,6 @@ public:
int MoveModelf(PosVecf3 trans, PosVecf3 angle, PosVecf3 scale);
void SetSize(int width, int height);
void Release();
-#if RENDER_TO_FILE
- int CreateBMPHeader(sal_uInt8 *bmpHeader, int xsize, int ysize);
-#endif
int RenderLine2FBO(int wholeFlag);
int SetLine2DShapePoint(float x, float y, int listLength);
void SetLine2DColor(sal_uInt8 r, sal_uInt8 g, sal_uInt8 b, sal_uInt8 nAlpha);
commit 2f8841dd0a4cbd768984a34470f999105720a8c0
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Wed Jul 9 07:28:41 2014 +0200
remove unused method
Change-Id: I3b3006230476b0d16dad54035b0c80a95cbc2b20
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index 02e87a7..6abb825 100644
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -208,29 +208,6 @@ int OpenGLRender::InitOpenGL()
return 0;
}
-BitmapEx OpenGLRender::GetAsBitmap()
-{
- boost::scoped_array<sal_uInt8> buf(new sal_uInt8[m_iWidth * m_iHeight * 4]);
- glReadPixels(0, 0, m_iWidth, m_iHeight, GL_BGRA, GL_UNSIGNED_BYTE, buf.get());
-
- BitmapEx aBmp = OpenGLHelper::ConvertBGRABufferToBitmapEx(buf.get(), m_iWidth, m_iHeight);
-
-#if DEBUG_PNG // debug PNG writing
- static int nIdx = 0;
- OUString aName = OUString( "file:///home/moggi/Documents/work/" ) + OUString::number( nIdx++ ) + ".png";
- try {
- vcl::PNGWriter aWriter( aBmp );
- SvFileStream sOutput( aName, STREAM_WRITE );
- aWriter.Write( sOutput );
- sOutput.Close();
- } catch (...) {
- SAL_WARN("chart2.opengl", "Error writing png to " << aName);
- }
-#endif
-
- return aBmp;
-}
-
int OpenGLRender::SetLine2DShapePoint(float x, float y, int listLength)
{
if (m_Line2DPointList.empty())
diff --git a/chart2/source/view/main/OpenGLRender.hxx b/chart2/source/view/main/OpenGLRender.hxx
index 71e25e4..d68ffff 100644
--- a/chart2/source/view/main/OpenGLRender.hxx
+++ b/chart2/source/view/main/OpenGLRender.hxx
@@ -86,7 +86,6 @@ public:
int SetLine2DShapePoint(float x, float y, int listLength);
void SetLine2DColor(sal_uInt8 r, sal_uInt8 g, sal_uInt8 b, sal_uInt8 nAlpha);
void SetLine2DWidth(int width);
- BitmapEx GetAsBitmap();
void SetColor(sal_uInt32 color, sal_uInt8 nAlpha);
int Bubble2DShapePoint(float x, float y, float directionX, float directionY);
int RenderBubble2FBO(int wholeFlag);
More information about the Libreoffice-commits
mailing list