aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ports/SkFontMgr_win_dw.cpp
diff options
context:
space:
mode:
authorGravatar bungeman <bungeman@google.com>2015-04-29 08:15:31 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-04-29 08:15:31 -0700
commitc64239a466b6e083ada93c2842d9e48bae606dfe (patch)
treed08ca7697d0ac2a623f45d6b09efe6253246292e /src/ports/SkFontMgr_win_dw.cpp
parent9e43cabaa1ff26167e990f0bcb9a5c20d662d52c (diff)
Remove system call in DW for default font.
The last user of the GDI default font in DW is onMatchFamilyStyleCharacter and it doesn't appear to actually need to use it. This change removes a system call, making things a bit faster, as well as eliminating a call blocked in the sandbox. BUG=chromium:459056 Review URL: https://codereview.chromium.org/1107283003
Diffstat (limited to 'src/ports/SkFontMgr_win_dw.cpp')
-rw-r--r--src/ports/SkFontMgr_win_dw.cpp27
1 files changed, 6 insertions, 21 deletions
diff --git a/src/ports/SkFontMgr_win_dw.cpp b/src/ports/SkFontMgr_win_dw.cpp
index b07a05091d..7245f52ce9 100644
--- a/src/ports/SkFontMgr_win_dw.cpp
+++ b/src/ports/SkFontMgr_win_dw.cpp
@@ -629,21 +629,6 @@ protected:
SkTypeface* fResolvedTypeface;
};
-static HRESULT getDefaultFontFamilyName(SkSMallocWCHAR* name) {
- NONCLIENTMETRICSW metrics;
- metrics.cbSize = sizeof(metrics);
- if (0 == SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(metrics), &metrics, 0)) {
- return E_UNEXPECTED;
- }
-
- size_t len = wcsnlen_s(metrics.lfMessageFont.lfFaceName, LF_FACESIZE) + 1;
- if (0 != wcsncpy_s(name->reset(len), len, metrics.lfMessageFont.lfFaceName, _TRUNCATE)) {
- return E_UNEXPECTED;
- }
-
- return S_OK;
-}
-
class FontFallbackSource : public IDWriteTextAnalysisSource {
public:
FontFallbackSource(const WCHAR* string, UINT32 length, const WCHAR* locale,
@@ -750,11 +735,11 @@ SkTypeface* SkFontMgr_DirectWrite::onMatchFamilyStyleCharacter(const char family
{
const DWriteStyle dwStyle(style);
- SkSMallocWCHAR dwFamilyName;
- if (NULL == familyName) {
- HRN(getDefaultFontFamilyName(&dwFamilyName));
- } else {
- HRN(sk_cstring_to_wchar(familyName, &dwFamilyName));
+ const WCHAR* dwFamilyName = NULL;
+ SkSMallocWCHAR dwFamilyNameLocal;
+ if (familyName) {
+ HRN(sk_cstring_to_wchar(familyName, &dwFamilyNameLocal));
+ dwFamilyName = dwFamilyNameLocal;
}
WCHAR str[16];
@@ -816,7 +801,7 @@ SkTypeface* SkFontMgr_DirectWrite::onMatchFamilyStyleCharacter(const char family
#endif
SkTScopedComPtr<IDWriteTextFormat> fallbackFormat;
- HRNM(fFactory->CreateTextFormat(dwFamilyName,
+ HRNM(fFactory->CreateTextFormat(dwFamilyName ? dwFamilyName : L"",
fFontCollection.get(),
dwStyle.fWeight,
dwStyle.fSlant,