[Libreoffice-commits] core.git: 6 commits - chart2/source

Markus Mohrhard markus.mohrhard at collabora.co.uk
Wed Jul 23 17:12:48 PDT 2014


 chart2/source/view/charttypes/GL3DBarChart.cxx |   32 ++++++++-----------------
 chart2/source/view/inc/GL3DBarChart.hxx        |    1 
 2 files changed, 11 insertions(+), 22 deletions(-)

New commits:
commit 4bb37f99811875179c2020e832542d3751a93312
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Thu Jul 24 02:02:06 2014 +0200

    fix animation for GL3D chart
    
    Change-Id: Ibcc87329f02c435638cb31f8e969b94b729b7f31

diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index 9ad381d..a07d1a9 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -664,8 +664,8 @@ void GL3DBarChart::moveToCorner()
 
     Size aSize = mrWindow.GetSizePixel();
     mrWindow.getContext().setWinSize(aSize);
-    mpRenderThread = rtl::Reference<RenderThread>(new RenderAnimationThread(this, getCornerPosition(mnCornerId),
-                maCameraPosition, STEPS));
+    mpRenderThread = rtl::Reference<RenderThread>(new RenderAnimationThread(this, maCameraPosition,
+                getCornerPosition(mnCornerId), STEPS));
     mrWindow.getContext().resetCurrent();
     mpRenderThread->launch();
 
commit d6551bde0bcd06e4ed6b9aaa47f7891e47511264
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Wed Jul 23 23:12:55 2014 +0200

    avoid showing the picking frame for too long
    
    Change-Id: I58a04325ba6ae42fffddf89905c997fb9ff9fd35

diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index ebd7769..9ad381d 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -556,6 +556,8 @@ void GL3DBarChart::clickedAt(const Point& rPos, sal_uInt16 nButtons)
         mpRenderThread->join();
         nId = mpRenderer->GetPixelColorFromPoint(rPos.X(), rPos.Y());
     }
+    // we need this update here to render one frame without picking mode being set
+    update();
 
     std::map<sal_uInt32, const BarInformation>::const_iterator itr =
         maBarMap.find(nId);
commit baaa55f5f7fc04713eb3ad2c9dd7b437dfab3074
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Wed Jul 23 23:12:08 2014 +0200

    we don't need blocking user input anymore with the threaded rendering
    
    Change-Id: I9cde4c5629f2970b9c24d98897580a2442661bc2

diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index 51b1297..ebd7769 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -196,7 +196,6 @@ GL3DBarChart::GL3DBarChart(
     mnMaxY(0),
     mnDistance(0.0),
     mnCornerId(0),
-    mbBlockUserInput(false),
     mbNeedsNewRender(true),
     mbCameraInit(false),
     mbRenderDie(false)
@@ -535,9 +534,6 @@ void GL3DBarChart::moveToDefault()
 
 void GL3DBarChart::clickedAt(const Point& rPos, sal_uInt16 nButtons)
 {
-    if(mbBlockUserInput)
-        return;
-
     if (nButtons == MOUSE_RIGHT)
     {
         moveToDefault();
@@ -567,8 +563,6 @@ void GL3DBarChart::clickedAt(const Point& rPos, sal_uInt16 nButtons)
     if(itr == maBarMap.end())
         return;
 
-    mbBlockUserInput = true;
-
     const BarInformation& rBarInfo = itr->second;
 
     maShapes.push_back(new opengl3D::ScreenText(mpRenderer.get(), *mpTextCache,
@@ -607,10 +601,6 @@ void GL3DBarChart::render()
 
 void GL3DBarChart::mouseDragMove(const Point& rStartPos, const Point& rEndPos, sal_uInt16 )
 {
-    if(mbBlockUserInput)
-        return;
-
-    mbBlockUserInput = true;
     long direction = rEndPos.X() - rStartPos.X();
     if(direction < 0)
     {
diff --git a/chart2/source/view/inc/GL3DBarChart.hxx b/chart2/source/view/inc/GL3DBarChart.hxx
index fcc7908..6066c6e 100644
--- a/chart2/source/view/inc/GL3DBarChart.hxx
+++ b/chart2/source/view/inc/GL3DBarChart.hxx
@@ -113,7 +113,6 @@ private:
     };
 
     std::map<sal_uInt32, const BarInformation> maBarMap;
-    bool mbBlockUserInput;
     bool mbNeedsNewRender;
     bool mbCameraInit;
 
commit 71ebaba4d283daa8a4b626f8fe1e7ff9c0e5598e
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Wed Jul 23 23:11:04 2014 +0200

    that join was not necessary
    
    The join before already makes sure that the thread is not running
    anymore.
    
    Change-Id: I9a8eb9f436412a2bf75f72a33d23a57016394eec

diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index 2116ac7..51b1297 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -561,7 +561,6 @@ void GL3DBarChart::clickedAt(const Point& rPos, sal_uInt16 nButtons)
         nId = mpRenderer->GetPixelColorFromPoint(rPos.X(), rPos.Y());
     }
 
-    osl::MutexGuard aGuard(maMutex);
     std::map<sal_uInt32, const BarInformation>::const_iterator itr =
         maBarMap.find(nId);
 
@@ -572,9 +571,6 @@ void GL3DBarChart::clickedAt(const Point& rPos, sal_uInt16 nButtons)
 
     const BarInformation& rBarInfo = itr->second;
 
-    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());
commit f62e9f40d28f0aa61109217de83d60d44a60585f
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Wed Jul 23 23:08:05 2014 +0200

    prevent that deadlock by only rpotecting shared resources
    
    Again update may not be protected bt the mutex.
    
    Change-Id: I8b9862c8ecafad75eea3b9e041d3063532f7bf63

diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index 4809a2f..2116ac7 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -687,11 +687,14 @@ void GL3DBarChart::moveToCorner()
 
 void GL3DBarChart::scroll(long nDelta)
 {
-    osl::MutexGuard aGuard(maMutex);
+    {
+        osl::MutexGuard aGuard(maMutex);
+
+        glm::vec3 maDir = glm::normalize(maCameraPosition - maCameraDirection);
+        maCameraPosition -= (float((nDelta/10)) * maDir);
+        mpCamera->setPosition(maCameraPosition);
+    }
 
-    glm::vec3 maDir = glm::normalize(maCameraPosition - maCameraDirection);
-    maCameraPosition -= (float((nDelta/10)) * maDir);
-    mpCamera->setPosition(maCameraPosition);
     update();
 }
 
commit 2480abb1819188263a72b6d37e7511486f354b0b
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Wed Jul 23 23:06:58 2014 +0200

    taking the mutex before calling update is a deadlock as well
    
    The mutex is unnecessary as update is calling join in the beginning
    anyway.
    
    Change-Id: I1dc0c415f4405b58ddbe3640fa8870bed9fefef3

diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index 7d3ffd5..4809a2f 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -606,7 +606,6 @@ void GL3DBarChart::render()
     if (BENCH_MARK_MODE)
         return;
 
-    osl::MutexGuard aGuard(maMutex);
     update();
 }
 


More information about the Libreoffice-commits mailing list