Author: mir3x
Date: Wed Dec 14 10:34:01 2016
New Revision: 34711

URL: http://svn.gna.org/viewcvs/freeciv?rev=34711&view=rev
Log:
Qt client - fixed minimap not always updated

See bug #25383


Modified:
    branches/S2_6/client/gui-qt/mapview.cpp
    branches/S2_6/client/gui-qt/mapview.h

Modified: branches/S2_6/client/gui-qt/mapview.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/mapview.cpp?rev=34711&r1=34710&r2=34711&view=diff
==============================================================================
--- branches/S2_6/client/gui-qt/mapview.cpp     (original)
+++ branches/S2_6/client/gui-qt/mapview.cpp     Wed Dec 14 10:34:01 2016
@@ -713,7 +713,6 @@
 **************************************************************************/
 minimap_thread::minimap_thread(QObject *parent) : QThread(parent)
 {
-  restart = false;
 }
 
 /**************************************************************************
@@ -721,10 +720,6 @@
 **************************************************************************/
 minimap_thread::~minimap_thread()
 {
-  mutex.lock();
-  condition.wakeOne();
-  mutex.unlock();
-
   wait();
 }
 
@@ -737,13 +732,7 @@
   mini_width = width;
   mini_height = height;
   scale = scale_factor;
-
-  if (!isRunning()) {
-    start(LowPriority);
-  } else {
-    restart = true;
-    condition.wakeOne();
-  }
+  start(LowPriority);
 }
 
 /**************************************************************************
@@ -753,15 +742,16 @@
 {
   QImage tpix;
   QImage gpix;
+  QImage image(QSize(mini_width, mini_height), QImage::Format_RGB32);
   QImage bigger_pix(gui_options.overview.width * 2,
                     gui_options.overview.height * 2, QImage::Format_RGB32);
   int delta_x, delta_y;
   int x, y, ix, iy;
   float wf, hf;
   QPixmap *src, *dst;
-  QImage image(QSize(mini_width, mini_height), QImage::Format_RGB32);
-
-  if (gui_options.overview.map != NULL) {
+
+  mutex.lock();
+  if (gui_options.overview.map != nullptr) {
     if (scale > 1) {
       /* move minimap now,
          scale later and draw without looking for origin */
@@ -781,8 +771,6 @@
       x = 0;
       y = 0;
       unscale_point(scale, x, y);
-      /* qt 4.8 is going to copy pixmap badly if coords x+size, y+size
-         will go over image so we create extra black bigger image */
       bigger_pix.fill(Qt::black);
       delta_x = gui_options.overview.width / 2;
       delta_y = gui_options.overview.height / 2;
@@ -797,14 +785,7 @@
                           Qt::IgnoreAspectRatio, Qt::FastTransformation);
     }
   }
-  if (!restart) {
-    emit rendered_image(image);
-  }
-  mutex.lock();
-  if (!restart) {
-    condition.wait(&mutex);
-  }
-  restart = false;
+  emit rendered_image(image);
   mutex.unlock();
 }
 

Modified: branches/S2_6/client/gui-qt/mapview.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/mapview.h?rev=34711&r1=34710&r2=34711&view=diff
==============================================================================
--- branches/S2_6/client/gui-qt/mapview.h       (original)
+++ branches/S2_6/client/gui-qt/mapview.h       Wed Dec 14 10:34:01 2016
@@ -38,7 +38,6 @@
 #include <QQueue>
 #include <QThread>
 #include <QTimer>
-#include <QWaitCondition>
 #include <QVariant>
 #include <QWidget>
 
@@ -208,10 +207,8 @@
 
 private:
   int mini_width, mini_height;
-  bool restart;
   double scale;
   QMutex mutex;
-  QWaitCondition condition;
 };
 
 /**************************************************************************


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to