/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
bool gfxGlyphExtents::GetTightGlyphExtentsAppUnitsLocked(
gfxFont* aFont, DrawTarget* aDrawTarget, uint32_t aGlyphID,
gfxRect* aExtents) {
HashEntry* entry = mTightGlyphExtents.GetEntry(aGlyphID); if (!entry) { // Some functions higher up in the call chain deliberately pass in a // nullptr DrawTarget, e.g. GetBaselinePosition() passes nullptr to // gfxTextRun::MeasureText() and that nullptr reaches here. if (!aDrawTarget) {
NS_WARNING("Could not get glyph extents (no aDrawTarget)"); returnfalse;
}
#ifdef DEBUG_TEXT_RUN_STORAGE_METRICS
++gGlyphExtentsSetupLazyTight; #endif // We need to temporarily release the read lock, as SetupGlyphExtents will // take a write lock internally when it wants to set the new entry.
MOZ_PUSH_IGNORE_THREAD_SAFETY
mLock.ReadUnlock();
aFont->SetupGlyphExtents(aDrawTarget, aGlyphID, true, this);
mLock.ReadLock();
MOZ_POP_THREAD_SAFETY
entry = mTightGlyphExtents.GetEntry(aGlyphID); if (!entry) {
NS_WARNING("Could not get glyph extents"); returnfalse;
}
}
uint16_t* newBlock; if (bits & 0x1) { // Expand the block to a real block. We could avoid this by checking // glyphOffset == GetGlyphOffset(bits), but that never happens so don't // bother
newBlock = new uint16_t[BLOCK_SIZE]; if (!newBlock) return;
uint32_t i; for (i = 0; i < BLOCK_SIZE; ++i) {
newBlock[i] = INVALID_WIDTH;
}
newBlock[GetGlyphOffset(bits)] = GetWidth(bits);
mBlocks[block] = reinterpret_cast<uintptr_t>(newBlock);
} else {
newBlock = reinterpret_cast<uint16_t*>(bits);
}
newBlock[glyphOffset] = aWidth;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.