Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e43f785b authored by Romain Guy's avatar Romain Guy
Browse files

Correctly check the height of a glyph prior to caching it

Change-Id: Iaf3977afc20fcde65bfda7b9e092b3e723241684
parent 8087246d
Loading
Loading
Loading
Loading
+9 −10
Original line number Original line Diff line number Diff line
@@ -106,7 +106,7 @@ CacheBlock* CacheBlock::removeBlock(CacheBlock* head, CacheBlock *blockToRemove)
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////


bool CacheTexture::fitBitmap(const SkGlyph& glyph, uint32_t* retOriginX, uint32_t* retOriginY) {
bool CacheTexture::fitBitmap(const SkGlyph& glyph, uint32_t* retOriginX, uint32_t* retOriginY) {
    if (glyph.fHeight + TEXTURE_BORDER_SIZE > mHeight) {
    if (glyph.fHeight + TEXTURE_BORDER_SIZE * 2 > mHeight) {
        return false;
        return false;
    }
    }


@@ -117,8 +117,7 @@ bool CacheTexture::fitBitmap(const SkGlyph& glyph, uint32_t *retOriginX, uint32_
    // This columns for glyphs that are close but not necessarily exactly the same size. It trades
    // This columns for glyphs that are close but not necessarily exactly the same size. It trades
    // off the loss of a few pixels for some glyphs against the ability to store more glyphs
    // off the loss of a few pixels for some glyphs against the ability to store more glyphs
    // of varying sizes in one block.
    // of varying sizes in one block.
    uint16_t roundedUpW =
    uint16_t roundedUpW = (glyphW + CACHE_BLOCK_ROUNDING_SIZE - 1) & -CACHE_BLOCK_ROUNDING_SIZE;
            (glyphW + CACHE_BLOCK_ROUNDING_SIZE - 1) & -CACHE_BLOCK_ROUNDING_SIZE;


    CacheBlock* cacheBlock = mCacheBlocks;
    CacheBlock* cacheBlock = mCacheBlocks;
    while (cacheBlock) {
    while (cacheBlock) {
+4 −4

File changed.

Contains only whitespace changes.