some changes, fixed a rendering bug

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18987 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2006-10-02 12:23:38 +00:00
parent 0439428356
commit de20f0faca
3 changed files with 23 additions and 29 deletions

View File

@ -3574,18 +3574,18 @@ BTextView::DrawLines(int32 startLine, int32 endLine, int32 startOffset, bool era
BRegion inputRegion;
if (fInline != NULL && fInline->IsActive())
GetTextRegion(fInline->Offset(), fInline->Offset() + fInline->Length(), &inputRegion);
float startLeft = fTextRect.left;
if (startOffset != -1) {
startLeft = PointAt(startOffset).x;
if (ByteAt(startOffset) == B_ENTER) {
// StartOffset is a newline
startLeft = PointAt((*fLines)[startLine]->offset).x;
}
}
BPoint leftTop(startLeft, line->origin);
//BPoint leftTop(startLeft, line->origin);
for (long i = startLine; i <= endLine; i++) {
float startLeft = fTextRect.left;
if (startOffset != -1) {
startLeft = PointAt(startOffset).x;
if (ByteAt(startOffset) == B_ENTER) {
// StartOffset is a newline
startLeft = PointAt((*fLines)[i]->offset).x;
}
}
long length = (line + 1)->offset;
if (startOffset != -1)
length -= startOffset;
@ -3665,9 +3665,8 @@ BTextView::DrawLines(int32 startLine, int32 endLine, int32 startOffset, bool era
view->PopState();
}
int32 returnedBytes = 0;
const char *string = fText->GetString(offset, tabChars, &returnedBytes);
view->DrawString(string, returnedBytes);
int32 returnedBytes = tabChars;
view->DrawString(fText->GetString(offset, &returnedBytes), returnedBytes);
if (foundTab) {
float penPos = PenLocation().x - fTextRect.left;
@ -3705,9 +3704,9 @@ BTextView::DrawLines(int32 startLine, int32 endLine, int32 startOffset, bool era
if (fOffscreen != NULL) {
view->Sync();
BPoint penLocation = view->PenLocation();
/*BPoint penLocation = view->PenLocation();
BRect drawRect(leftTop.x, leftTop.y, penLocation.x, penLocation.y);
DrawBitmap(fOffscreen, drawRect, drawRect);
DrawBitmap(fOffscreen, drawRect, drawRect);*/
fOffscreen->Unlock();
}

View File

@ -42,8 +42,7 @@ _BTextGapBuffer_::~_BTextGapBuffer_()
void
_BTextGapBuffer_::InsertText(const char *inText, int32 inNumItems,
int32 inAtIndex)
_BTextGapBuffer_::InsertText(const char *inText, int32 inNumItems, int32 inAtIndex)
{
if (inNumItems < 1)
return;
@ -169,15 +168,15 @@ _BTextGapBuffer_::SizeGapTo(long inCount)
const char *
_BTextGapBuffer_::GetString(int32 fromOffset, int32 numBytes, int32 *returnedBytes)
_BTextGapBuffer_::GetString(int32 fromOffset, int32 *_numBytes)
{
char *result = "";
if (numBytes < 1) {
if (returnedBytes != NULL)
*returnedBytes = 0;
if (_numBytes == NULL)
return result;
int32 numBytes = *_numBytes;
if (numBytes < 1)
return result;
}
bool isStartBeforeGap = (fromOffset < fGapIndex);
bool isEndBeforeGap = ((fromOffset + numBytes - 1) < fGapIndex);
@ -199,9 +198,6 @@ _BTextGapBuffer_::GetString(int32 fromOffset, int32 numBytes, int32 *returnedByt
result = fScratchBuffer;
}
if (returnedBytes != NULL)
*returnedBytes = numBytes;
// TODO: this could be improved. We are overwriting what we did some lines ago,
// we could just avoid to do that.
if (fPasswordMode) {
@ -220,8 +216,7 @@ _BTextGapBuffer_::GetString(int32 fromOffset, int32 numBytes, int32 *returnedByt
scratchPtr += charLen;
}
scratchPtr = '\0';
if (returnedBytes != NULL)
*returnedBytes = newSize - 1;
*_numBytes = newSize - 1;
}
return result;

View File

@ -34,7 +34,7 @@ virtual ~_BTextGapBuffer_();
// char *RealText();
const char *GetString(int32 fromOffset, int32 numBytes, int32 *returnedBytes);
const char *GetString(int32 fromOffset, int32 *numBytes);
void GetString(int32 offset, int32 length, char *buffer);
char RealCharAt(int32 offset) const;