[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/krita
From:       Adam Celarek <bugs_kde_org () xibo ! at>
Date:       2010-09-29 17:49:19
Message-ID: 20100929174919.6DCF1AC891 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1180992 by adamc:

the tablet sends very many events, we don't need as many for picking
colours and painting the selectors needs time, which results in a
noticable lag.

BUG: 249265


 M  +8 -0      plugins/tools/defaulttools/kis_tool_colorpicker.cc  
 M  +4 -0      plugins/tools/defaulttools/kis_tool_colorpicker.h  
 M  +8 -0      ui/tool/kis_tool_paint.cc  
 M  +3 -0      ui/tool/kis_tool_paint.h  


--- trunk/koffice/krita/plugins/tools/defaulttools/kis_tool_colorpicker.cc #1180991:1180992
@@ -80,6 +80,14 @@
 
 void KisToolColorPicker::pickColor(const QPointF& pos)
 {
+        if(m_colorPickerDelayTimer.isActive()) {
+            return;
+        }
+        else {
+            m_colorPickerDelayTimer.setSingleShot(true);
+            m_colorPickerDelayTimer.start(100);
+        }
+
         KisPaintDeviceSP dev = currentNode()->paintDevice();
         if (!dev) return;
 
--- trunk/koffice/krita/plugins/tools/defaulttools/kis_tool_colorpicker.h #1180991:1180992
@@ -22,6 +22,7 @@
 #define KIS_TOOL_COLOR_PICKER_H_
 
 #include <QList>
+#include <QTimer>
 
 #include "KoToolFactoryBase.h"
 #include "ui_wdgcolorpicker.h"
@@ -78,6 +79,9 @@
     int m_radius;
     KoColor m_pickedColor;
 
+    // used to skip some of the tablet events and don't update the colour that often
+    QTimer m_colorPickerDelayTimer;
+
     ColorPickerOptionsWidget *m_optionsWidget;
 
     QList<KoColorSet*> m_palettes;
--- trunk/koffice/krita/ui/tool/kis_tool_paint.cc #1180991:1180992
@@ -206,6 +206,14 @@
                              bool fromCurrentNode,
                              bool toForegroundColor)
 {
+    if(m_colorPickerDelayTimer.isActive()) {
+        return;
+    }
+    else {
+        m_colorPickerDelayTimer.setSingleShot(true);
+        m_colorPickerDelayTimer.start(100);
+    }
+
     int resource = toForegroundColor ?
         KoCanvasResource::ForegroundColor : KoCanvasResource::BackgroundColor;
 
--- trunk/koffice/krita/ui/tool/kis_tool_paint.h #1180991:1180992
@@ -27,6 +27,7 @@
 #include <QEvent>
 #include <QPaintEvent>
 #include <QVariant>
+#include <QTimer>
 
 #include <KoResourceManager.h>
 #include <KoToolBase.h>
@@ -154,6 +155,8 @@
      * Used as a switch for pickColor
      */
     bool m_toForegroundColor;
+    // used to skip some of the tablet events and don't update the colour that often
+    QTimer m_colorPickerDelayTimer;
 
 signals:
     void sigFavoritePaletteCalled(const QPoint&);
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic