X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Frendering%2Fatlas%2Ftext-atlas-renderer.cpp;h=1a1063c8c1676f2980a383ff319529ec7700c61c;hp=d408450a66198f3c1f20ee79c0481fc31723c600;hb=414fde1d3caad7cf88baecbeb62df75eccaa1499;hpb=7008ea12306b251a506e2ebbf0d85b6a47f1be3d 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 d408450..1a1063c 100644 --- a/dali-toolkit/internal/text/rendering/atlas/text-atlas-renderer.cpp +++ b/dali-toolkit/internal/text/rendering/atlas/text-atlas-renderer.cpp @@ -215,14 +215,36 @@ struct AtlasRenderer::Impl glyphBufferData, style.outline); + uint32_t glyphBufferSize = glyphBufferData.width * glyphBufferData.height * Pixel::GetBytesPerPixel(glyphBufferData.format); + // If glyph buffer data don't have ownership, Or if we need to decompress, create new memory and replace ownership. + if(!glyphBufferData.isBufferOwned || glyphBufferData.compressionType != TextAbstraction::FontClient::GlyphBufferData::CompressionType::NO_COMPRESSION) + { + uint8_t* newBuffer = (uint8_t*)malloc(glyphBufferSize); + if(DALI_LIKELY(newBuffer != nullptr)) + { + TextAbstraction::FontClient::GlyphBufferData::Decompress(glyphBufferData, newBuffer); + if(glyphBufferData.isBufferOwned) + { + // Release previous buffer + free(glyphBufferData.buffer); + } + glyphBufferData.isBufferOwned = true; + glyphBufferData.buffer = newBuffer; + glyphBufferData.compressionType = TextAbstraction::FontClient::GlyphBufferData::CompressionType::NO_COMPRESSION; + } + } + // Create the pixel data. bitmap = PixelData::New(glyphBufferData.buffer, - glyphBufferData.width * glyphBufferData.height * GetBytesPerPixel(glyphBufferData.format), + glyphBufferSize, glyphBufferData.width, glyphBufferData.height, glyphBufferData.format, PixelData::FREE); + // Change buffer ownership. + glyphBufferData.isBufferOwned = false; + if(bitmap) { // Ensure that the next image will fit into the current block size @@ -782,7 +804,7 @@ struct AtlasRenderer::Impl DALI_LOG_INFO(gLogFilter, Debug::Verbose, "%s\n", metrics.mVerboseGlyphCounts.c_str()); - for(uint32_t i = 0; i < metrics.mAtlasMetrics.mAtlasCount; ++i) + for(uint32_t i = 0; gLogFilter->IsEnabledFor(Debug::Verbose) && i < metrics.mAtlasMetrics.mAtlasCount; ++i) { DALI_LOG_INFO(gLogFilter, Debug::Verbose, " Atlas [%i] %sPixels: %s Size: %ix%i, BlockSize: %ix%i, BlocksUsed: %i/%i\n", i + 1, i > 8 ? "" : " ", metrics.mAtlasMetrics.mAtlasMetrics[i].mPixelFormat == Pixel::L8 ? "L8 " : "BGRA", metrics.mAtlasMetrics.mAtlasMetrics[i].mSize.mWidth, metrics.mAtlasMetrics.mAtlasMetrics[i].mSize.mHeight, metrics.mAtlasMetrics.mAtlasMetrics[i].mSize.mBlockWidth, metrics.mAtlasMetrics.mAtlasMetrics[i].mSize.mBlockHeight, metrics.mAtlasMetrics.mAtlasMetrics[i].mBlocksUsed, metrics.mAtlasMetrics.mAtlasMetrics[i].mTotalBlocks); }