You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by tv...@apache.org on 2009/05/02 04:10:21 UTC

svn commit: r770881 - /incubator/pivot/trunk/wtk/src/pivot/wtk/skin/MovieViewSkin.java

Author: tvolkert
Date: Sat May  2 02:10:21 2009
New Revision: 770881

URL: http://svn.apache.org/viewvc?rev=770881&view=rev
Log:
Touched up MovieViewSkin

Modified:
    incubator/pivot/trunk/wtk/src/pivot/wtk/skin/MovieViewSkin.java

Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/skin/MovieViewSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/skin/MovieViewSkin.java?rev=770881&r1=770880&r2=770881&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/skin/MovieViewSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/skin/MovieViewSkin.java Sat May  2 02:10:21 2009
@@ -46,8 +46,10 @@
     private MovieListener movieListener = new MovieListener.Adapter() {
         @Override
         public void regionUpdated(Movie movie, int x, int y, int width, int height) {
-            // TODO Offset this by the movie location; scale by the movie scale
-            repaintComponent();
+            repaintComponent(movieX + (int)Math.floor(x * scale),
+                movieY + (int)Math.floor(y * scale),
+                (int)Math.ceil(width * scale) + 1,
+                (int)Math.ceil(height * scale) + 1);
         }
     };
 
@@ -94,8 +96,8 @@
         MovieView movieView = (MovieView)getComponent();
         Movie movie = movieView.getMovie();
 
-        return (movie == null) ? new Dimensions(0, 0) : new Dimensions(
-            Math.round(movie.getWidth() * scale),
+        return (movie == null) ? new Dimensions(0, 0) :
+            new Dimensions(Math.round(movie.getWidth() * scale),
             Math.round(movie.getHeight() * scale));
     }
 
@@ -103,9 +105,6 @@
         MovieView movieView = (MovieView)getComponent();
         Movie movie = movieView.getMovie();
 
-        movieX = 0;
-        movieY = 0;
-
         if (movie != null) {
             int width = getWidth();
             int height = getHeight();
@@ -120,6 +119,9 @@
             case RIGHT:
                 movieX = width - movieWidth;
                 break;
+            default:
+                movieX = 0;
+                break;
             }
 
             switch (verticalAlignment) {
@@ -129,6 +131,9 @@
             case BOTTOM:
                 movieY = height - movieHeight;
                 break;
+            default:
+                movieY = 0;
+                break;
             }
         }
     }