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

Unified Diff: src/ports/SkFontMgr_android.cpp

Issue 1207893002: Clean up a few includes, introduce iwyu. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: SkTypes to export stddef. Created 5 years, 5 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 | « src/ports/SkFontHost_fontconfig.cpp ('k') | src/ports/SkFontMgr_android_parser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ports/SkFontMgr_android.cpp
diff --git a/src/ports/SkFontMgr_android.cpp b/src/ports/SkFontMgr_android.cpp
index f85539ca53603c90b8196ef7a6285914177445c2..88045a4b2024a7819892a43d95e0ba11ca31bf10 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();
}
}
« no previous file with comments | « src/ports/SkFontHost_fontconfig.cpp ('k') | src/ports/SkFontMgr_android_parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698