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

Unified Diff: src/ports/SkFontMgr_android.cpp

Issue 1726213004: Deduplicate axis value resolving code. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Convince gcc that the values are assigned before use. Created 4 years, 10 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 | 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 a71e2c9276d33ae1132218467b1928bba96703a0..93a7d8659f9e16fead6f66f11ffd6a8e4445d9e7 100644
--- a/src/ports/SkFontMgr_android.cpp
+++ b/src/ports/SkFontMgr_android.cpp
@@ -198,49 +198,9 @@ public:
}
SkAutoSTMalloc<4, SkFixed> axisValues(axisDefinitions.count());
- for (int i = 0; i < axisDefinitions.count(); ++i) {
- const Scanner::AxisDefinition& axisDefinition = axisDefinitions[i];
- axisValues[i] = axisDefinition.fDefault;
- for (int j = 0; j < fontFile.fAxes.count(); ++j) {
- const FontFileInfo::Axis& axisSpecified = fontFile.fAxes[j];
- if (axisDefinition.fTag == axisSpecified.fTag) {
- axisValues[i] = SkTPin(axisSpecified.fValue, axisDefinition.fMinimum,
- axisDefinition.fMaximum);
- if (axisValues[i] != axisSpecified.fValue) {
- SkDEBUGF(("Requested font axis value out of range: "
- "%s '%c%c%c%c' %f; pinned to %f.\n",
- familyName.c_str(),
- (axisDefinition.fTag >> 24) & 0xFF,
- (axisDefinition.fTag >> 16) & 0xFF,
- (axisDefinition.fTag >> 8) & 0xFF,
- (axisDefinition.fTag ) & 0xFF,
- SkFixedToDouble(axisSpecified.fValue),
- SkFixedToDouble(axisValues[i])));
- }
- break;
- }
- }
- // TODO: warn on defaulted axis?
- }
-
- SkDEBUGCODE(
- // Check for axis specified, but not matched in font.
- for (int i = 0; i < fontFile.fAxes.count(); ++i) {
- SkFourByteTag skTag = fontFile.fAxes[i].fTag;
- bool found = false;
- for (int j = 0; j < axisDefinitions.count(); ++j) {
- if (skTag == axisDefinitions[j].fTag) {
- found = true;
- break;
- }
- }
- if (!found) {
- SkDEBUGF(("Requested font axis not found: %s '%c%c%c%c'\n",
- familyName.c_str(), (skTag >> 24) & 0xFF,
- (skTag >> 16) & 0xFF, (skTag >> 8) & 0xFF, (skTag)&0xFF));
- }
- }
- )
+ Scanner::computeAxisValues(axisDefinitions,
+ fontFile.fAxes.begin(), fontFile.fAxes.count(),
+ axisValues, familyName);
fStyles.push_back().reset(new SkTypeface_AndroidSystem(
pathName, cacheFontFiles, ttcIndex, axisValues.get(), axisDefinitions.count(),
« no previous file with comments | « no previous file | src/ports/SkFontMgr_android_parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698