Index: gm/fontmgr.cpp |
diff --git a/gm/fontmgr.cpp b/gm/fontmgr.cpp |
index 70b91150d03cacf5986be2c8db0e464adba215ee..9c300ab502e38d805d89f43bae5cfd07029ffc50 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 @@ static SkScalar drawString(SkCanvas* canvas, const SkString& text, SkScalar x, |
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 @@ protected: |
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 @@ protected: |
} |
private: |
+ SkAutoTUnref<SkFontMgr> fFM; |
+ SkString fName; |
typedef GM INHERITED; |
}; |
@@ -181,3 +196,7 @@ private: |
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 |