summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-05-28 01:18:10 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-05-28 02:09:18 +0200
commitf9f8d930a17eb14365f914425c35df5a78f648ca (patch)
tree68a848ab64bee8e8ac75ed90c23d2b262f114044 /chart2
parent16642b7febf95f43662e6ac5edaba51cb0937c16 (diff)
enable picking again
Right now with an ugly work-around. The image is vertically flipped so we just adapt our access to it. Change-Id: I0128f54d4a0fbe697dc8726f6e255111ecb8412f
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/view/charttypes/GL3DBarChart.cxx4
-rw-r--r--chart2/source/view/main/GL3DRenderer.cxx7
2 files changed, 6 insertions, 5 deletions
diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index 7d887f3aed90..1bb558e0142f 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -316,7 +316,7 @@ public:
}
-void GL3DBarChart::clickedAt(const Point& /*rPos*/, sal_uInt16 nButtons)
+void GL3DBarChart::clickedAt(const Point& rPos, sal_uInt16 nButtons)
{
if(mbBlockUserInput)
return;
@@ -325,13 +325,11 @@ void GL3DBarChart::clickedAt(const Point& /*rPos*/, sal_uInt16 nButtons)
return;
sal_uInt32 nId = 5;
- /*
{
PickingModeSetter aPickingModeSetter(mpRenderer.get());
render();
nId = mpRenderer->GetPixelColorFromPoint(rPos.X(), rPos.Y());
}
- */
std::map<sal_uInt32, const BarInformation>::const_iterator itr =
maBarMap.find(nId);
diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx
index d0104edeb6c3..d869e16904c9 100644
--- a/chart2/source/view/main/GL3DRenderer.cxx
+++ b/chart2/source/view/main/GL3DRenderer.cxx
@@ -1662,9 +1662,12 @@ void OpenGL3DRenderer::SetPickingMode(bool bPickingMode)
sal_uInt32 OpenGL3DRenderer::GetPixelColorFromPoint(long nX, long nY)
{
+ static sal_uInt32 nId = 0;
+ OUString aFileName = OUString("/home/moggi/work/picking_") + OUString::number(nId++) + ".png";
+ OpenGLHelper::renderToFile(m_iWidth, m_iHeight, aFileName);
boost::scoped_array<sal_uInt8> buf(new sal_uInt8[4]);
- glReadPixels(nX, nY, 1, 1, GL_BGRA, GL_UNSIGNED_BYTE, buf.get());
- Color aColor(buf[3], buf[2], buf[1], buf[0]);
+ glReadPixels(nX, m_iHeight-nY, 1, 1, GL_BGRA, GL_UNSIGNED_BYTE, buf.get());
+ Color aColor(255-buf[3], buf[2], buf[1], buf[0]);
return aColor.GetColor();
}