0
0
mirror of https://github.com/yse/easy_profiler.git synced 2024-12-28 01:04:41 +08:00

Minor refactoring

This commit is contained in:
Victor Zarubkin 2016-10-02 12:33:08 +03:00
parent dc01c49020
commit 4eef4daf30
3 changed files with 8 additions and 8 deletions

View File

@ -150,18 +150,17 @@ inline ::profiler::color_t textColorForRgb(::profiler::color_t _color)
#pragma pack(push, 1)
struct EasyBlockItem Q_DECL_FINAL
{
//const ::profiler::BlocksTree* block; ///< Pointer to profiler block
qreal x; ///< x coordinate of the item (this is made qreal=double to avoid mistakes on very wide scene)
float w; ///< Width of the item
::profiler::block_index_t block; ///< Index of profiler block
uint32_t children_begin; ///< Index of first child item on the next sublevel
uint16_t totalHeight; ///< Total height of the item including heights of all it's children
char state; ///< 0 = no change, 1 = paint, -1 = do not paint
int8_t state; ///< 0 = no change, 1 = paint, -1 = do not paint
// Possible optimizations:
// 1) We can save 1 more byte per block if we will use char instead of short + real time calculations for "totalHeight" var;
// 2) We can save 12 bytes per block if "x" and "w" vars will be removed (all this information exist inside BlocksTree),
// but this will make impossible to run graphics test without loading any .prof file.
// but this requires runtime x-coodinate calculation because BlocksTree has x value in nanoseconds.
inline void setPos(qreal _x, float _w) { x = _x; w = _w; }
inline qreal left() const { return x; }

View File

@ -38,7 +38,7 @@
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
enum BlockItemState
enum BlockItemState : int8_t
{
BLOCK_ITEM_DO_NOT_PAINT = -1,
BLOCK_ITEM_UNCHANGED,
@ -47,8 +47,9 @@ enum BlockItemState
//////////////////////////////////////////////////////////////////////////
const int MIN_ITEM_WIDTH = 2;
const int MIN_ITEMS_SPACING = 2;
const int MIN_ITEM_WIDTH = 3;
const int MIN_ITEMS_SPACING = 3;
const int MIN_SYNC_SPACING = 1;
const int NARROW_ITEM_WIDTH = 20;
const QRgb BORDERS_COLOR = ::profiler::colors::Grey700 & 0x00ffffff;// 0x00686868;
@ -537,7 +538,7 @@ void EasyGraphicsItem::paint(QPainter* _painter, const QStyleOptionGraphicsItem*
rect.setRect(left, top, width, h);
_painter->drawRect(rect);
prevRight = left + width + MIN_ITEMS_SPACING;
prevRight = left + width + MIN_SYNC_SPACING;
}
}
}

View File

@ -51,7 +51,7 @@ namespace profiler_gui {
, enable_event_indicators(true)
, enable_statistics(true)
, draw_graphics_items_borders(true)
, hide_narrow_children(false)
, hide_narrow_children(true)
, display_only_relevant_stats(true)
, collapse_items_on_tree_close(false)
, all_items_expanded_by_default(true)