speedup SkRect::isFinite() (almost 2x)
add SkRect:set(p0, p1) for quick bounds of 2 points



git-svn-id: http://skia.googlecode.com/svn/trunk@3967 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tests/InfRectTest.cpp b/tests/InfRectTest.cpp
index 12356d9..1dc6ca7 100644
--- a/tests/InfRectTest.cpp
+++ b/tests/InfRectTest.cpp
@@ -25,24 +25,28 @@
 // as one of its coordinates.
 static void TestInfRect(skiatest::Reporter* reporter) {
 #ifdef SK_SCALAR_IS_FLOAT
-    float invalid = 1 / make_zero();    // infinity
+    float inf = 1 / make_zero();    // infinity
+    float nan = inf * 0;
+    SkASSERT(!(nan == nan));
 #else
-    SkFixed invalid = SK_FixedNaN;
+    SkFixed inf = SK_FixedNaN;
+    SkFixed nan = SK_FixedNaN;
 #endif
     SkScalar small = SkIntToScalar(10);
     SkScalar big = SkIntToScalar(100);
 
+    REPORTER_ASSERT(reporter, SkRect::MakeEmpty().isFinite());
+
     SkRect rect = SkRect::MakeXYWH(small, small, big, big);
     REPORTER_ASSERT(reporter, rect.isFinite());
 
-    check_invalid(reporter, small, small, big, invalid);
-    check_invalid(reporter, small, small, invalid, big);
-    check_invalid(reporter, small, invalid, big, big);
-    check_invalid(reporter, invalid, small, big, big);
-    check_invalid(reporter, small, small, big, -invalid);
-    check_invalid(reporter, small, small, -invalid, big);
-    check_invalid(reporter, small, -invalid, big, big);
-    check_invalid(reporter, -invalid, small, big, big);
+    const SkScalar invalid[] = { nan, inf, -inf };
+    for (size_t i = 0; i < SK_ARRAY_COUNT(invalid); ++i) {
+        check_invalid(reporter, small, small, big, invalid[i]);
+        check_invalid(reporter, small, small, invalid[i], big);
+        check_invalid(reporter, small, invalid[i], big, big);
+        check_invalid(reporter, invalid[i], small, big, big);
+    }
 }
 
 // need tests for SkStrSearch