allow both GDI and DW fontmgrs at the same time

BUG=
R=bungeman@google.com

Committed: https://code.google.com/p/skia/source/detail?r=10718

Committed: https://code.google.com/p/skia/source/detail?r=10788

Review URL: https://codereview.chromium.org/23058002

git-svn-id: http://skia.googlecode.com/svn/trunk@10851 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gm/fontmgr.cpp b/gm/fontmgr.cpp
index 70b9115..9c300ab 100644
--- a/gm/fontmgr.cpp
+++ b/gm/fontmgr.cpp
@@ -11,6 +11,11 @@
 #include "SkGraphics.h"
 #include "SkTypeface.h"
 
+#ifdef SK_BUILD_FOR_WIN
+    extern SkFontMgr* SkFontMgr_New_GDI();
+    extern SkFontMgr* SkFontMgr_New_DirectWrite();
+#endif
+
 // limit this just so we don't take too long to draw
 #define MAX_FAMILIES    30
 
@@ -22,13 +27,21 @@
 
 class FontMgrGM : public skiagm::GM {
 public:
-    FontMgrGM() {
+    FontMgrGM(SkFontMgr* (*factory)() = NULL) {
         SkGraphics::SetFontCacheLimit(16 * 1024 * 1024);
+
+        fName.set("fontmgr_iter");
+        if (factory) {
+            fName.append("_factory");
+            fFM.reset(factory());
+        } else {
+            fFM.reset(SkFontMgr::RefDefault());
+        }
     }
 
 protected:
     virtual SkString onShortName() {
-        return SkString("fontmgr_iter");
+        return fName;
     }
 
     virtual SkISize onISize() {
@@ -43,7 +56,7 @@
         paint.setSubpixelText(true);
         paint.setTextSize(17);
 
-        SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault());
+        SkFontMgr* fm = fFM;
         int count = SkMin32(fm->countFamilies(), MAX_FAMILIES);
 
         for (int i = 0; i < count; ++i) {
@@ -79,6 +92,8 @@
     }
 
 private:
+    SkAutoTUnref<SkFontMgr> fFM;
+    SkString fName;
     typedef GM INHERITED;
 };
 
@@ -181,3 +196,7 @@
 
 DEF_GM( return SkNEW(FontMgrGM); )
 DEF_GM( return SkNEW(FontMgrMatchGM); )
+
+#ifdef SK_BUILD_FOR_WIN
+    DEF_GM( return SkNEW_ARGS(FontMgrGM, (SkFontMgr_New_DirectWrite)); )
+#endif