本文整理汇总了C++中SkGlyph::isJustAdvance方法的典型用法代码示例。如果您正苦于以下问题:C++ SkGlyph::isJustAdvance方法的具体用法?C++ SkGlyph::isJustAdvance怎么用?C++ SkGlyph::isJustAdvance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkGlyph
的用法示例。
在下文中一共展示了SkGlyph::isJustAdvance方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lookupByPackedGlyphID
SkGlyph* SkGlyphCache::lookupByPackedGlyphID(PackedGlyphID packedGlyphID, MetricsType type) {
SkGlyph* glyph = fGlyphMap.find(packedGlyphID);
if (nullptr == glyph) {
glyph = this->allocateNewGlyph(packedGlyphID, type);
} else {
if (type == kFull_MetricsType && glyph->isJustAdvance()) {
fScalerContext->getMetrics(glyph);
}
}
return glyph;
}
示例2: lookupMetrics
SkGlyph* SkGlyphCache::lookupMetrics(uint32_t id, MetricsType mtype) {
SkGlyph* glyph;
int hi = 0;
int count = fGlyphArray.count();
if (count) {
SkGlyph** gptr = fGlyphArray.begin();
int lo = 0;
hi = count - 1;
while (lo < hi) {
int mid = (hi + lo) >> 1;
if (gptr[mid]->fID < id) {
lo = mid + 1;
} else {
hi = mid;
}
}
glyph = gptr[hi];
if (glyph->fID == id) {
if (kFull_MetricsType == mtype && glyph->isJustAdvance()) {
fScalerContext->getMetrics(glyph);
}
return glyph;
}
// check if we need to bump hi before falling though to the allocator
if (glyph->fID < id) {
hi += 1;
}
}
// not found, but hi tells us where to inser the new glyph
fMemoryUsed += sizeof(SkGlyph);
glyph = (SkGlyph*)fGlyphAlloc.alloc(sizeof(SkGlyph),
SkChunkAlloc::kThrow_AllocFailType);
glyph->init(id);
*fGlyphArray.insert(hi) = glyph;
if (kJustAdvance_MetricsType == mtype) {
fScalerContext->getAdvance(glyph);
} else {
SkASSERT(kFull_MetricsType == mtype);
fScalerContext->getMetrics(glyph);
}
return glyph;
}
示例3: VALIDATE
const SkGlyph& SkGlyphCache::getGlyphIDMetrics(uint16_t glyphID) {
VALIDATE();
uint32_t id = SkGlyph::MakeID(glyphID);
unsigned index = ID2HashIndex(id);
SkGlyph* glyph = fGlyphHash[index];
if (NULL == glyph || glyph->fID != id) {
RecordHashCollisionIf(glyph != NULL);
glyph = this->lookupMetrics(glyphID, kFull_MetricsType);
fGlyphHash[index] = glyph;
} else {
RecordHashSuccess();
if (glyph->isJustAdvance()) {
fScalerContext->getMetrics(glyph);
}
}
SkASSERT(glyph->isFullMetrics());
return *glyph;
}