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

List:       kde-commits
Subject:    koffice/krita/tools
From:       Bart Coppens <kde () bartcoppens ! be>
Date:       2005-09-19 12:50:20
Message-ID: 1127134220.710082.12010.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 461962 by coppens:

Remove the brush outline when the mouse goes out of the image area

 M  +14 -3     kis_tool_brush.cc  
 M  +2 -0      kis_tool_brush.h  


--- trunk/koffice/krita/tools/kis_tool_brush.cc #461961:461962
@@ -49,6 +49,7 @@
     setCursor(KisCursor::brushCursor());
     m_rate = 100; // Conveniently hardcoded for now
     m_timer = new QTimer(this);
+    m_paintedOutline = false;
     Q_CHECK_PTR(m_timer);
 
     connect(m_timer, SIGNAL(timeout()), this, SLOT(timeoutPaint()));
@@ -81,6 +82,8 @@
     super::initPaint(e);
 
     KisPaintOp * op = KisPaintOpRegistry::instance()->paintOp(m_subject->currentPaintop(), m_painter);
+    
+    m_subject -> canvasController() -> canvas() -> update(); // remove the outline
 
     painter()->setPaintOp(op); // And now the painter owns the op and will destroy it.
     
@@ -120,19 +123,26 @@
         paintOutline(e -> pos());
 }
 
+void KisToolBrush::leave(QEvent *e) {
+    m_subject -> canvasController() -> canvas() -> update(); // remove the outline
+}
+
 void KisToolBrush::paintOutline(const KisPoint& point) {
     if (!m_subject) {
         return;
     }
 
+    KisCanvasControllerInterface *controller = m_subject -> canvasController();
+
     if (currentImage() &&
         ( point.x() >= currentImage() -> width() || point.y() >= currentImage() -> height()) ) {
+        if (m_paintedOutline) {
+            controller -> canvas() -> update();
+            m_paintedOutline = false;
+        }
         return;
     }
 
-    KisCanvasControllerInterface *controller = m_subject -> canvasController();
-    //controller -> canvas() -> update();
-
     QWidget *canvas = controller -> canvas();
     canvas -> repaint();
 
@@ -152,6 +162,7 @@
                         (- controller -> vertValue()) / m_subject -> zoomFactor());
         gc.translate(point.floorX() - hotSpot.floorX(), point.floorY() - hotSpot.floorY());
         brush -> boundary().paint(gc);
+        m_paintedOutline = true;
     }
 }
 
--- trunk/koffice/krita/tools/kis_tool_brush.h #461961:461962
@@ -49,6 +49,7 @@
     virtual void initPaint(KisEvent *e);
     virtual void endPaint();
     virtual void move(KisMoveEvent *e);
+    virtual void leave(QEvent *e);
 
     void paintOutline(const KisPoint& point);
 
@@ -59,6 +60,7 @@
 private:
     Q_INT32 m_rate;
     QTimer * m_timer;
+    bool m_paintedOutline;
 
 
 };
[prev in list] [next in list] [prev in thread] [next in thread] 

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