From 4eef4daf30943e0f9e9964631ac4935709eb27e3 Mon Sep 17 00:00:00 2001 From: Victor Zarubkin Date: Sun, 2 Oct 2016 12:33:08 +0300 Subject: [PATCH] Minor refactoring --- profiler_gui/common_types.h | 5 ++--- profiler_gui/easy_graphics_item.cpp | 9 +++++---- profiler_gui/globals.cpp | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/profiler_gui/common_types.h b/profiler_gui/common_types.h index 80ce6a2..a08b777 100644 --- a/profiler_gui/common_types.h +++ b/profiler_gui/common_types.h @@ -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; } diff --git a/profiler_gui/easy_graphics_item.cpp b/profiler_gui/easy_graphics_item.cpp index 366fdbc..71128a1 100644 --- a/profiler_gui/easy_graphics_item.cpp +++ b/profiler_gui/easy_graphics_item.cpp @@ -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; } } } diff --git a/profiler_gui/globals.cpp b/profiler_gui/globals.cpp index 635cf13..a660d27 100644 --- a/profiler_gui/globals.cpp +++ b/profiler_gui/globals.cpp @@ -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)