Author: toshok
Date: 2007-08-28 12:41:37 -0400 (Tue, 28 Aug 2007)
New Revision: 84963

Modified:
   branches/moon-delayed-rendering/src/ChangeLog
   branches/moon-delayed-rendering/src/control.cpp
   branches/moon-delayed-rendering/src/control.h
   branches/moon-delayed-rendering/src/dependencyobject.cpp
   branches/moon-delayed-rendering/src/dependencyobject.h
   branches/moon-delayed-rendering/src/dirty.cpp
Log:
2007-08-28  Chris Toshok  <[EMAIL PROTECTED]>

        * dirty.cpp (process_dirty_elements): use a different method for
        checking if against the toplevel canvas, and also use
        UIElement::parent instead of DependencyObject::GetParent() to get
        controls working a little better than before.

        * control.h, control.cpp: remove UpdateTransform.  this is handled
        by the dirty.cpp code now.

        * dependencyobject.h, dependencyobject.cpp: copy over the
        event_object_{add,remove}_event_handler change from the trunk so
        we can continue to work with HEAD olive.



Modified: branches/moon-delayed-rendering/src/ChangeLog
===================================================================
--- branches/moon-delayed-rendering/src/ChangeLog       2007-08-28 16:35:34 UTC 
(rev 84962)
+++ branches/moon-delayed-rendering/src/ChangeLog       2007-08-28 16:41:37 UTC 
(rev 84963)
@@ -1,3 +1,17 @@
+2007-08-28  Chris Toshok  <[EMAIL PROTECTED]>
+
+       * dirty.cpp (process_dirty_elements): use a different method for
+       checking if against the toplevel canvas, and also use
+       UIElement::parent instead of DependencyObject::GetParent() to get
+       controls working a little better than before.
+
+       * control.h, control.cpp: remove UpdateTransform.  this is handled
+       by the dirty.cpp code now.
+
+       * dependencyobject.h, dependencyobject.cpp: copy over the
+       event_object_{add,remove}_event_handler change from the trunk so
+       we can continue to work with HEAD olive.
+
 2007-08-22  Chris Toshok  <[EMAIL PROTECTED]>
 
        * uielement.cpp (Invalidate): don't actually invalidate the

Modified: branches/moon-delayed-rendering/src/control.cpp
===================================================================
--- branches/moon-delayed-rendering/src/control.cpp     2007-08-28 16:35:34 UTC 
(rev 84962)
+++ branches/moon-delayed-rendering/src/control.cpp     2007-08-28 16:41:37 UTC 
(rev 84963)
@@ -32,10 +32,30 @@
 void 
 Control::ComputeBounds ()
 {
-       if (real_object)
+       if (real_object) {
                bounds = real_object->GetBounds ();
-       else
+       }
+       else {
                bounds = Rect (0, 0, 0, 0);
+       }
+
+       // If we found nothing.
+       double x1, x2, y1, y2;
+       
+       x1 = y1 = 0.0;
+       x2 = framework_element_get_width (this);
+       y2 = framework_element_get_height (this);
+
+       if (x2 != 0.0 && y2 != 0.0) {
+
+               Rect fw_rect = bounding_rect_for_transformed_rect 
(&absolute_xform,
+                                                                  Rect 
(x1,y1,x2,y2));
+
+               if (real_object)
+                       bounds = bounds.Union (fw_rect);
+               else
+                       bounds = fw_rect;
+       }
 }
 
 void
@@ -47,15 +67,6 @@
 }
 
 void
-Control::UpdateTransform ()
-{
-       FrameworkElement::UpdateTransform ();
-
-       if (real_object)
-               real_object->UpdateTransform ();
-}
-
-void
 Control::GetTransformFor (UIElement *item, cairo_matrix_t *result)
 {
        // XXX this is copied from the canvas implementation due to some

Modified: branches/moon-delayed-rendering/src/control.h
===================================================================
--- branches/moon-delayed-rendering/src/control.h       2007-08-28 16:35:34 UTC 
(rev 84962)
+++ branches/moon-delayed-rendering/src/control.h       2007-08-28 16:41:37 UTC 
(rev 84963)
@@ -27,7 +27,6 @@
 
        virtual void Render (cairo_t *cr, int x, int y, int width, int height);
        virtual void ComputeBounds ();
-       virtual void UpdateTransform ();
        virtual void GetTransformFor (UIElement *item, cairo_matrix_t *result);
 
        virtual void OnSubPropertyChanged (DependencyProperty *prop, 
DependencyProperty *subprop);

Modified: branches/moon-delayed-rendering/src/dependencyobject.cpp
===================================================================
--- branches/moon-delayed-rendering/src/dependencyobject.cpp    2007-08-28 
16:35:34 UTC (rev 84962)
+++ branches/moon-delayed-rendering/src/dependencyobject.cpp    2007-08-28 
16:41:37 UTC (rev 84963)
@@ -434,19 +434,6 @@
        return obj->GetTypeName ();
 }
 
-void
-dependency_object_add_event_handler (DependencyObject *o, char *event, 
EventHandler handler, gpointer closure)
-{
-       o->AddHandler (event, handler, closure);
-}
-
-void
-dependency_object_remove_event_handler (DependencyObject *o, char *event, 
EventHandler handler, gpointer closure)
-{
-       o->RemoveHandler (event, handler, closure);
-}
-
-
 //
 // Use this for values that can be null
 //
@@ -956,3 +943,16 @@
 
        g_list_free (copy);
 }
+
+void
+event_object_add_event_handler (EventObject *o, char *event, EventHandler 
handler, gpointer closure)
+{
+       o->AddHandler (event, handler, closure);
+}
+
+void
+event_object_remove_event_handler (EventObject *o, char *event, EventHandler 
handler, gpointer closure)
+{
+       o->RemoveHandler (event, handler, closure);
+}
+

Modified: branches/moon-delayed-rendering/src/dependencyobject.h
===================================================================
--- branches/moon-delayed-rendering/src/dependencyobject.h      2007-08-28 
16:35:34 UTC (rev 84962)
+++ branches/moon-delayed-rendering/src/dependencyobject.h      2007-08-28 
16:41:37 UTC (rev 84963)
@@ -182,8 +182,6 @@
 Type::Kind dependency_object_get_object_type (DependencyObject *obj);
 const char *dependency_object_get_type_name (DependencyObject *obj);
 
-void dependency_object_add_event_handler (DependencyObject *o, char *event, 
EventHandler handler, gpointer closure);
-void dependency_object_remove_event_handler (DependencyObject *o, char *event, 
EventHandler handler, gpointer closure);
 
 
 
@@ -195,6 +193,9 @@
 
 void dependencyobject_init (void);
 
+void event_object_add_event_handler (EventObject *o, char *event, EventHandler 
handler, gpointer closure);
+void event_object_remove_event_handler (EventObject *o, char *event, 
EventHandler handler, gpointer closure);
+
 G_END_DECLS
 
 #endif /* __MONO_DEPOBJECT_H__ */

Modified: branches/moon-delayed-rendering/src/dirty.cpp
===================================================================
--- branches/moon-delayed-rendering/src/dirty.cpp       2007-08-28 16:35:34 UTC 
(rev 84962)
+++ branches/moon-delayed-rendering/src/dirty.cpp       2007-08-28 16:41:37 UTC 
(rev 84963)
@@ -27,8 +27,8 @@
 add_dirty_element (UIElement *element, DirtyType dirt)
 {
   // XXX this should really be here...
-//     if (element->dirty_flags & dirt)
-//             return;
+//     if (element->dirty_flags & dirt)
+//             return;
 
        element->dirty_flags |= dirt;
 
@@ -51,7 +51,6 @@
 void
 process_dirty_elements ()
 {
-  TimeSpan before = get_now ();
        /* push down the transforms and opacity changes first */
        while (down_dirty) {
                GSList *link = down_dirty;
@@ -124,33 +123,35 @@
                GSList *link = up_dirty;
                UIElement* el = (UIElement*)link->data;
 
-//             printf ("up processing element element %p (%s)\n", el, 
el->GetTypeName());
+//             printf ("up processing element element %p (%s)\n", el, 
el->GetName());
+//             printf ("el->parent = %p\n", el->parent);
 
                if (el->dirty_flags & DirtyBounds) {
-//               printf (" + bounds\n");
+//               printf (" + bounds\n");
                        el->dirty_flags &= ~DirtyBounds;
 
                        if (!el->Is(Type::CANVAS)
-                           || el->GetParent() != NULL
-                           || !el->GetSurface()) {
+                           || el->parent
+                           || !el->GetSurface()
+                           || el->GetSurface()->GetToplevel() != el) {
 
                                Rect obounds = el->GetBounds ();
 
                                el->ComputeBounds ();
 
-                               if (obounds != el->GetBounds()) {
-                                       if (el->GetParent ()) {
-                                               DependencyObject *p = 
el->GetParent ();
-                                               if (p->Is (Type::COLLECTION)) {
-                                                       p = 
((Collection*)p)->closure;
-                                               }
+//                             printf (" + + obounds = %f %f %f %f, nbounds = 
%f %f %f %f\n",
+//                                     obounds.x, obounds.y, obounds.w, 
obounds.h,
+//                                     el->GetBounds().x, el->GetBounds().y, 
el->GetBounds().w, el->GetBounds().h);
 
-                                               ((UIElement*)p)->UpdateBounds();
-                                               
((UIElement*)p)->Invalidate(obounds);
+                               if (obounds != el->GetBounds()) {
+                                       if (el->parent) {
+//                                             printf (" + + + calling 
UpdateBounds and Invalidate on parent\n");
+                                               el->parent->UpdateBounds();
+                                               el->parent->Invalidate(obounds);
                                        }
 
                                        el->Invalidate ();
-                               }
+                               }
                        }
                }
 
@@ -159,21 +160,19 @@
 
                        el->dirty_flags &= ~DirtyInvalidate;
 
-                       if (el->GetParent ()) {
+                       if (el->parent) {
 //                       printf (" + + invalidating parent (%f,%f,%f,%f)\n",
 //                               el->dirty_rect.x,
 //                               el->dirty_rect.y,
 //                               el->dirty_rect.w,
 //                               el->dirty_rect.h);
-                               DependencyObject *p = el->GetParent ();
-                               if (p->Is (Type::COLLECTION)) {
-                                       p = ((Collection*)p)->closure;
-                               }
-
-                               UIElement *parent = (UIElement*)p;
-                               parent->Invalidate (el->dirty_rect.GrowBy(1));
+                               el->parent->Invalidate 
(el->dirty_rect.GrowBy(1));
                        }
-                       else if (el->Is (Type::CANVAS) && el->GetSurface()) {
+                       else if (el->Is (Type::CANVAS) &&
+                                el->parent == NULL &&
+                                el->GetSurface() &&
+                                el->GetSurface()->GetToplevel() == el) {
+
                                el->GetSurface()->Invalidate 
(el->dirty_rect.GrowBy(1));
                        }
 
@@ -189,8 +188,4 @@
 
        g_assert (!up_dirty);
        g_assert (!down_dirty);
-
-  TimeSpan after = get_now ();
-
-  //  fprintf (stderr, "process_dirty_elements took %lld ticks\n", after - 
before); fflush (stderr);
 }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to