Bug 660565 - HTML5 HW accelerated video is slow r=roc
authorOleg Romashin <romaxa@gmail.com>
Thu, 16 Jun 2011 12:51:05 +0200
changeset 71691 5a46d17c72caf5ec4afd3f59093be803008c61ec
parent 71690 1289e8c8e4ac0bfe5d3131f8ef7c271916782f8b
child 71692 e3efcfa1b14b36a5b7f1baefde3fbffb471c6b37
push id159
push usereakhgari@mozilla.com
push dateTue, 16 Aug 2011 17:53:11 +0000
treeherdermozilla-beta@8786e3e49240 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs660565
milestone7.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 660565 - HTML5 HW accelerated video is slow r=roc
gfx/layers/Layers.cpp
--- a/gfx/layers/Layers.cpp
+++ b/gfx/layers/Layers.cpp
@@ -330,19 +330,24 @@ Layer::CalculateScissorRect(const nsIntR
     return nsIntRect(currentClip.TopLeft(), nsIntSize(0, 0));
   }
 
   nsIntRect scissor = *clipRect;
   if (!container->UseIntermediateSurface()) {
     gfxMatrix matrix;
     DebugOnly<bool> is2D = container->GetEffectiveTransform().Is2D(&matrix);
     // See DefaultComputeEffectiveTransforms below
-    NS_ASSERTION(is2D && !matrix.HasNonIntegerTranslation(),
-                 "Non-integer-translation transform with clipped child should have forced intermediate surface");
-    scissor.MoveBy(nsIntPoint(PRInt32(matrix.x0), PRInt32(matrix.y0)));
+    NS_ASSERTION(is2D && matrix.PreservesAxisAlignedRectangles(),
+                 "Non preserves axis aligned transform with clipped child should have forced intermediate surface");
+    gfxRect r(scissor.x, scissor.y, scissor.width, scissor.height);
+    gfxRect trScissor = matrix.TransformBounds(r);
+    trScissor.Round();
+    if (!gfxUtils::GfxRectToIntRect(trScissor, &scissor)) {
+      return nsIntRect(currentClip.TopLeft(), nsIntSize(0, 0));
+    }
 
     // Find the nearest ancestor with an intermediate surface
     do {
       container = container->GetParent();
     } while (container && !container->UseIntermediateSurface());
   }
   if (container) {
     scissor.MoveBy(-container->GetIntermediateSurfaceRect().TopLeft());
@@ -403,17 +408,21 @@ ContainerLayer::DefaultComputeEffectiveT
   PRBool useIntermediateSurface;
   float opacity = GetEffectiveOpacity();
   if (opacity != 1.0f && HasMultipleChildren()) {
     useIntermediateSurface = PR_TRUE;
   } else {
     useIntermediateSurface = PR_FALSE;
     gfxMatrix contTransform;
     if (!mEffectiveTransform.Is2D(&contTransform) ||
+#ifdef MOZ_GFX_OPTIMIZE_MOBILE
+        !contTransform.PreservesAxisAlignedRectangles()) {
+#else
         contTransform.HasNonIntegerTranslation()) {
+#endif
       for (Layer* child = GetFirstChild(); child; child = child->GetNextSibling()) {
         const nsIntRect *clipRect = child->GetEffectiveClipRect();
         /* We can't (easily) forward our transform to children with a non-empty clip
          * rect since it would need to be adjusted for the transform. See
          * the calculations performed by CalculateScissorRect above.
          */
         if (clipRect && !clipRect->IsEmpty() && !child->GetVisibleRegion().IsEmpty()) {
           useIntermediateSurface = PR_TRUE;