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

Unified Diff: src/core/SkGlyphCache.cpp

Issue 1321243004: Stop using SkScalerContext::getAdvance() in SkGlyphCache. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: comment Created 5 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 | « src/core/SkGlyphCache.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkGlyphCache.cpp
diff --git a/src/core/SkGlyphCache.cpp b/src/core/SkGlyphCache.cpp
index f83aab5942f1cc3741c064a8bd5256acb3216c1b..309707c66fede82e8ee775b7d545b3984e44001f 100644
--- a/src/core/SkGlyphCache.cpp
+++ b/src/core/SkGlyphCache.cpp
@@ -119,40 +119,40 @@ int SkGlyphCache::countCachedGlyphs() const {
const SkGlyph& SkGlyphCache::getUnicharAdvance(SkUnichar charCode) {
VALIDATE();
- return *this->lookupByChar(charCode, kJustAdvance_MetricsType);
+ return *this->lookupByChar(charCode);
}
const SkGlyph& SkGlyphCache::getGlyphIDAdvance(uint16_t glyphID) {
VALIDATE();
PackedGlyphID packedGlyphID = SkGlyph::MakeID(glyphID);
- return *this->lookupByPackedGlyphID(packedGlyphID, kJustAdvance_MetricsType);
+ return *this->lookupByPackedGlyphID(packedGlyphID);
}
///////////////////////////////////////////////////////////////////////////////
const SkGlyph& SkGlyphCache::getUnicharMetrics(SkUnichar charCode) {
VALIDATE();
- return *this->lookupByChar(charCode, kFull_MetricsType);
+ return *this->lookupByChar(charCode);
}
const SkGlyph& SkGlyphCache::getUnicharMetrics(SkUnichar charCode, SkFixed x, SkFixed y) {
VALIDATE();
- return *this->lookupByChar(charCode, kFull_MetricsType, x, y);
+ return *this->lookupByChar(charCode, x, y);
}
const SkGlyph& SkGlyphCache::getGlyphIDMetrics(uint16_t glyphID) {
VALIDATE();
PackedGlyphID packedGlyphID = SkGlyph::MakeID(glyphID);
- return *this->lookupByPackedGlyphID(packedGlyphID, kFull_MetricsType);
+ return *this->lookupByPackedGlyphID(packedGlyphID);
}
const SkGlyph& SkGlyphCache::getGlyphIDMetrics(uint16_t glyphID, SkFixed x, SkFixed y) {
VALIDATE();
PackedGlyphID packedGlyphID = SkGlyph::MakeID(glyphID, x, y);
- return *this->lookupByPackedGlyphID(packedGlyphID, kFull_MetricsType);
+ return *this->lookupByPackedGlyphID(packedGlyphID);
}
-SkGlyph* SkGlyphCache::lookupByChar(SkUnichar charCode, MetricsType type, SkFixed x, SkFixed y) {
+SkGlyph* SkGlyphCache::lookupByChar(SkUnichar charCode, SkFixed x, SkFixed y) {
PackedUnicharID id = SkGlyph::MakeID(charCode, x, y);
CharGlyphRec* rec = this->getCharGlyphRec(id);
if (rec->fPackedUnicharID != id) {
@@ -161,26 +161,21 @@ SkGlyph* SkGlyphCache::lookupByChar(SkUnichar charCode, MetricsType type, SkFixe
// this ID is based on the glyph index
PackedGlyphID combinedID = SkGlyph::MakeID(fScalerContext->charToGlyphID(charCode), x, y);
rec->fPackedGlyphID = combinedID;
- return this->lookupByPackedGlyphID(combinedID, type);
+ return this->lookupByPackedGlyphID(combinedID);
} else {
- return this->lookupByPackedGlyphID(rec->fPackedGlyphID, type);
+ return this->lookupByPackedGlyphID(rec->fPackedGlyphID);
}
}
-SkGlyph* SkGlyphCache::lookupByPackedGlyphID(PackedGlyphID packedGlyphID, MetricsType type) {
+SkGlyph* SkGlyphCache::lookupByPackedGlyphID(PackedGlyphID packedGlyphID) {
SkGlyph* glyph = fGlyphMap.find(packedGlyphID);
-
if (nullptr == glyph) {
- glyph = this->allocateNewGlyph(packedGlyphID, type);
- } else {
- if (type == kFull_MetricsType && glyph->isJustAdvance()) {
- fScalerContext->getMetrics(glyph);
- }
+ glyph = this->allocateNewGlyph(packedGlyphID);
}
return glyph;
}
-SkGlyph* SkGlyphCache::allocateNewGlyph(PackedGlyphID packedGlyphID, MetricsType mtype) {
+SkGlyph* SkGlyphCache::allocateNewGlyph(PackedGlyphID packedGlyphID) {
fMemoryUsed += sizeof(SkGlyph);
SkGlyph* glyphPtr;
@@ -189,13 +184,7 @@ SkGlyph* SkGlyphCache::allocateNewGlyph(PackedGlyphID packedGlyphID, MetricsType
glyph.initGlyphFromCombinedID(packedGlyphID);
glyphPtr = fGlyphMap.set(glyph);
}
-
- if (kJustAdvance_MetricsType == mtype) {
- fScalerContext->getAdvance(glyphPtr);
- } else {
- SkASSERT(kFull_MetricsType == mtype);
- fScalerContext->getMetrics(glyphPtr);
- }
+ fScalerContext->getMetrics(glyphPtr);
SkASSERT(glyphPtr->fID != SkGlyph::kImpossibleID);
return glyphPtr;
« no previous file with comments | « src/core/SkGlyphCache.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698