Slight cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42168 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -135,5 +135,4 @@ InspectorWindow::MemoryBlockRetrieved(TeamMemoryBlock* block)
|
|||||||
{
|
{
|
||||||
fCurrentBlock = block;
|
fCurrentBlock = block;
|
||||||
fMemoryView->SetTargetAddress(block, fCurrentAddress);
|
fMemoryView->SetTargetAddress(block, fCurrentAddress);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,6 +98,8 @@ MemoryView::Draw(BRect rect)
|
|||||||
if (fTargetBlock == NULL)
|
if (fTargetBlock == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
char buffer[9];
|
||||||
|
|
||||||
int32 startLine = (int32)rect.top / fLineHeight;
|
int32 startLine = (int32)rect.top / fLineHeight;
|
||||||
int32 bytesPerLine = fNybblesPerLine / 2;
|
int32 bytesPerLine = fNybblesPerLine / 2;
|
||||||
int32 startByte = bytesPerLine * startLine;
|
int32 startByte = bytesPerLine * startLine;
|
||||||
@@ -105,21 +107,21 @@ MemoryView::Draw(BRect rect)
|
|||||||
target_addr_t maxAddress = fTargetBlock->BaseAddress()
|
target_addr_t maxAddress = fTargetBlock->BaseAddress()
|
||||||
+ fTargetBlock->Size();
|
+ fTargetBlock->Size();
|
||||||
BPoint drawPoint(1.0, rect.top);
|
BPoint drawPoint(1.0, rect.top);
|
||||||
BString tempData;
|
|
||||||
int32 currentBytesPerLine = bytesPerLine;
|
int32 currentBytesPerLine = bytesPerLine;
|
||||||
|
|
||||||
for (int32 i = startLine; drawPoint.y < rect.bottom
|
for (int32 i = startLine; drawPoint.y < rect.bottom
|
||||||
&& currentAddress < maxAddress; i++, drawPoint.y += fLineHeight) {
|
&& currentAddress < maxAddress; i++, drawPoint.y += fLineHeight) {
|
||||||
drawPoint.x = 1.0;
|
drawPoint.x = 1.0;
|
||||||
tempData.SetToFormat("%" B_PRIx32 " ",
|
snprintf(buffer, sizeof(buffer), "%" B_PRIx32 " ",
|
||||||
currentAddress);
|
(uint32)currentAddress);
|
||||||
DrawString(tempData.String(), drawPoint);
|
DrawString(buffer, drawPoint);
|
||||||
drawPoint.x += fCharWidth * 10;
|
drawPoint.x += fCharWidth * 10;
|
||||||
if (currentAddress + bytesPerLine > maxAddress)
|
if (currentAddress + bytesPerLine > maxAddress)
|
||||||
currentBytesPerLine = maxAddress - currentAddress;
|
currentBytesPerLine = maxAddress - currentAddress;
|
||||||
for (int32 j = 0; j < currentBytesPerLine; j += 2) {
|
for (int32 j = 0; j < currentBytesPerLine; j += 2) {
|
||||||
tempData.SetToFormat("%04" B_PRIx16 " ",
|
snprintf(buffer, sizeof(buffer), "%04" B_PRIx16 " ",
|
||||||
*((uint16*)&fTargetBlock->Data()[i * bytesPerLine + j]));
|
*((uint16*)&fTargetBlock->Data()[i * bytesPerLine + j]));
|
||||||
DrawString(tempData.String(), drawPoint);
|
DrawString(buffer, drawPoint);
|
||||||
drawPoint.x += fCharWidth * 5;
|
drawPoint.x += fCharWidth * 5;
|
||||||
}
|
}
|
||||||
currentAddress += bytesPerLine;
|
currentAddress += bytesPerLine;
|
||||||
|
|||||||
Reference in New Issue
Block a user