Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(673)

Unified Diff: gm/fontmgr.cpp

Issue 23058002: allow both GDI and DW fontmgrs at the same time (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gyp/ports.gyp » ('j') | src/ports/SkFontHost_win_dw.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | gyp/ports.gyp » ('j') | src/ports/SkFontHost_win_dw.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698