Bug 123561 - ellipse fails to clip child objects
Summary: ellipse fails to clip child objects
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.x
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kst
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-13 19:23 UTC by Andrew Walker
Modified: 2007-08-30 22:48 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Walker 2006-03-13 19:23:28 UTC
Version:           HEAD (using KDE KDE 3.5.0)
Installed from:    Compiled From Sources
OS:                Linux

PROBLEM:

Objects drawn outside of an ellipse object, but within its bounding rectangle are not updated correctly.

STEPS TO REPRODUCE:

Start kst
Create an ellipse object
Create a rectangle object
Drag the rectangle object so it is within the bounding rectangle of the ellipse
and snaps to two edges of the ellipse.

RESULTS:

The rectangle is drawn only over the ellipse itself, and is not visible within the bounding rectangle of the ellipse.

EXPECTED RESULTS:

The entire rectangle should be visible.
Comment 1 George Staikos 2006-03-14 21:18:32 UTC
  I think this behaves as expected.  If it is a child of the ellipse, it 
should only be inside the ellipse, not inside the ellipse's bounding box.  
What may be a problem is that it should not be allowed to be a child if it 
doesn't fit entirely within the ellipse.  This makes the problem of a 
transparent disjoint object tricky to solve though.
Comment 2 Andrew Walker 2006-03-15 00:09:15 UTC
If the window is forced to update (by resizing the window for example) then the rectangle is drawn in full. I suspect that this is what the code is trying to do, but the initial paint is incomplete. Further if the rectangle is moved (after the window is resized) the portion of the rectangle outside of the ellipse is not erased (until the window is resized again).
Comment 3 George Staikos 2006-03-20 03:39:35 UTC
ah I see, so the clipping eventually fails.
Comment 4 Andrew Walker 2007-05-07 23:11:00 UTC
See also related bug reports #121068 and #143806
Comment 5 Andrew Walker 2007-05-20 20:42:33 UTC
SVN commit 666734 by arwalker:

BUG:123561 Invalidate the clipping region for the object being moved and its old parent so that both are redrawn correctly.

 M  +8 -3      ksttoplevelview.cpp  


--- branches/work/kst/1.5/kst/src/libkstapp/ksttoplevelview.cpp #666733:666734
@@ -988,7 +988,7 @@
       // we are resizing rectangular object(s)
       releasePressLayoutModeResize(pos, shift);
     }
-    _pressTarget->setFocus(true);   
+    _pressTarget->setFocus(true);
   } else { 
     // selecting objects using rubber band
     releasePressLayoutModeSelect(pos, shift);
@@ -1026,12 +1026,15 @@
   // the returned object in that case.
   KstViewObjectPtr container = findDeepestChild(obj);
   bool updateViewManager = false;
-  
+
   if (!container) {
     container = this;
   }
   if (container != _pressTarget && !container->children().contains(_pressTarget)) {
-    _pressTarget->detach();
+    if (_pressTarget->parent()) {
+      _pressTarget->parent()->invalidateClipRegion();
+      _pressTarget->detach();
+    }
     container->appendChild(_pressTarget);
     updateViewManager = true;
   }
@@ -1047,10 +1050,12 @@
       thisObj->move(_pressTarget->position() + thisObj->geometry().topLeft() - old.topLeft());
     }
   }
+  container->invalidateClipRegion();
   
   if (updateViewManager) {
     KstApp::inst()->updateViewManager(true);
   }
+
   _onGrid = false;
 }
 
Comment 6 Andrew Walker 2007-08-28 23:03:53 UTC
SVN commit 705903 by arwalker:

CCBUG:123561 ensure clip region is correctly updated after deleting objects via the shortcut

 M  +2 -0      ksttoplevelview.cpp  
 M  +1 -1      kstviewellipse.cpp  
 M  +9 -1      kstviewobject.cpp  


--- branches/work/kst/1.5/kst/src/libkstapp/ksttoplevelview.cpp #705902:705903
@@ -1860,7 +1860,9 @@
 void KstTopLevelView::deleteSelectedObjects() {
   for (KstViewObjectList::Iterator i = _selectionList.begin(); i != _selectionList.end(); ++i) {
     KstViewObjectPtr selection = *i;
+
     if (selection && selection->parent()) {
+      selection->parent()->invalidateClipRegion();
       selection->parent()->removeChild(selection);
     }
   }
--- branches/work/kst/1.5/kst/src/libkstapp/kstviewellipse.cpp #705902:705903
@@ -230,4 +230,4 @@
 
 
 #include "kstviewellipse.moc"
-// vim: ts=2 sw=2 et
+
--- branches/work/kst/1.5/kst/src/libkstapp/kstviewobject.cpp #705902:705903
@@ -307,12 +307,14 @@
 
 void KstViewObject::paint(KstPainter& p, const QRegion& bounds) {
   bool maximized = false;
+
   if (p.type() == KstPainter::P_EXPORT || p.type() == KstPainter::P_PRINT) {
     // handle the case where we have maximized plots
     for (KstViewObjectList::Iterator i = _children.begin(); i != _children.end(); ++i) {
       if ((*i)->_maximized) {
         (*i)->paint(p, bounds);
         maximized = true;
+
         break;
       }
     }
@@ -323,6 +325,7 @@
         (*i)->paint(p, bounds);
       }
     }
+
     return;
   }
 
@@ -346,12 +349,14 @@
     if ((*i)->_maximized) {
       (*i)->paint(p, bounds);
       maximized = true;
+
       break;
     }
   }
 
   if (!maximized) {
     QRegion clipRegion;
+
     if (nullBounds) {
       clipRegion = geometry();
     } else {
@@ -362,6 +367,7 @@
       KstViewObjectList::Iterator begin = _children.begin();
       for (KstViewObjectList::Iterator i = _children.fromLast();; --i) {
         const QRegion thisObjectGeometry((*i)->geometry());
+
         if (nullBounds || !clipRegion.intersect(thisObjectGeometry).isEmpty()) {
 #ifdef BENCHMARK
           QTime t;
@@ -1305,14 +1311,16 @@
 
   if (_topObjectForMenu) {
     KstTopLevelViewPtr tlv = kst_cast<KstTopLevelView>(KstViewObjectPtr(_topObjectForMenu));
+
     if (tlv && vop == tlv->pressTarget()) {
       tlv->clearPressTarget();
     }
+
     if (this->_parent) {
       this->_parent->invalidateClipRegion();
     }
+
     _topObjectForMenu->removeChild(this, true);
-
     _topObjectForMenu = 0L;
   }
 
Comment 7 Andrew Walker 2007-08-30 22:48:23 UTC
SVN commit 706597 by arwalker:

CCBUG:123561 Also fix the same problem for resizing objects

 M  +6 -2      ksttoplevelview.cpp  


--- branches/work/kst/1.5/kst/src/libkstapp/ksttoplevelview.cpp #706596:706597
@@ -988,8 +988,13 @@
       // we are resizing rectangular object(s)
       releasePressLayoutModeResize(pos, shift);
     }
+
+    if (_pressTarget->parent()) {
+      _pressTarget->parent()->invalidateClipRegion();
+    }
+
     _pressTarget->setFocus(true);
-  } else { 
+  } else {
     // selecting objects using rubber band
     releasePressLayoutModeSelect(pos, shift);
   }
@@ -1050,7 +1055,6 @@
       thisObj->move(_pressTarget->position() + thisObj->geometry().topLeft() - old.topLeft());
     }
   }
-  container->invalidateClipRegion();
 
   if (updateViewManager) {
     KstApp::inst()->updateViewManager(true);