diff options
author | 2015-07-29 11:49:40 -0700 | |
---|---|---|
committer | 2015-07-29 11:49:40 -0700 | |
commit | f20488b4f2139e6ca09fee7e39b731dd8ab467db (patch) | |
tree | 9937f93de673f5b6ab43c8ced877fa828e27f3dc /src/ports/SkFontMgr_android.cpp | |
parent | 26e0e587f76f2a9338652c100f835c2377c908d3 (diff) |
Clean up a few includes, introduce iwyu.
The current include-what-you-use with current clang is much less
noisy and more useful than it has been in the past. This change
introduces a few IWYU directives (which are helpful documentation for
humans as well) and fixes a few sets of includes.
Review URL: https://codereview.chromium.org/1207893002
Diffstat (limited to 'src/ports/SkFontMgr_android.cpp')
-rw-r--r-- | src/ports/SkFontMgr_android.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/ports/SkFontMgr_android.cpp b/src/ports/SkFontMgr_android.cpp index f85539ca53..88045a4b20 100644 --- a/src/ports/SkFontMgr_android.cpp +++ b/src/ports/SkFontMgr_android.cpp @@ -5,20 +5,27 @@ * found in the LICENSE file. */ +#include "SkFixed.h" #include "SkFontDescriptor.h" #include "SkFontHost_FreeType_common.h" #include "SkFontMgr.h" #include "SkFontMgr_android.h" #include "SkFontMgr_android_parser.h" #include "SkFontStyle.h" +#include "SkRefCnt.h" +#include "SkString.h" #include "SkStream.h" +#include "SkTArray.h" #include "SkTDArray.h" #include "SkTSearch.h" +#include "SkTemplates.h" #include "SkTypeface.h" #include "SkTypefaceCache.h" #include <limits> +class SkData; + class SkTypeface_Android : public SkTypeface_FreeType { public: SkTypeface_Android(const SkFontStyle& style, @@ -275,9 +282,9 @@ private: } static int match_score(const SkFontStyle& pattern, const SkFontStyle& candidate) { int score = 0; - score += abs((pattern.width() - candidate.width()) * 100); - score += abs((pattern.isItalic() == candidate.isItalic()) ? 0 : 1000); - score += abs(pattern.weight() - candidate.weight()); + score += SkTAbs((pattern.width() - candidate.width()) * 100); + score += SkTAbs((pattern.isItalic() == candidate.isItalic()) ? 0 : 1000); + score += SkTAbs(pattern.weight() - candidate.weight()); return score; } @@ -400,13 +407,7 @@ protected: continue; } - SkPaint paint; - paint.setTypeface(face); - paint.setTextEncoding(SkPaint::kUTF32_TextEncoding); - - uint16_t glyphID; - paint.textToGlyphs(&character, sizeof(character), &glyphID); - if (glyphID != 0) { + if (face->charsToGlyphs(&character, SkTypeface::kUTF32_Encoding, NULL, 0)) { return face.detach(); } } |