From: Richard Underhill Date: Thu, 16 Apr 2015 10:28:25 +0000 (+0100) Subject: Fixes crash when fontclient is unable to supply a correct bitmap X-Git-Tag: dali_1.0.39~4^2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=949378774536058381b6dc6d16fc77fa73ce1411 Fixes crash when fontclient is unable to supply a correct bitmap Change-Id: Idcc5f0921e39ce8927a429987a8edc8567103d9d Signed-off-by: Richard Underhill --- diff --git a/dali-toolkit/internal/text/rendering/atlas/text-atlas-renderer.cpp b/dali-toolkit/internal/text/rendering/atlas/text-atlas-renderer.cpp index b82b07b..1825840 100644 --- a/dali-toolkit/internal/text/rendering/atlas/text-atlas-renderer.cpp +++ b/dali-toolkit/internal/text/rendering/atlas/text-atlas-renderer.cpp @@ -207,36 +207,38 @@ struct AtlasRenderer::Impl : public ConnectionTracker // Create a new image for the glyph BufferImage bitmap = mFontClient.CreateBitmap( glyph.fontId, glyph.index ); - - // Ensure that the next image will fit into the current block size - bool setSize = false; - if ( bitmap.GetWidth() > mBlockSizes[ currentBlockSize ].mNeededBlockWidth ) - { - setSize = true; - mBlockSizes[ currentBlockSize ].mNeededBlockWidth = bitmap.GetWidth(); - } - if ( bitmap.GetHeight() > mBlockSizes[ currentBlockSize ].mNeededBlockHeight ) + if ( bitmap ) { - setSize = true; - mBlockSizes[ currentBlockSize ].mNeededBlockHeight = bitmap.GetHeight(); - } + // Ensure that the next image will fit into the current block size + bool setSize = false; + if ( bitmap.GetWidth() > mBlockSizes[ currentBlockSize ].mNeededBlockWidth ) + { + setSize = true; + mBlockSizes[ currentBlockSize ].mNeededBlockWidth = bitmap.GetWidth(); + } + if ( bitmap.GetHeight() > mBlockSizes[ currentBlockSize ].mNeededBlockHeight ) + { + setSize = true; + mBlockSizes[ currentBlockSize ].mNeededBlockHeight = bitmap.GetHeight(); + } - if ( setSize ) - { - mGlyphManager.SetNewAtlasSize( DEFAULT_ATLAS_WIDTH, - DEFAULT_ATLAS_HEIGHT, - mBlockSizes[ currentBlockSize ].mNeededBlockWidth, - mBlockSizes[ currentBlockSize ].mNeededBlockHeight ); - } + if ( setSize ) + { + mGlyphManager.SetNewAtlasSize( DEFAULT_ATLAS_WIDTH, + DEFAULT_ATLAS_HEIGHT, + mBlockSizes[ currentBlockSize ].mNeededBlockWidth, + mBlockSizes[ currentBlockSize ].mNeededBlockHeight ); + } - // Locate a new slot for our glyph - mGlyphManager.Add( glyph, bitmap, slot ); + // Locate a new slot for our glyph + mGlyphManager.Add( glyph, bitmap, slot ); - // Generate mesh data for this quad, plugging in our supplied position - if ( slot.mImageId ) - { - mGlyphManager.GenerateMeshData( slot.mImageId, position, newMeshData ); - mImageIds.PushBack( slot.mImageId ); + // Generate mesh data for this quad, plugging in our supplied position + if ( slot.mImageId ) + { + mGlyphManager.GenerateMeshData( slot.mImageId, position, newMeshData ); + mImageIds.PushBack( slot.mImageId ); + } } } // Find an existing mesh data object to attach to ( or create a new one, if we can't find one using the same atlas) @@ -248,7 +250,7 @@ struct AtlasRenderer::Impl : public ConnectionTracker currentUnderlinePosition, currentUnderlineThickness, slot ); - lastFontId = glyph.fontId; + lastFontId = glyph.fontId; } }