added some castings.
Change-Id: I3faf830d41c3e25211381a768eec1c30e9f67d07
Signed-off-by: Bowon Ryu <bowon.ryu@samsung.com>
TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes);
+ positionsList.Clear();
+ sizeList.Clear();
+
+ startIndex = 2;
+ endIndex = 0;
+
+ positionsList = DevelTextLabel::GetTextPosition(label, startIndex, endIndex);
+ sizeList = DevelTextLabel::GetTextSize(label, startIndex, endIndex);
+
+ TestTextGeometryUtils::CheckGeometryResult(positionsList, sizeList, expectedPositions, expectedSizes);
+
END_TEST;
}
const Length numberOfLeftToRightCharacters = paragraph.characterRun.characterIndex - index;
if(numberOfLeftToRightCharacters > 0u)
{
- memset(directionsBuffer + index - startIndex, false, numberOfLeftToRightCharacters * sizeof(bool));
+ memset(directionsBuffer + static_cast<std::size_t>(index - startIndex), false, static_cast<std::size_t>(numberOfLeftToRightCharacters) * sizeof(bool));
}
// Set the directions of the bidirectional text.
bidirectionalSupport.GetCharactersDirection(paragraph.bidirectionalInfoIndex,
- directionsBuffer + paragraph.characterRun.characterIndex - startIndex,
+ directionsBuffer + static_cast<std::size_t>(paragraph.characterRun.characterIndex - startIndex),
paragraph.characterRun.numberOfCharacters);
// Update the index.
}
// Fills with left to right those paragraphs without right to left characters.
- memset(directionsBuffer + index - startIndex, false, (lastCharacter - index) * sizeof(bool));
+ memset(directionsBuffer + static_cast<std::size_t>(index - startIndex), false, static_cast<std::size_t>(lastCharacter - index) * sizeof(bool));
// If the direction info is updated, it needs to be inserted in the model.
if(updateCurrentBuffer)
const LineIndex lineIndex = visualModel->GetLineOfCharacter(characterIndex);
const LineIndex previousLineIndex = (lineIndex > 0 ? lineIndex - 1u : lineIndex);
- const LineIndex lastLineIndex = (visualModel->mLines.Size() > 0 ? visualModel->mLines.Size() - 1u : 0);
+ const size_t lastLineIndex = (visualModel->mLines.Size() > 0 ? visualModel->mLines.Size() - 1u : 0);
const bool isLastLine = (previousLineIndex == lastLineIndex);
// Retrieve the cursor position info.
const LineRun& currline = *(visualModel->mLines.Begin() + lineIndex);
// Get last line index
- const LineIndex lastLineIndex = (visualModel->mLines.Size() > 0 ? visualModel->mLines.Size() - 1u : 0);
+ const size_t lastLineIndex = (visualModel->mLines.Size() > 0 ? visualModel->mLines.Size() - 1u : 0);
const bool isLastLine = (lineIndex + 1u == lastLineIndex);
// Get the next hit 'y' point.
updated = true;
}
- const Length numberOfGlyphs = glyphs.Count() - currentNumberOfGlyphs;
+ const Length numberOfGlyphs = static_cast<Length>(glyphs.Count()) - currentNumberOfGlyphs;
if(Controller::NO_OPERATION != (Controller::GET_GLYPH_METRICS & operations))
{
{
pos = modifyText.Begin() + cursorIndex;
}
- unsigned int realPos = pos - modifyText.Begin();
+ unsigned int realPos = static_cast<unsigned int>(pos - modifyText.Begin());
modifyText.Insert(pos, utf32Characters.Begin(), utf32Characters.Begin() + maxSizeOfNewText);
if(NULL != impl.mEditableControlInterface)
const GlyphIndex glyphIndex = *(charactersToGlyphsBuffer + characterVisualIndex);
const GlyphInfo& glyph = *(glyphsBuffer + glyphIndex);
- Vector2& position = *(glyphPositionsBuffer + glyphIndex - startGlyphIndex);
+ Vector2& position = *(glyphPositionsBuffer + static_cast<std::size_t>(glyphIndex - startGlyphIndex));
position.x = penX;
position.y = -glyph.yBearing;
DALI_ASSERT_DEBUG(glyphIndex < visualModel->mGlyphs.Count());
const GlyphInfo& glyph = *(glyphsBuffer + glyphIndex);
- Vector2& position = *(glyphPositionsBuffer + glyphIndex - startGlyphIndex);
+ Vector2& position = *(glyphPositionsBuffer + static_cast<std::size_t>(glyphIndex - startGlyphIndex));
position.x = penX + glyph.xBearing;
position.y = -glyph.yBearing;
// both characters and the direction of the paragraph.
const CharacterIndex previousVisualCursorIndex = visualCursorIndex - 1u;
- const CharacterIndex previousLogicalCursorIndex = *(bidirectionalLineInfo->visualToLogicalMap + previousVisualCursorIndex - bidirectionalLineInfo->characterRun.characterIndex) + bidirectionalLineInfo->characterRun.characterIndex;
- const CharacterIndex currentLogicalCursorIndex = *(bidirectionalLineInfo->visualToLogicalMap + visualCursorIndex - bidirectionalLineInfo->characterRun.characterIndex) + bidirectionalLineInfo->characterRun.characterIndex;
+ const CharacterIndex previousLogicalCursorIndex = *(bidirectionalLineInfo->visualToLogicalMap + static_cast<std::size_t>(previousVisualCursorIndex - bidirectionalLineInfo->characterRun.characterIndex)) + bidirectionalLineInfo->characterRun.characterIndex;
+ const CharacterIndex currentLogicalCursorIndex = *(bidirectionalLineInfo->visualToLogicalMap + static_cast<std::size_t>(visualCursorIndex - bidirectionalLineInfo->characterRun.characterIndex)) + bidirectionalLineInfo->characterRun.characterIndex;
const CharacterDirection previousCharacterDirection = *(modelCharacterDirections + previousLogicalCursorIndex);
const CharacterDirection currentCharacterDirection = *(modelCharacterDirections + currentLogicalCursorIndex);
// The bidirectional line info.
const BidirectionalLineInfoRun* const bidirectionalLineInfo = mBidirectionalLineInfo.Begin() + mBidirectionalLineIndex;
- return *(bidirectionalLineInfo->visualToLogicalMap + visualCharacterIndex - bidirectionalLineInfo->characterRun.characterIndex) + bidirectionalLineInfo->characterRun.characterIndex;
+ return *(bidirectionalLineInfo->visualToLogicalMap + static_cast<std::size_t>(visualCharacterIndex - bidirectionalLineInfo->characterRun.characterIndex)) + bidirectionalLineInfo->characterRun.characterIndex;
}
bool LogicalModel::FetchBidirectionalLineInfo(CharacterIndex characterIndex)
if(updateCurrentParagraphs)
{
for(Vector<ParagraphRun>::ConstIterator it = mParagraphInfo.Begin(),
- endIt = mParagraphInfo.Begin() + totalNumberOfParagraphs - numberOfNewParagraphs;
+ endIt = mParagraphInfo.Begin() + static_cast<std::size_t>(totalNumberOfParagraphs - numberOfNewParagraphs);
it != endIt;
++it)
{
{
// Check to see if the image will fit in these blocks
- const SizeType availableBlocks = mAtlasList[atlas].mAvailableBlocks + mAtlasList[atlas].mFreeBlocksList.Size();
+ const SizeType availableBlocks = mAtlasList[atlas].mAvailableBlocks + static_cast<SizeType>(mAtlasList[atlas].mFreeBlocksList.Size());
if(availableBlocks && IsBlockSizeSufficient(width, height, mAtlasList[atlas].mSize.mBlockWidth, mAtlasList[atlas].mSize.mBlockHeight))
{
{
entry.mSize = mAtlasList[i].mSize;
entry.mTotalBlocks = mAtlasList[i].mTotalBlocks;
- entry.mBlocksUsed = entry.mTotalBlocks - mAtlasList[i].mAvailableBlocks + mAtlasList[i].mFreeBlocksList.Size();
+ entry.mBlocksUsed = entry.mTotalBlocks - mAtlasList[i].mAvailableBlocks + static_cast<SizeType>(mAtlasList[i].mFreeBlocksList.Size());
entry.mPixelFormat = GetPixelFormat(i + 1);
metrics.mAtlasMetrics.PushBack(entry);
if(Pixel::RGBA8888 == pixelFormat)
{
const uint32_t bufferSizeInt = bufferWidth * bufferHeight;
- const uint32_t bufferSizeChar = sizeof(uint32_t) * bufferSizeInt;
+ const size_t bufferSizeChar = sizeof(uint32_t) * static_cast<std::size_t>(bufferSizeInt);
memset(imageBuffer.GetBuffer(), 0, bufferSizeChar);
}
else
{
- memset(imageBuffer.GetBuffer(), 0, bufferWidth * bufferHeight);
+ memset(imageBuffer.GetBuffer(), 0, static_cast<std::size_t>(bufferWidth * bufferHeight));
}
return imageBuffer;
const uint32_t bufferHeight = static_cast<uint32_t>(size.height);
const uint32_t bufferSizeInt = bufferWidth * bufferHeight;
- const uint32_t bufferSizeChar = sizeof(uint32_t) * bufferSizeInt;
+ const size_t bufferSizeChar = sizeof(uint32_t) * static_cast<std::size_t>(bufferSizeInt);
//Elided text in ellipsis at START could start on index greater than 0
auto startIndexOfGlyphs = mModel->GetStartIndexOfElidedGlyphs();
unsigned int height,
VectorBlob* blob)
{
- const size_t size = width * height * 4;
+ const size_t size = static_cast<size_t>(width) * static_cast<size_t>(height) * 4;
uint8_t* pixbuf = new uint8_t[size];
size_t pos;
if(startIndex >= logicalModel->mText.Count())
{
- startIndex = logicalModel->mText.Count() - 1;
+ startIndex = static_cast<CharacterIndex>(logicalModel->mText.Count() - 1u);
}
if(endIndex >= logicalModel->mText.Count())
{
- endIndex = logicalModel->mText.Count() - 1;
+ endIndex = static_cast<CharacterIndex>(logicalModel->mText.Count() - 1u);
}
if(startIndex > endIndex)