[Kst] branches/work/kst/1.6/kst/src/libkstapp

Andrew Walker arwalker at sumusltd.com
Wed Sep 26 20:26:11 CEST 2007


SVN commit 717358 by arwalker:

clean up some clipping problems for the ellipse object

 M  +8 -0      ksttoplevelview.cpp  
 M  +1 -0      ksttoplevelview.h  
 M  +13 -0     kstviewellipse.cpp  
 M  +2 -0      kstviewellipse.h  
 M  +6 -4      kstviewobject.cpp  
 M  +1 -1      kstviewobject.h  


--- branches/work/kst/1.6/kst/src/libkstapp/ksttoplevelview.cpp #717357:717358
@@ -165,6 +165,14 @@
 }
 
 
+void KstTopLevelView::paintSelf(KstPainter& p, const QRegion& bounds) {
+  if (!bounds.isNull()) {
+    p.setClipRegion(bounds);
+  }
+  p.fillRect(geometry(), _backgroundColor);
+}
+
+
 void KstTopLevelView::clearFocus() {
   if (_focusOn) {
     _pressDirection = -1;
--- branches/work/kst/1.6/kst/src/libkstapp/ksttoplevelview.h #717357:717358
@@ -47,6 +47,7 @@
     void updateAlignment(KstPainter& p);
     void paint(KstPainter::PaintType type);
     void paint(KstPainter::PaintType type, const QRegion& boundry);
+    void paintSelf(KstPainter& p, const QRegion& bounds);
 
     void clearFocus();
     enum ViewMode { LayoutMode = 0, DisplayMode, CreateMode, LabelMode, Unknown = 15 };
--- branches/work/kst/1.6/kst/src/libkstapp/kstviewellipse.cpp #717357:717358
@@ -125,6 +125,14 @@
 }
 
 
+void KstViewEllipse::invalidateClipRegion() {
+  _clipMask = QRegion();
+  if (_parent) {
+    _parent->invalidateClipRegion();
+  }
+}
+
+
 QRegion KstViewEllipse::clipRegion() {
   if (_clipMask.isNull()) {
     if (transparent() || !_children.isEmpty()) {
@@ -252,6 +260,11 @@
 }
 
 
+bool KstViewEllipse::complexObject() const {
+  return true;
+}
+
+
 namespace {
 KstViewObject *create_KstViewEllipse() {
   return new KstViewEllipse;
--- branches/work/kst/1.6/kst/src/libkstapp/kstviewellipse.h #717357:717358
@@ -35,6 +35,7 @@
     KstViewEllipse(const KstViewEllipse& ellipse);
     virtual ~KstViewEllipse();
 
+    virtual void invalidateClipRegion();
     virtual QRegion clipRegion();
     virtual KstViewObject* copyObjectQuietly(KstViewObject& parent, const QString& name = QString::null) const;
     virtual KstViewObject* copyObjectQuietly() const;
@@ -50,6 +51,7 @@
     virtual QRegion region();
     virtual bool transparent() const;
     virtual void setTransparent(bool transparent);
+    virtual bool complexObject() const;
 
     // can't have Q_PROPERTY in KstViewObject?
     virtual void setForegroundColor(const QColor& color);
--- branches/work/kst/1.6/kst/src/libkstapp/kstviewobject.cpp #717357:717358
@@ -412,9 +412,6 @@
   if (!bounds.isNull()) {
     p.setClipRegion(bounds);
   }
-  if (!transparent()) {
-    p.fillRect(geometry(), _backgroundColor);
-  }
 }
 
 
@@ -1937,6 +1934,11 @@
 }
 
 
+bool KstViewObject::complexObject() const {
+  return false;
+}
+
+
 QRegion KstViewObject::clipRegion() {
   if (_clipMask.isNull()) {
     if (transparent()) {
@@ -2150,7 +2152,7 @@
 void KstViewObject::invalidateClipRegion() {
   _clipMask = QRegion();
   if (_parent) {
-    if (_parent->transparent()) {
+    if (_parent->complexObject() || _parent->transparent()) {
       _parent->invalidateClipRegion();
     }
   }
--- branches/work/kst/1.6/kst/src/libkstapp/kstviewobject.h #717357:717358
@@ -148,9 +148,9 @@
     virtual void setForegroundColor(const QColor& color);
     virtual QColor foregroundColor() const;
 
-    // One day maybe we'll even have translucency available!
     virtual void setTransparent(bool transparent);
     virtual bool transparent() const;
+    virtual bool complexObject() const;
 
     virtual void setFollowsFlow(bool follow);
     virtual bool followsFlow() const;


More information about the Kst mailing list