* Instead of invoking _DrawLines out of the app-server drawing context,
we request the drawing via Invalidate() - this make use of the app-server's potential double buffering, whenever that is active. This change reduces flickering in VESA mode considerably. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29962 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -324,6 +324,10 @@ private:
|
|||||||
|
|
||||||
void _DrawLines(int32 startLine, int32 endLine,
|
void _DrawLines(int32 startLine, int32 endLine,
|
||||||
int32 startOffset = -1, bool erase = false);
|
int32 startOffset = -1, bool erase = false);
|
||||||
|
void _RequestDrawLines(int32 startLine,
|
||||||
|
int32 endLine, int32 startOffset = -1,
|
||||||
|
bool erase = false);
|
||||||
|
|
||||||
void _DrawCaret(int32 offset);
|
void _DrawCaret(int32 offset);
|
||||||
void _ShowCaret();
|
void _ShowCaret();
|
||||||
void _HideCaret();
|
void _HideCaret();
|
||||||
|
|||||||
@@ -1628,7 +1628,8 @@ BTextView::SetFontAndColor(int32 startOffset, int32 endOffset,
|
|||||||
_Refresh(startOffset, endOffset, startOffset != endOffset, false);
|
_Refresh(startOffset, endOffset, startOffset != endOffset, false);
|
||||||
} else {
|
} else {
|
||||||
// the line breaks wont change, simply redraw
|
// the line breaks wont change, simply redraw
|
||||||
_DrawLines(LineAt(startOffset), LineAt(endOffset), startOffset, true);
|
_RequestDrawLines(LineAt(startOffset), LineAt(endOffset), startOffset,
|
||||||
|
true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3536,7 +3537,7 @@ BTextView::_Refresh(int32 fromOffset, int32 toOffset, bool erase, bool scroll)
|
|||||||
|
|
||||||
_AutoResize(false);
|
_AutoResize(false);
|
||||||
|
|
||||||
_DrawLines(fromLine, toLine, drawOffset, erase);
|
_RequestDrawLines(fromLine, toLine, drawOffset, erase);
|
||||||
|
|
||||||
// erase the area below the text
|
// erase the area below the text
|
||||||
BRect eraseRect = bounds;
|
BRect eraseRect = bounds;
|
||||||
@@ -4163,6 +4164,29 @@ BTextView::_DrawLines(int32 startLine, int32 endLine, int32 startOffset,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BTextView::_RequestDrawLines(int32 startLine, int32 endLine,
|
||||||
|
int32 startOffset, bool erase)
|
||||||
|
{
|
||||||
|
if (!Window())
|
||||||
|
return;
|
||||||
|
|
||||||
|
long maxLine = fLines->NumLines() - 1;
|
||||||
|
if (startLine < 0)
|
||||||
|
startLine = 0;
|
||||||
|
if (endLine > maxLine)
|
||||||
|
endLine = maxLine;
|
||||||
|
|
||||||
|
STELine *from = (*fLines)[startLine];
|
||||||
|
STELine *to = endLine == maxLine ? NULL : (*fLines)[endLine + 1];
|
||||||
|
BRect invalidRect(fTextRect.left, from->origin + fTextRect.top,
|
||||||
|
fTextRect.right,
|
||||||
|
to != NULL ? to->origin + fTextRect.top : fTextRect.bottom);
|
||||||
|
Invalidate(invalidRect);
|
||||||
|
Window()->UpdateIfNeeded();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BTextView::_DrawCaret(int32 offset)
|
BTextView::_DrawCaret(int32 offset)
|
||||||
{
|
{
|
||||||
@@ -4566,7 +4590,7 @@ BTextView::_AutoResize(bool redraw)
|
|||||||
fTextRect.right = fTextRect.left + newWidth;
|
fTextRect.right = fTextRect.left + newWidth;
|
||||||
|
|
||||||
if (redraw)
|
if (redraw)
|
||||||
_DrawLines(0, 0);
|
_RequestDrawLines(0, 0);
|
||||||
|
|
||||||
// erase any potential left over outside the text rect
|
// erase any potential left over outside the text rect
|
||||||
// (can only be on right hand side)
|
// (can only be on right hand side)
|
||||||
|
|||||||
Reference in New Issue
Block a user