Reduce drawing flicker in SourceView.
Instead of relying on the app_server to handle the background color, do so ourselves. This allows somewhat more granular control, and helps reduce flicker on drawing when single stepping.
This commit is contained in:
@@ -1045,7 +1045,7 @@ SourceView::TextView::TextView(SourceView* sourceView, MarkerManager* manager,
|
|||||||
fScrollRunner(NULL),
|
fScrollRunner(NULL),
|
||||||
fMarkerManager(manager)
|
fMarkerManager(manager)
|
||||||
{
|
{
|
||||||
SetViewColor(ui_color(B_DOCUMENT_BACKGROUND_COLOR));
|
SetViewColor(B_TRANSPARENT_COLOR);
|
||||||
fTextColor = ui_color(B_DOCUMENT_TEXT_COLOR);
|
fTextColor = ui_color(B_DOCUMENT_TEXT_COLOR);
|
||||||
SetFlags(Flags() | B_NAVIGABLE);
|
SetFlags(Flags() | B_NAVIGABLE);
|
||||||
}
|
}
|
||||||
@@ -1085,8 +1085,11 @@ SourceView::TextView::MaxSize()
|
|||||||
void
|
void
|
||||||
SourceView::TextView::Draw(BRect updateRect)
|
SourceView::TextView::Draw(BRect updateRect)
|
||||||
{
|
{
|
||||||
if (fSourceCode == NULL)
|
if (fSourceCode == NULL) {
|
||||||
|
SetLowColor(ui_color(B_DOCUMENT_BACKGROUND_COLOR));
|
||||||
|
FillRect(updateRect, B_SOLID_LOW);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// get the lines intersecting with the update rect
|
// get the lines intersecting with the update rect
|
||||||
int32 minLine, maxLine;
|
int32 minLine, maxLine;
|
||||||
@@ -1101,11 +1104,13 @@ SourceView::TextView::Draw(BRect updateRect)
|
|||||||
SourceView::MarkerManager::InstructionPointerMarker* ipMarker;
|
SourceView::MarkerManager::InstructionPointerMarker* ipMarker;
|
||||||
int32 markerIndex = 0;
|
int32 markerIndex = 0;
|
||||||
for (int32 i = minLine; i <= maxLine; i++) {
|
for (int32 i = minLine; i <= maxLine; i++) {
|
||||||
SetLowColor(ViewColor());
|
SetLowColor(ui_color(B_DOCUMENT_BACKGROUND_COLOR));
|
||||||
float y = i * fFontInfo->lineHeight;
|
float y = i * fFontInfo->lineHeight;
|
||||||
BString lineString;
|
BString lineString;
|
||||||
_FormatLine(fSourceCode->LineAt(i), lineString);
|
_FormatLine(fSourceCode->LineAt(i), lineString);
|
||||||
|
|
||||||
|
FillRect(BRect(0.0, y, kLeftTextMargin, y + fFontInfo->lineHeight),
|
||||||
|
B_SOLID_LOW);
|
||||||
for (int32 j = markerIndex; j < markers.CountItems(); j++) {
|
for (int32 j = markerIndex; j < markers.CountItems(); j++) {
|
||||||
marker = markers.ItemAt(j);
|
marker = markers.ItemAt(j);
|
||||||
if (marker->Line() < (uint32)i) {
|
if (marker->Line() < (uint32)i) {
|
||||||
@@ -1123,13 +1128,13 @@ SourceView::TextView::Draw(BRect updateRect)
|
|||||||
|
|
||||||
} else
|
} else
|
||||||
SetLowColor(255, 255, 0, 255);
|
SetLowColor(255, 255, 0, 255);
|
||||||
FillRect(BRect(kLeftTextMargin, y, Bounds().right,
|
|
||||||
y + fFontInfo->lineHeight), B_SOLID_LOW);
|
|
||||||
break;
|
break;
|
||||||
} else
|
} else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FillRect(BRect(kLeftTextMargin, y, Bounds().right,
|
||||||
|
y + fFontInfo->lineHeight), B_SOLID_LOW);
|
||||||
DrawString(lineString,
|
DrawString(lineString,
|
||||||
BPoint(kLeftTextMargin, y + fFontInfo->fontHeight.ascent));
|
BPoint(kLeftTextMargin, y + fFontInfo->fontHeight.ascent));
|
||||||
}
|
}
|
||||||
@@ -2053,13 +2058,13 @@ SourceView::SetStackTrace(StackTrace* stackTrace, Thread* activeThread)
|
|||||||
|
|
||||||
fMarkerManager->SetStackTrace(fStackTrace);
|
fMarkerManager->SetStackTrace(fStackTrace);
|
||||||
fMarkerView->SetStackTrace(fStackTrace);
|
fMarkerView->SetStackTrace(fStackTrace);
|
||||||
fTextView->Invalidate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
SourceView::SetStackFrame(StackFrame* stackFrame)
|
SourceView::SetStackFrame(StackFrame* stackFrame)
|
||||||
{
|
{
|
||||||
|
TRACE_GUI("SourceView::SetStackFrame(%p)\n", stackFrame);
|
||||||
if (stackFrame == fStackFrame)
|
if (stackFrame == fStackFrame)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user