Author: fejj
Date: 2007-08-22 15:04:52 -0400 (Wed, 22 Aug 2007)
New Revision: 84651

Modified:
   trunk/moon/src/ChangeLog
   trunk/moon/src/media.cpp
Log:
2007-08-22  Jeffrey Stedfast  <[EMAIL PROTECTED]>

        * media.cpp (advance_frame): Don't bother invalidating here, we'll
        do that in OnPropertyChanged() for the PositionProperty.
        (OnPropertyChanged): Invalidate if Position has changed and
        opacity > 0.0f (and we actually have video).
        (ComputeBounds): Use the FrameworkElement width/height if set.
        (GetTransformOrigin): Same.



Modified: trunk/moon/src/ChangeLog
===================================================================
--- trunk/moon/src/ChangeLog    2007-08-22 18:57:37 UTC (rev 84650)
+++ trunk/moon/src/ChangeLog    2007-08-22 19:04:52 UTC (rev 84651)
@@ -1,3 +1,12 @@
+2007-08-22  Jeffrey Stedfast  <[EMAIL PROTECTED]>
+
+       * media.cpp (advance_frame): Don't bother invalidating here, we'll
+       do that in OnPropertyChanged() for the PositionProperty.
+       (OnPropertyChanged): Invalidate if Position has changed and
+       opacity > 0.0f (and we actually have video).
+       (ComputeBounds): Use the FrameworkElement width/height if set.
+       (GetTransformOrigin): Same.
+
 2007-08-21  Jeffrey Stedfast  <[EMAIL PROTECTED]>
 
        * mplayer.cpp (Open): Merged both Open() implementations into a

Modified: trunk/moon/src/media.cpp
===================================================================
--- trunk/moon/src/media.cpp    2007-08-22 18:57:37 UTC (rev 84650)
+++ trunk/moon/src/media.cpp    2007-08-22 19:04:52 UTC (rev 84651)
@@ -97,18 +97,16 @@
 advance_frame (void *user_data)
 {
        MediaElement *media = (MediaElement *) user_data;
-       double opacity = media->GetTotalOpacity ();
        int64_t position;
        
-       if (media->mplayer->AdvanceFrame () && opacity > 0.0f)
-               media->Invalidate ();
+       if (media->mplayer->AdvanceFrame ()) {
+               media->updating = true;
+               if ((position = media->mplayer->Position ()) < 0)
+                       position = 0;
+               media_element_set_position (media, position);
+               media->updating = false;
+       }
        
-       media->updating = true;
-       if ((position = media->mplayer->Position ()) < 0)
-               position = 0;
-       media_element_set_position (media, position);
-       media->updating = false;
-       
        // FIXME: need to disconnect the timeout if the video is complete
        //        and set the CurrentState to "Stopped"?
        
@@ -160,12 +158,19 @@
 void
 MediaElement::ComputeBounds ()
 {
+       double h = framework_element_get_height (this);
+       double w = framework_element_get_width (this);
+       cairo_t *cr = measuring_context_create ();
        double x1, y1, x2, y2;
-       cairo_t *cr = measuring_context_create ();
        
+       if (w == 0.0 && h == 0.0) {
+               h = (double) mplayer->height;
+               w = (double) mplayer->width;
+       }
+       
        cairo_save (cr);
        cairo_set_matrix (cr, &absolute_xform);
-       cairo_rectangle (cr, 0, 0, mplayer->width, mplayer->height);
+       cairo_rectangle (cr, 0, 0, w, h);
        // XXX this next call will hopefully become unnecessary in a
        // later version of cairo.
        cairo_identity_matrix (cr);
@@ -181,8 +186,15 @@
 MediaElement::GetTransformOrigin ()
 {
        Point user_xform_origin = GetRenderTransformOrigin ();
-       return Point (user_xform_origin.x * mplayer->width,
-                     user_xform_origin.y * mplayer->height);
+       double h = framework_element_get_height (this);
+       double w = framework_element_get_width (this);
+       
+       if (w == 0.0 && h == 0.0) {
+               h = (double) mplayer->height;
+               w = (double) mplayer->width;
+       }
+       
+       return Point (user_xform_origin.x * w, user_xform_origin.y * h);
 }
 
 void
@@ -420,7 +432,6 @@
 void
 MediaElement::OnPropertyChanged (DependencyProperty *prop)
 {
-       bool invalidate = false;
        bool autoplay = false;
        
        if (prop == MediaBase::SourceProperty) {
@@ -483,7 +494,12 @@
        } else if (prop == MediaElement::NaturalVideoWidthProperty) {
                // read-only property
        } else if (prop == MediaElement::PositionProperty) {
-               // handled elsewhere...
+               if (timeout_id != 0) {
+                       double opacity = GetTotalOpacity ();
+                       
+                       if (opacity > 0.0f)
+                               Invalidate ();
+               }
        } else if (prop == MediaElement::VolumeProperty) {
                mplayer->SetVolume (media_element_get_volume (this));
        }
@@ -493,9 +509,6 @@
                Play ();
        }
        
-       if (invalidate)
-               Invalidate ();
-       
        if (prop->type == Type::MEDIAELEMENT) {
                NotifyAttacheesOfPropertyChange (prop);
        } else {

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

Reply via email to