Update from https://crrev.com/320931
- Add IsFlat() definition to ui/gfx/transform
- Change sky's uses of skia's FilterLevel to FilterQuality
- Update cc_strip_video.patch

R=jamesr@chromium.org

Review URL: https://codereview.chromium.org/1013463003
diff --git a/ui/gfx/transform.cc b/ui/gfx/transform.cc
index c13ae1d..27b5e63 100644
--- a/ui/gfx/transform.cc
+++ b/ui/gfx/transform.cc
@@ -394,6 +394,13 @@
   matrix_.set(2, 3, 0.0);
 }
 
+bool Transform::IsFlat() const {
+  return matrix_.get(2, 0) == 0.0 && matrix_.get(2, 1) == 0.0 &&
+         matrix_.get(0, 2) == 0.0 && matrix_.get(1, 2) == 0.0 &&
+         matrix_.get(2, 2) == 1.0 && matrix_.get(3, 2) == 0.0 &&
+         matrix_.get(2, 3) == 0.0;
+}
+
 Vector2dF Transform::To2dTranslation() const {
   return gfx::Vector2dF(SkMScalarToFloat(matrix_.get(0, 3)),
                         SkMScalarToFloat(matrix_.get(1, 3)));
diff --git a/ui/gfx/transform.h b/ui/gfx/transform.h
index 68a734e..7f2c599 100644
--- a/ui/gfx/transform.h
+++ b/ui/gfx/transform.h
@@ -188,6 +188,9 @@
   //
   void FlattenTo2d();
 
+  // Returns true if the 3rd row and 3rd column are both (0, 0, 1, 0).
+  bool IsFlat() const;
+
   // Returns the x and y translation components of the matrix.
   Vector2dF To2dTranslation() const;
 
diff --git a/ui/gfx/transform_unittest.cc b/ui/gfx/transform_unittest.cc
index ef801ac..aee6d8c 100644
--- a/ui/gfx/transform_unittest.cc
+++ b/ui/gfx/transform_unittest.cc
@@ -2420,6 +2420,29 @@
   EXPECT_ROW4_EQ(13.0f, 17.0f, 0.0f, 25.0f, A);
 }
 
+TEST(XFormTest, IsFlat) {
+  Transform transform;
+  InitializeTestMatrix(&transform);
+
+  // A transform with all entries non-zero isn't flat.
+  EXPECT_FALSE(transform.IsFlat());
+
+  transform.matrix().set(0, 2, 0.f);
+  transform.matrix().set(1, 2, 0.f);
+  transform.matrix().set(2, 2, 1.f);
+  transform.matrix().set(3, 2, 0.f);
+
+  EXPECT_FALSE(transform.IsFlat());
+
+  transform.matrix().set(2, 0, 0.f);
+  transform.matrix().set(2, 1, 0.f);
+  transform.matrix().set(2, 3, 0.f);
+
+  // Since the third column and row are both (0, 0, 1, 0), the transform is
+  // flat.
+  EXPECT_TRUE(transform.IsFlat());
+}
+
 // Another implementation of Preserves2dAxisAlignment that isn't as fast,
 // good for testing the faster implementation.
 static bool EmpiricallyPreserves2dAxisAlignment(const Transform& transform) {