Skip to content
Snippets Groups Projects
Commit d329f6a9 authored by andreykproductengine's avatar andreykproductengine
Browse files

SL-10828 [Dev tools] Fix Fast Timers' visibility

parent 5966831b
No related branches found
No related tags found
No related merge requests found
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#include "llsdserialize.h" #include "llsdserialize.h"
#include "lltooltip.h" #include "lltooltip.h"
#include "llbutton.h" #include "llbutton.h"
#include "llscrollbar.h"
#include "llappviewer.h" #include "llappviewer.h"
#include "llviewertexturelist.h" #include "llviewertexturelist.h"
...@@ -128,7 +129,8 @@ void LLFastTimerView::setPauseState(bool pause_state) ...@@ -128,7 +129,8 @@ void LLFastTimerView::setPauseState(bool pause_state)
BOOL LLFastTimerView::postBuild() BOOL LLFastTimerView::postBuild()
{ {
LLButton& pause_btn = getChildRef<LLButton>("pause_btn"); LLButton& pause_btn = getChildRef<LLButton>("pause_btn");
mScrollBar = getChild<LLScrollbar>("scroll_vert");
pause_btn.setCommitCallback(boost::bind(&LLFastTimerView::onPause, this)); pause_btn.setCommitCallback(boost::bind(&LLFastTimerView::onPause, this));
return TRUE; return TRUE;
} }
...@@ -183,7 +185,7 @@ BOOL LLFastTimerView::handleDoubleClick(S32 x, S32 y, MASK mask) ...@@ -183,7 +185,7 @@ BOOL LLFastTimerView::handleDoubleClick(S32 x, S32 y, MASK mask)
BOOL LLFastTimerView::handleMouseDown(S32 x, S32 y, MASK mask) BOOL LLFastTimerView::handleMouseDown(S32 x, S32 y, MASK mask)
{ {
if (x < mBarRect.mLeft) if (x < mScrollBar->getRect().mLeft)
{ {
BlockTimerStatHandle* idp = getLegendID(y); BlockTimerStatHandle* idp = getLegendID(y);
if (idp) if (idp)
...@@ -284,7 +286,7 @@ BOOL LLFastTimerView::handleHover(S32 x, S32 y, MASK mask) ...@@ -284,7 +286,7 @@ BOOL LLFastTimerView::handleHover(S32 x, S32 y, MASK mask)
} }
} }
} }
else if (x < mBarRect.mLeft) else if (x < mScrollBar->getRect().mLeft)
{ {
BlockTimerStatHandle* timer_id = getLegendID(y); BlockTimerStatHandle* timer_id = getLegendID(y);
if (timer_id) if (timer_id)
...@@ -335,7 +337,7 @@ BOOL LLFastTimerView::handleToolTip(S32 x, S32 y, MASK mask) ...@@ -335,7 +337,7 @@ BOOL LLFastTimerView::handleToolTip(S32 x, S32 y, MASK mask)
else else
{ {
// tooltips for timer legend // tooltips for timer legend
if (x < mBarRect.mLeft) if (x < mScrollBar->getRect().mLeft)
{ {
BlockTimerStatHandle* idp = getLegendID(y); BlockTimerStatHandle* idp = getLegendID(y);
if (idp) if (idp)
...@@ -1197,6 +1199,7 @@ void LLFastTimerView::drawLegend() ...@@ -1197,6 +1199,7 @@ void LLFastTimerView::drawLegend()
{ {
LLLocalClipRect clip(mLegendRect); LLLocalClipRect clip(mLegendRect);
S32 cur_line = 0; S32 cur_line = 0;
S32 scroll_offset = 0; // element's y offset from top of the inner scroll's rect
ft_display_idx.clear(); ft_display_idx.clear();
std::map<BlockTimerStatHandle*, S32> display_line; std::map<BlockTimerStatHandle*, S32> display_line;
for (block_timer_tree_df_iterator_t it = LLTrace::begin_block_timer_tree_df(FTM_FRAME); for (block_timer_tree_df_iterator_t it = LLTrace::begin_block_timer_tree_df(FTM_FRAME);
...@@ -1204,10 +1207,24 @@ void LLFastTimerView::drawLegend() ...@@ -1204,10 +1207,24 @@ void LLFastTimerView::drawLegend()
++it) ++it)
{ {
BlockTimerStatHandle* idp = (*it); BlockTimerStatHandle* idp = (*it);
// Needed to figure out offsets and parenting
display_line[idp] = cur_line; display_line[idp] = cur_line;
ft_display_idx.push_back(idp);
cur_line++; cur_line++;
if (scroll_offset < mScrollBar->getDocPos())
{
// only offset for visible items
scroll_offset += TEXT_HEIGHT + 2;
if (idp->getTreeNode().mCollapsed)
{
it.skipDescendants();
}
continue;
}
// used for mouse clicks
ft_display_idx.push_back(idp);
// Actual draw, first bar (square), then text
x = MARGIN; x = MARGIN;
LLRect bar_rect(x, y, x + TEXT_HEIGHT, y - TEXT_HEIGHT); LLRect bar_rect(x, y, x + TEXT_HEIGHT, y - TEXT_HEIGHT);
...@@ -1281,11 +1298,14 @@ void LLFastTimerView::drawLegend() ...@@ -1281,11 +1298,14 @@ void LLFastTimerView::drawLegend()
y -= (TEXT_HEIGHT + 2); y -= (TEXT_HEIGHT + 2);
scroll_offset += TEXT_HEIGHT + 2;
if (idp->getTreeNode().mCollapsed) if (idp->getTreeNode().mCollapsed)
{ {
it.skipDescendants(); it.skipDescendants();
} }
} }
// Recalculate scroll size
mScrollBar->setDocSize(scroll_offset - mLegendRect.getHeight());
} }
} }
......
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
#include "lltracerecording.h" #include "lltracerecording.h"
#include <deque> #include <deque>
class LLScrollbar;
class LLFastTimerView : public LLFloater class LLFastTimerView : public LLFloater
{ {
public: public:
...@@ -142,6 +144,8 @@ class LLFastTimerView : public LLFloater ...@@ -142,6 +144,8 @@ class LLFastTimerView : public LLFloater
mLegendRect; mLegendRect;
LLFrameTimer mHighlightTimer; LLFrameTimer mHighlightTimer;
LLTrace::PeriodicRecording mRecording; LLTrace::PeriodicRecording mRecording;
LLScrollbar* mScrollBar;
}; };
#endif #endif
...@@ -60,10 +60,21 @@ ...@@ -60,10 +60,21 @@
min_width="100"> min_width="100">
<panel top="0" <panel top="0"
left="0" left="0"
width="220" width="204"
height="440" height="440"
name="legend" name="legend"
follows="all"/> follows="all"/>
<scroll_bar
top ="0"
right="-1"
height="440"
width="15"
follows="top|right|bottom"
name="scroll_vert"
orientation="vertical"
step_size="16"
doc_size="3000"
/>
</layout_panel> </layout_panel>
<layout_panel name="timers_panel" <layout_panel name="timers_panel"
auto_resize="true" auto_resize="true"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment