Small re-inline cleanup for GrGlyphCache
Change-Id: Ib071b27ef7c14ab3d46b4b838dab38ef9a0c8377 Reviewed-on: https://skia-review.googlesource.com/c/161220 Reviewed-by: Mike Klein <mtklein@google.com> Commit-Queue: Mike Klein <mtklein@google.com>
This commit is contained in:
parent
c6471ebc67
commit
411bf137c0
@ -56,7 +56,7 @@ void GrGlyphCache::HandleEviction(GrDrawOpAtlas::AtlasID id, void* ptr) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline GrMaskFormat get_packed_glyph_mask_format(const SkGlyph& glyph) {
|
static GrMaskFormat get_packed_glyph_mask_format(const SkGlyph& glyph) {
|
||||||
SkMask::Format format = static_cast<SkMask::Format>(glyph.fMaskFormat);
|
SkMask::Format format = static_cast<SkMask::Format>(glyph.fMaskFormat);
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case SkMask::kBW_Format:
|
case SkMask::kBW_Format:
|
||||||
@ -76,18 +76,6 @@ static inline GrMaskFormat get_packed_glyph_mask_format(const SkGlyph& glyph) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool get_packed_glyph_bounds(SkGlyphCache* cache, const SkGlyph& glyph,
|
|
||||||
SkIRect* bounds) {
|
|
||||||
#if 1
|
|
||||||
// crbug:510931
|
|
||||||
// Retrieving the image from the cache can actually change the mask format.
|
|
||||||
cache->findImage(glyph);
|
|
||||||
#endif
|
|
||||||
bounds->setXYWH(glyph.fLeft, glyph.fTop, glyph.fWidth, glyph.fHeight);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// expands each bit in a bitmask to 0 or ~0 of type INT_TYPE. Used to expand a BW glyph mask to
|
// expands each bit in a bitmask to 0 or ~0 of type INT_TYPE. Used to expand a BW glyph mask to
|
||||||
// A8, RGB565, or RGBA8888.
|
// A8, RGB565, or RGBA8888.
|
||||||
template <typename INT_TYPE>
|
template <typename INT_TYPE>
|
||||||
@ -218,9 +206,12 @@ GrTextStrike::~GrTextStrike() {
|
|||||||
GrGlyph* GrTextStrike::generateGlyph(const SkGlyph& skGlyph, GrGlyph::PackedID packed,
|
GrGlyph* GrTextStrike::generateGlyph(const SkGlyph& skGlyph, GrGlyph::PackedID packed,
|
||||||
SkGlyphCache* cache) {
|
SkGlyphCache* cache) {
|
||||||
SkIRect bounds;
|
SkIRect bounds;
|
||||||
if (!get_packed_glyph_bounds(cache, skGlyph, &bounds)) {
|
|
||||||
return nullptr;
|
// crbug:510931
|
||||||
}
|
// Retrieving the image from the cache can actually change the mask format.
|
||||||
|
cache->findImage(skGlyph);
|
||||||
|
bounds.setXYWH(skGlyph.fLeft, skGlyph.fTop, skGlyph.fWidth, skGlyph.fHeight);
|
||||||
|
|
||||||
GrMaskFormat format = get_packed_glyph_mask_format(skGlyph);
|
GrMaskFormat format = get_packed_glyph_mask_format(skGlyph);
|
||||||
|
|
||||||
GrGlyph* glyph = fPool.make<GrGlyph>();
|
GrGlyph* glyph = fPool.make<GrGlyph>();
|
||||||
|
Loading…
Reference in New Issue
Block a user