/* * Copyright 2006 The Android Open Source Project * * Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
*/
// This class holds the results of an SkScalerContext, and owns a references to that scaler. class SkStrike final : public sktext::StrikeForGPU { public:
SkStrike(SkStrikeCache* strikeCache, const SkStrikeSpec& strikeSpec,
std::unique_ptr<SkScalerContext> scaler, const SkFontMetrics* metrics,
std::unique_ptr<SkStrikePinner> pinner);
// Lookup (or create if needed) the returned glyph using toID. If that glyph is not initialized // with an image, then use the information in fromGlyph to initialize the width, height top, // left, format and image of the glyph. This is mainly used preserving the glyph if it was // created by a search of desperation. This is deprecated.
SkGlyph* mergeGlyphAndImage(
SkPackedGlyphID toID, const SkGlyph& fromGlyph) SK_EXCLUDES(fStrikeLock);
// If the path has never been set, then add a path to glyph. This is deprecated. const SkPath* mergePath(
SkGlyph* glyph, const SkPath* path, bool hairline, bool modified) SK_EXCLUDES(fStrikeLock);
// If the drawable has never been set, then add a drawable to glyph. This is deprecated. const SkDrawable* mergeDrawable(
SkGlyph* glyph, sk_sp<SkDrawable> drawable) SK_EXCLUDES(fStrikeLock);
// If the advance axis intersects the glyph's path, append the positions scaled and offset // to the array (if non-null), and set the count to the updated array length. // TODO: track memory usage. void findIntercepts(const SkScalar bounds[2], SkScalar scale, SkScalar xPos,
SkGlyph*, SkScalar* array, int* count) SK_EXCLUDES(fStrikeLock);
private: friendclass SkStrikeCache; friendclass SkStrikeTestingPeer; class Monitor;
// Return a glyph. Create it if it doesn't exist, and initialize the glyph with metrics and // advances using a scaler.
SkGlyph* glyph(SkPackedGlyphID) SK_REQUIRES(fStrikeLock);
// Generate the glyph digest information and update structures to add the glyph.
SkGlyphDigest* addGlyphAndDigest(SkGlyph* glyph) SK_REQUIRES(fStrikeLock);
// internalPrepare will only be called with a mutex already held.
SkSpan<const SkGlyph*> internalPrepare(
SkSpan<const SkGlyphID> glyphIDs,
PathDetail pathDetail, const SkGlyph** results) SK_REQUIRES(fStrikeLock);
// The following are const and need no mutex protection. const SkFontMetrics fFontMetrics; const SkGlyphPositionRoundingSpec fRoundingSpec; const SkStrikeSpec fStrikeSpec;
SkStrikeCache* const fStrikeCache;
// This mutex provides protection for this specific SkStrike. mutable SkMutex fStrikeLock;
// Maps from a combined GlyphID and sub-pixel position to a SkGlyphDigest. The actual glyph is // stored in the fAlloc. The pointer to the glyph is stored fGlyphForIndex. The // SkGlyphDigest's fIndex field stores the index. This pointer provides an unchanging // reference to the SkGlyph as long as the strike is alive, and fGlyphForIndex // provides a dense index for glyphs.
skia_private::THashTable<SkGlyphDigest, SkPackedGlyphID, SkGlyphDigest>
fDigestForPackedGlyphID SK_GUARDED_BY(fStrikeLock);
// Maps from a glyphIndex to a glyph
std::vector<SkGlyph*> fGlyphForIndex SK_GUARDED_BY(fStrikeLock);
// Context that corresponds to the glyph information in this strike. const std::unique_ptr<SkScalerContext> fScalerContext SK_GUARDED_BY(fStrikeLock);
// Used while changing the strike to track memory increase.
size_t fMemoryIncrease SK_GUARDED_BY(fStrikeLock) {0};
// The following are protected by the SkStrikeCache's mutex.
SkStrike* fNext{nullptr};
SkStrike* fPrev{nullptr};
std::unique_ptr<SkStrikePinner> fPinner;
size_t fMemoryUsed{sizeof(SkStrike)}; bool fRemoved{false};
};
#endif// SkStrike_DEFINED
Messung V0.5
¤ Dauer der Verarbeitung: 0.26 Sekunden
(vorverarbeitet)
¤
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 und die Messung sind noch experimentell.