Kaydet (Commit) f9f8d930 authored tarafından Markus Mohrhard's avatar Markus Mohrhard Kaydeden (comit) Markus Mohrhard

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
üst 16642b7f
......@@ -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);
......
......@@ -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();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment