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

Using Google Material Design colors;

* At last, fixed bug with text paint on very large scene scale. Now you can scale the scene up to 10 ns scale!
This commit is contained in:
Victor Zarubkin 2016-09-07 21:48:50 +03:00
parent 449610028a
commit 6e845eece2
8 changed files with 491 additions and 139 deletions

View File

@ -259,8 +259,8 @@ namespace profiler {
protected: protected:
int m_line; ///< Line number in the source file int m_line; ///< Line number in the source file
block_type_t m_type; ///< Type of the block (See BlockType)
color_t m_color; ///< Color of the block packed into 1-byte structure color_t m_color; ///< Color of the block packed into 1-byte structure
block_type_t m_type; ///< Type of the block (See BlockType)
BaseBlockDescriptor(int _line, block_type_t _block_type, color_t _color); BaseBlockDescriptor(int _line, block_type_t _block_type, color_t _color);
@ -269,7 +269,6 @@ namespace profiler {
inline int line() const { return m_line; } inline int line() const { return m_line; }
inline block_type_t type() const { return m_type; } inline block_type_t type() const { return m_type; }
inline color_t color() const { return m_color; } inline color_t color() const { return m_color; }
inline rgb32_t rgb() const { return ::profiler::colors::convert_to_rgb(m_color); }
}; };
class PROFILER_API BlockDescriptor final : public BaseBlockDescriptor class PROFILER_API BlockDescriptor final : public BaseBlockDescriptor

View File

@ -28,76 +28,406 @@ namespace profiler {
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
typedef uint8_t color_t; // One-byte RGB color format: RRR-GGG-BB typedef uint32_t color_t; // Standard four-byte ARGB color format
typedef uint32_t rgb32_t; // Standard four-byte RGB color format
//typedef uint8_t color_t; // One-byte RGB color format: RRR-GGG-BB
//typedef uint32_t rgb32_t; // Standard four-byte ARGB color format
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
namespace colors { namespace colors {
///< Extracts [0 .. 224] Red value from one-byte RGB format. Possible values are: [0x0, 0x20, 0x40, 0x60, 0x80, 0xa0, 0xe0]. // ///< Extracts [0 .. 224] Red value from one-byte RGB format. Possible values are: [0x0, 0x20, 0x40, 0x60, 0x80, 0xa0, 0xe0].
inline rgb32_t get_red(color_t color) { return color & 0xe0; } // inline rgb32_t get_red(color_t color) { return color & 0xe0; }
//
///< Extracts [0 .. 224] Green value from one-byte RGB format. Possible values are: [0x0, 0x20, 0x40, 0x60, 0x80, 0xa0, 0xe0]. // ///< Extracts [0 .. 224] Green value from one-byte RGB format. Possible values are: [0x0, 0x20, 0x40, 0x60, 0x80, 0xa0, 0xe0].
inline rgb32_t get_green(color_t color) { return (color & 0x1c) << 3; } // inline rgb32_t get_green(color_t color) { return (color & 0x1c) << 3; }
//
///< Extracts [0 .. 192] Blue value from one-byte RGB format. Possible values are: [0x0, 0x40, 0x80, 0xc0] // ///< Extracts [0 .. 192] Blue value from one-byte RGB format. Possible values are: [0x0, 0x40, 0x80, 0xc0]
inline rgb32_t get_blue(color_t color) { return (color & 3) << 6; } // inline rgb32_t get_blue(color_t color) { return (color & 3) << 6; }
//
//
// ///< Extracts [0 .. 255] Red value from four-byte RGB format.
// inline rgb32_t rgb_red(rgb32_t color) { return (color & 0x00ff0000) >> 16; }
//
// ///< Extracts [0 .. 255] Green value from four-byte RGB format.
// inline rgb32_t rgb_green(rgb32_t color) { return (color & 0x0000ff00) >> 8; }
//
// ///< Extracts [0 .. 255] Blue value from four-byte RGB format.
// inline rgb32_t rgb_blue(rgb32_t color) { return color & 0x000000ff; }
//
// ///< Unpacks one-byte RGB value into standard four-byte RGB value.
// inline rgb32_t convert_to_rgb(color_t color) { return (get_red(color) << 16) | ((color & 0x1c) << 11) | get_blue(color); }
//
// ///< Packs standard four-byte RGB value into one-byte RGB value. R & G values packed with 0x20 (32) step, B value is packed with 0x40 (64) step.
// inline color_t from_rgb(rgb32_t color) { return (rgb_red(color) & 0xe0) | (((color & 0x0000ff00) >> 11) & 0x1c) | (rgb_blue(color) >> 6); }
//
// ///< Packs standard four-byte RGB value into one-byte RGB value. R & G values packed with 0x20 (32) step, B value is packed with 0x40 (64) step.
// inline color_t from_rgb(color_t red, color_t green, color_t blue) { return (red & 0xe0) | ((green >> 3) & 0x1c) | (blue >> 6); }
///< Extracts [0 .. 255] Red value from four-byte RGB format. // const color_t Black = 0x00; // 0x00000000
inline rgb32_t rgb_red(rgb32_t color) { return (color & 0x00ff0000) >> 16; } // const color_t Random = Black; // Black // Currently GUI interprets Black color as permission to select random color for block
// const color_t Lightgray = 0x6E; // 0x00606080
///< Extracts [0 .. 255] Green value from four-byte RGB format. // const color_t Darkgray = 0x25; // 0x00202040
inline rgb32_t rgb_green(rgb32_t color) { return (color & 0x0000ff00) >> 8; } // const color_t White = 0xFF; // 0x00E0E0C0
// const color_t Red = 0xE0; // 0x00E00000
///< Extracts [0 .. 255] Blue value from four-byte RGB format. // const color_t Green = 0x1C; // 0x0000E000
inline rgb32_t rgb_blue(rgb32_t color) { return color & 0x000000ff; } // const color_t Blue = 0x03; // 0x000000C0
// const color_t Magenta = (Red | Blue); // 0x00E000C0
///< Unpacks one-byte RGB value into standard four-byte RGB value. // const color_t Cyan = (Green | Blue); // 0x0000E0C0
inline rgb32_t convert_to_rgb(color_t color) { return (get_red(color) << 16) | ((color & 0x1c) << 11) | get_blue(color); } // const color_t Yellow = (Red | Green); // 0x00E0E000
// const color_t Darkred = 0x60; // 0x00600000
///< Packs standard four-byte RGB value into one-byte RGB value. R & G values packed with 0x20 (32) step, B value is packed with 0x40 (64) step. // const color_t Darkgreen = 0x0C; // 0x00006000
inline color_t from_rgb(rgb32_t color) { return (rgb_red(color) & 0xe0) | (((color & 0x0000ff00) >> 11) & 0x1c) | (rgb_blue(color) >> 6); } // const color_t Darkblue = 0x01; // 0x00000040
// const color_t Darkmagenta = (Darkred | Darkblue); // 0x00600040
///< Packs standard four-byte RGB value into one-byte RGB value. R & G values packed with 0x20 (32) step, B value is packed with 0x40 (64) step. // const color_t Darkcyan = (Darkgreen | Darkblue); // 0x00006040
inline color_t from_rgb(color_t red, color_t green, color_t blue) { return (red & 0xe0) | ((green >> 3) & 0x1c) | (blue >> 6); } // const color_t Darkyellow = (Darkred | Darkgreen); // 0x00606000
// const color_t Navy = 0x02; // 0x00000080
// const color_t Teal = 0x12; // 0x00008080
// const color_t Maroon = 0x80; // 0x00800000
// const color_t Purple = 0x82; // 0x00800080
// const color_t Olive = 0x90; // 0x00808000
// const color_t Grey = 0x92; // 0x00808080
// const color_t Silver = 0xDB; // 0x00C0C0C0
// const color_t Orange = 0xF4; // 0x00E0A000
// const color_t Coral = 0xF6; // 0x00E0A080
// const color_t Brick = 0xED; // 0x00E06040
// const color_t Clay = 0xD6; // 0x00C0A080
// const color_t Skin = 0xFA; // 0x00E0C080
// const color_t Palegold = 0xFE; // 0x00E0E080
const color_t Black = 0x00; // 0x00000000
const color_t Random = Black; // Black // Currently GUI interprets Black color as permission to select random color for block // Google Material Design colors
const color_t Lightgray = 0x6E; // 0x00606080 // See https://material.google.com/style/color.html
const color_t Darkgray = 0x25; // 0x00202040
const color_t White = 0xFF; // 0x00E0E0C0 const color_t Red50 = 0xffffebee;
const color_t Red = 0xE0; // 0x00E00000 const color_t Red100 = 0xffffcdd2;
const color_t Green = 0x1C; // 0x0000E000 const color_t Red200 = 0xffef9a9a;
const color_t Blue = 0x03; // 0x000000C0 const color_t Red300 = 0xffe57373;
const color_t Magenta = (Red | Blue); // 0x00E000C0 const color_t Red400 = 0xffef5350;
const color_t Cyan = (Green | Blue); // 0x0000E0C0 const color_t Red500 = 0xfff44336;
const color_t Yellow = (Red | Green); // 0x00E0E000 const color_t Red600 = 0xffe53935;
const color_t Darkred = 0x60; // 0x00600000 const color_t Red700 = 0xffd32f2f;
const color_t Darkgreen = 0x0C; // 0x00006000 const color_t Red800 = 0xffc62828;
const color_t Darkblue = 0x01; // 0x00000040 const color_t Red900 = 0xffb71c1c;
const color_t Darkmagenta = (Darkred | Darkblue); // 0x00600040 const color_t RedA100 = 0xffff8a80;
const color_t Darkcyan = (Darkgreen | Darkblue); // 0x00006040 const color_t RedA200 = 0xffff5252;
const color_t Darkyellow = (Darkred | Darkgreen); // 0x00606000 const color_t RedA400 = 0xffff1744;
const color_t Navy = 0x02; // 0x00000080 const color_t RedA700 = 0xffd50000;
const color_t Teal = 0x12; // 0x00008080
const color_t Maroon = 0x80; // 0x00800000 const color_t Pink50 = 0xfffce4ec;
const color_t Purple = 0x82; // 0x00800080 const color_t Pink100 = 0xfff8bbd0;
const color_t Olive = 0x90; // 0x00808000 const color_t Pink200 = 0xfff48fb1;
const color_t Grey = 0x92; // 0x00808080 const color_t Pink300 = 0xfff06292;
const color_t Silver = 0xDB; // 0x00C0C0C0 const color_t Pink400 = 0xffec407a;
const color_t Orange = 0xF4; // 0x00E0A000 const color_t Pink500 = 0xffe91e63;
const color_t Coral = 0xF6; // 0x00E0A080 const color_t Pink600 = 0xffd81b60;
const color_t Brick = 0xED; // 0x00E06040 const color_t Pink700 = 0xffc2185b;
const color_t Clay = 0xD6; // 0x00C0A080 const color_t Pink800 = 0xffad1457;
const color_t Skin = 0xFA; // 0x00E0C080 const color_t Pink900 = 0xff880e4f;
const color_t Palegold = 0xFE; // 0x00E0E080 const color_t PinkA100 = 0xffff80ab;
const color_t PinkA200 = 0xffff4081;
const color_t PinkA400 = 0xfff50057;
const color_t PinkA700 = 0xffc51162;
const color_t Purple50 = 0xfff3e5f5;
const color_t Purple100 = 0xffe1bee7;
const color_t Purple200 = 0xffce93d8;
const color_t Purple300 = 0xffba68c8;
const color_t Purple400 = 0xffab47bc;
const color_t Purple500 = 0xff9c27b0;
const color_t Purple600 = 0xff8e24aa;
const color_t Purple700 = 0xff7b1fa2;
const color_t Purple800 = 0xff6a1b9a;
const color_t Purple900 = 0xff4a148c;
const color_t PurpleA100 = 0xffea80fc;
const color_t PurpleA200 = 0xffe040fb;
const color_t PurpleA400 = 0xffd500f9;
const color_t PurpleA700 = 0xffaa00ff;
const color_t DeepPurple50 = 0xffede7f6;
const color_t DeepPurple100 = 0xffd1c4e9;
const color_t DeepPurple200 = 0xffb39ddb;
const color_t DeepPurple300 = 0xff9575cd;
const color_t DeepPurple400 = 0xff7e57c2;
const color_t DeepPurple500 = 0xff673ab7;
const color_t DeepPurple600 = 0xff5e35b1;
const color_t DeepPurple700 = 0xff512da8;
const color_t DeepPurple800 = 0xff4527a0;
const color_t DeepPurple900 = 0xff311b92;
const color_t DeepPurpleA100 = 0xffb388ff;
const color_t DeepPurpleA200 = 0xff7c4dff;
const color_t DeepPurpleA400 = 0xff651fff;
const color_t DeepPurpleA700 = 0xff6200ea;
const color_t Indigo50 = 0xffe8eaf6;
const color_t Indigo100 = 0xffc5cae9;
const color_t Indigo200 = 0xff9fa8da;
const color_t Indigo300 = 0xff7986cb;
const color_t Indigo400 = 0xff5c6bc0;
const color_t Indigo500 = 0xff3f51b5;
const color_t Indigo600 = 0xff3949ab;
const color_t Indigo700 = 0xff303f9f;
const color_t Indigo800 = 0xff283593;
const color_t Indigo900 = 0xff1a237e;
const color_t IndigoA100 = 0xff8c9eff;
const color_t IndigoA200 = 0xff536dfe;
const color_t IndigoA400 = 0xff3d5afe;
const color_t IndigoA700 = 0xff304ffe;
const color_t Blue50 = 0xffe3f2fd;
const color_t Blue100 = 0xffbbdefb;
const color_t Blue200 = 0xff90caf9;
const color_t Blue300 = 0xff64b5f6;
const color_t Blue400 = 0xff42a5f5;
const color_t Blue500 = 0xff2196f3;
const color_t Blue600 = 0xff1e88e5;
const color_t Blue700 = 0xff1976d2;
const color_t Blue800 = 0xff1565c0;
const color_t Blue900 = 0xff0d47a1;
const color_t BlueA100 = 0xff82b1ff;
const color_t BlueA200 = 0xff448aff;
const color_t BlueA400 = 0xff2979ff;
const color_t BlueA700 = 0xff2962ff;
const color_t LightBlue50 = 0xffe1f5fe;
const color_t LightBlue100 = 0xffb3e5fc;
const color_t LightBlue200 = 0xff81d4fa;
const color_t LightBlue300 = 0xff4fc3f7;
const color_t LightBlue400 = 0xff29b6f6;
const color_t LightBlue500 = 0xff03a9f4;
const color_t LightBlue600 = 0xff039be5;
const color_t LightBlue700 = 0xff0288d1;
const color_t LightBlue800 = 0xff0277bd;
const color_t LightBlue900 = 0xff01579b;
const color_t LightBlueA100 = 0xff80d8ff;
const color_t LightBlueA200 = 0xff40c4ff;
const color_t LightBlueA400 = 0xff00b0ff;
const color_t LightBlueA700 = 0xff0091ea;
const color_t Cyan50 = 0xffe0f7fa;
const color_t Cyan100 = 0xffb2ebf2;
const color_t Cyan200 = 0xff80deea;
const color_t Cyan300 = 0xff4dd0e1;
const color_t Cyan400 = 0xff26c6da;
const color_t Cyan500 = 0xff00bcd4;
const color_t Cyan600 = 0xff00acc1;
const color_t Cyan700 = 0xff0097a7;
const color_t Cyan800 = 0xff00838f;
const color_t Cyan900 = 0xff006064;
const color_t CyanA100 = 0xff84ffff;
const color_t CyanA200 = 0xff18ffff;
const color_t CyanA400 = 0xff00e5ff;
const color_t CyanA700 = 0xff00b8d4;
const color_t Teal50 = 0xffe0f2f1;
const color_t Teal100 = 0xffb2dfdb;
const color_t Teal200 = 0xff80cbc4;
const color_t Teal300 = 0xff4db6ac;
const color_t Teal400 = 0xff26a69a;
const color_t Teal500 = 0xff009688;
const color_t Teal600 = 0xff00897b;
const color_t Teal700 = 0xff00796b;
const color_t Teal800 = 0xff00695c;
const color_t Teal900 = 0xff004d40;
const color_t TealA100 = 0xffa7ffeb;
const color_t TealA200 = 0xff64ffda;
const color_t TealA400 = 0xff1de9b6;
const color_t TealA700 = 0xff00bfa5;
const color_t Green50 = 0xffe8f5e9;
const color_t Green100 = 0xffc8e6c9;
const color_t Green200 = 0xffa5d6a7;
const color_t Green300 = 0xff81c784;
const color_t Green400 = 0xff66bb6a;
const color_t Green500 = 0xff4caf50;
const color_t Green600 = 0xff43a047;
const color_t Green700 = 0xff388e3c;
const color_t Green800 = 0xff2e7d32;
const color_t Green900 = 0xff1b5e20;
const color_t GreenA100 = 0xffb9f6ca;
const color_t GreenA200 = 0xff69f0ae;
const color_t GreenA400 = 0xff00e676;
const color_t GreenA700 = 0xff00c853;
const color_t LightGreen50 = 0xfff1f8e9;
const color_t LightGreen100 = 0xffdcedc8;
const color_t LightGreen200 = 0xffc5e1a5;
const color_t LightGreen300 = 0xffaed581;
const color_t LightGreen400 = 0xff9ccc65;
const color_t LightGreen500 = 0xff8bc34a;
const color_t LightGreen600 = 0xff7cb342;
const color_t LightGreen700 = 0xff689f38;
const color_t LightGreen800 = 0xff558b2f;
const color_t LightGreen900 = 0xff33691e;
const color_t LightGreenA100 = 0xffccff90;
const color_t LightGreenA200 = 0xffb2ff59;
const color_t LightGreenA400 = 0xff76ff03;
const color_t LightGreenA700 = 0xff64dd17;
const color_t Lime50 = 0xfff9ebe7;
const color_t Lime100 = 0xfff0f4c3;
const color_t Lime200 = 0xffe6ee9c;
const color_t Lime300 = 0xffdce775;
const color_t Lime400 = 0xffd4e157;
const color_t Lime500 = 0xffcddc39;
const color_t Lime600 = 0xffc0ca33;
const color_t Lime700 = 0xffafb42b;
const color_t Lime800 = 0xff9e9d24;
const color_t Lime900 = 0xff827717;
const color_t LimeA100 = 0xfff4ff81;
const color_t LimeA200 = 0xffeeff41;
const color_t LimeA400 = 0xffc6ff00;
const color_t LimeA700 = 0xffaeea00;
const color_t Yellow50 = 0xfffffde7;
const color_t Yellow100 = 0xfffff9c4;
const color_t Yellow200 = 0xfffff59d;
const color_t Yellow300 = 0xfffff176;
const color_t Yellow400 = 0xffffee58;
const color_t Yellow500 = 0xffffeb3b;
const color_t Yellow600 = 0xfffdd835;
const color_t Yellow700 = 0xfffbc02d;
const color_t Yellow800 = 0xfff9a825;
const color_t Yellow900 = 0xfff57f17;
const color_t YellowA100 = 0xffffff8d;
const color_t YellowA200 = 0xffffff00;
const color_t YellowA400 = 0xffffea00;
const color_t YellowA700 = 0xffffd600;
const color_t Amber50 = 0xfffff8e1;
const color_t Amber100 = 0xffffecb3;
const color_t Amber200 = 0xffffe082;
const color_t Amber300 = 0xffffd54f;
const color_t Amber400 = 0xffffca28;
const color_t Amber500 = 0xffffc107;
const color_t Amber600 = 0xffffb300;
const color_t Amber700 = 0xffffa000;
const color_t Amber800 = 0xffff8f00;
const color_t Amber900 = 0xffff6f00;
const color_t AmberA100 = 0xffffe57f;
const color_t AmberA200 = 0xffffd740;
const color_t AmberA400 = 0xffffc400;
const color_t AmberA700 = 0xffffab00;
const color_t Orange50 = 0xfffff3e0;
const color_t Orange100 = 0xffffe0b2;
const color_t Orange200 = 0xffffcc80;
const color_t Orange300 = 0xffffb74d;
const color_t Orange400 = 0xffffa726;
const color_t Orange500 = 0xffff9800;
const color_t Orange600 = 0xfffb8c00;
const color_t Orange700 = 0xfff57c00;
const color_t Orange800 = 0xffef6c00;
const color_t Orange900 = 0xffe65100;
const color_t OrangeA100 = 0xffffd180;
const color_t OrangeA200 = 0xffffab40;
const color_t OrangeA400 = 0xffff9100;
const color_t OrangeA700 = 0xffff6d00;
const color_t DeepOrange50 = 0xfffbe9e7;
const color_t DeepOrange100 = 0xffffccbc;
const color_t DeepOrange200 = 0xffffab91;
const color_t DeepOrange300 = 0xffff8a65;
const color_t DeepOrange400 = 0xffff7043;
const color_t DeepOrange500 = 0xffff5722;
const color_t DeepOrange600 = 0xfff4511e;
const color_t DeepOrange700 = 0xffe64a19;
const color_t DeepOrange800 = 0xffd84315;
const color_t DeepOrange900 = 0xffbf360c;
const color_t DeepOrangeA100 = 0xffff9e80;
const color_t DeepOrangeA200 = 0xffff6e40;
const color_t DeepOrangeA400 = 0xffff3d00;
const color_t DeepOrangeA700 = 0xffdd2c00;
const color_t Brown50 = 0xffefebe9;
const color_t Brown100 = 0xffd7ccc8;
const color_t Brown200 = 0xffbcaaa4;
const color_t Brown300 = 0xffa1887f;
const color_t Brown400 = 0xff8d6e63;
const color_t Brown500 = 0xff795548;
const color_t Brown600 = 0xff6d4c41;
const color_t Brown700 = 0xff5d4037;
const color_t Brown800 = 0xff4e342e;
const color_t Brown900 = 0xff3e2723;
const color_t Grey50 = 0xfffafafa;
const color_t Grey100 = 0xfff5f5f5;
const color_t Grey200 = 0xffeeeeee;
const color_t Grey300 = 0xffe0e0e0;
const color_t Grey400 = 0xffbdbdbd;
const color_t Grey500 = 0xff9e9e9e;
const color_t Grey600 = 0xff757575;
const color_t Grey700 = 0xff616161;
const color_t Grey800 = 0xff424242;
const color_t Grey900 = 0xff212121;
const color_t BlueGrey50 = 0xffeceff1;
const color_t BlueGrey100 = 0xffcfd8dc;
const color_t BlueGrey200 = 0xffb0bec5;
const color_t BlueGrey300 = 0xff90a4ae;
const color_t BlueGrey400 = 0xff78909c;
const color_t BlueGrey500 = 0xff607d8b;
const color_t BlueGrey600 = 0xff546e7a;
const color_t BlueGrey700 = 0xff455a64;
const color_t BlueGrey800 = 0xff37474f;
const color_t BlueGrey900 = 0xff263238;
const color_t Black = 0xff000000;
const color_t White = 0xffffffff;
const color_t Null = 0x00000000;
const color_t Red = Red500;
const color_t DarkRed = Red900;
const color_t RichRed = 0xffff0000;
const color_t Pink = Pink500;
const color_t Rose = PinkA100;
const color_t Purple = Purple500;
const color_t Magenta = PurpleA200;
const color_t DarkMagenta = PurpleA700;
const color_t DeepPurple = DeepPurple500;
const color_t Indigo = Indigo500;
const color_t Blue = Blue500;
const color_t DarkBlue = Blue900;
const color_t RichBlue = 0xff0000ff;
const color_t LightBlue = LightBlue500;
const color_t SkyBlue = LightBlueA100;
const color_t Navy = LightBlue800;
const color_t Cyan = Cyan500;
const color_t DarkCyan = Cyan900;
const color_t Teal = Teal500;
const color_t DarkTeal = Teal900;
const color_t Green = Green500;
const color_t DarkGreen = Green900;
const color_t RichGreen = 0xff00ff00;
const color_t LightGreen = LightGreen500;
const color_t Mint = LightGreen900;
const color_t Lime = Lime500;
const color_t Olive = Lime900;
const color_t Yellow = Yellow500;
const color_t DarkYellow = DarkRed | DarkGreen;
const color_t RichYellow = YellowA200;
const color_t Amber = Amber500;
const color_t Gold = Amber300;
const color_t PaleGold = AmberA100;
const color_t Orange = Orange500;
const color_t Skin = Orange100;
const color_t DeepOrange = DeepOrange500;
const color_t Brick = DeepOrange900;
const color_t Coral = DeepOrange200;
const color_t Brown = Brown500;
const color_t DarkBrown = Brown900;
const color_t CreamWhite = Brown50;
const color_t Grey = Grey500;
const color_t Silver = Grey300;
const color_t BlueGrey = BlueGrey500;
} // END of namespace colors. } // END of namespace colors.
const color_t DefaultBlockColor = colors::Clay; const color_t DefaultBlockColor = colors::OrangeA100;
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////

View File

@ -67,8 +67,8 @@ enum BlockItemState
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
const qreal MIN_SCALE = pow(::profiler_gui::SCALING_COEFFICIENT_INV, 70); const qreal MIN_SCALE = pow(::profiler_gui::SCALING_COEFFICIENT_INV, 70); // Up to 1000 sec scale
const qreal MAX_SCALE = pow(::profiler_gui::SCALING_COEFFICIENT, 30); // ~800 const qreal MAX_SCALE = pow(::profiler_gui::SCALING_COEFFICIENT, 45); // ~23000 --- Up to 10 ns scale
const qreal BASE_SCALE = pow(::profiler_gui::SCALING_COEFFICIENT_INV, 25); // ~0.003 const qreal BASE_SCALE = pow(::profiler_gui::SCALING_COEFFICIENT_INV, 25); // ~0.003
const unsigned short GRAPHICS_ROW_SIZE = 18; const unsigned short GRAPHICS_ROW_SIZE = 18;
@ -88,8 +88,8 @@ const unsigned int TEST_PROGRESSION_BASE = 4;
const int FLICKER_INTERVAL = 16; // 60Hz const int FLICKER_INTERVAL = 16; // 60Hz
const auto CHRONOMETER_FONT = QFont("CourierNew", 16, 2); const auto CHRONOMETER_FONT = QFont("CourierNew", 18, 2);
const auto ITEMS_FONT = QFont("CourierNew", 9);// , 2); const auto ITEMS_FONT = QFont("CourierNew", 10);// , 2);
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
@ -152,7 +152,7 @@ void EasyGraphicsItem::paint(QPainter* _painter, const QStyleOptionGraphicsItem*
QRectF rect; QRectF rect;
QBrush brush; QBrush brush;
QRgb previousColor = 0, inverseColor = 0x00ffffff; QRgb previousColor = 0, inverseColor = 0xffffffff, textColor = 0;
Qt::PenStyle previousPenStyle = Qt::NoPen; Qt::PenStyle previousPenStyle = Qt::NoPen;
brush.setStyle(Qt::SolidPattern); brush.setStyle(Qt::SolidPattern);
@ -206,12 +206,14 @@ void EasyGraphicsItem::paint(QPainter* _painter, const QStyleOptionGraphicsItem*
// (it seems there is a bug in Qt5.6 when drawText called for big coordinates, // (it seems there is a bug in Qt5.6 when drawText called for big coordinates,
// drawRect at the same time called for actually same coordinates // drawRect at the same time called for actually same coordinates
// works fine without using this additional shifting) // works fine without using this additional shifting)
auto dx = level0[m_levelsIndexes[0]].left() * currentScale; //const auto dx = level0[m_levelsIndexes[0]].left() * currentScale;
const auto dx = offset * currentScale;
// Shifting coordinates to current screen offset // Shifting coordinates to current screen offset
_painter->setTransform(QTransform::fromTranslate(dx - offset * currentScale, -y()), true); //_painter->setTransform(QTransform::fromTranslate(dx - offset * currentScale, -y()), true);
_painter->setTransform(QTransform::fromTranslate(0, -y()), true);
if (EASY_GLOBALS.draw_graphics_items_borders) if (EASY_GLOBALS.draw_graphics_items_borders)
@ -297,7 +299,8 @@ void EasyGraphicsItem::paint(QPainter* _painter, const QStyleOptionGraphicsItem*
_painter->setPen(pen); _painter->setPen(pen);
previousColor = SELECTED_ITEM_COLOR; previousColor = SELECTED_ITEM_COLOR;
inverseColor = 0x00ffffff - previousColor; inverseColor = 0xffffffff - previousColor;
textColor = ::profiler_gui::textColorForRgb(previousColor);
brush.setColor(previousColor); brush.setColor(previousColor);
_painter->setBrush(brush); _painter->setBrush(brush);
} }
@ -308,7 +311,8 @@ void EasyGraphicsItem::paint(QPainter* _painter, const QStyleOptionGraphicsItem*
{ {
// Set background color brush for rectangle // Set background color brush for rectangle
previousColor = item.color; previousColor = item.color;
inverseColor = 0x00ffffff - previousColor; inverseColor = 0xffffffff - previousColor;
textColor = ::profiler_gui::textColorForRgb(previousColor);
brush.setColor(previousColor); brush.setColor(previousColor);
_painter->setBrush(brush); _painter->setBrush(brush);
} }
@ -390,7 +394,8 @@ void EasyGraphicsItem::paint(QPainter* _painter, const QStyleOptionGraphicsItem*
_painter->setPen(pen); _painter->setPen(pen);
previousColor = SELECTED_ITEM_COLOR; previousColor = SELECTED_ITEM_COLOR;
inverseColor = 0x00ffffff - previousColor; inverseColor = 0xffffffff - previousColor;
textColor = ::profiler_gui::textColorForRgb(previousColor);
brush.setColor(previousColor); brush.setColor(previousColor);
_painter->setBrush(brush); _painter->setBrush(brush);
} }
@ -401,7 +406,8 @@ void EasyGraphicsItem::paint(QPainter* _painter, const QStyleOptionGraphicsItem*
{ {
// Set background color brush for rectangle // Set background color brush for rectangle
previousColor = item.color; previousColor = item.color;
inverseColor = 0x00ffffff - previousColor; inverseColor = 0xffffffff - previousColor;
textColor = ::profiler_gui::textColorForRgb(previousColor);
brush.setColor(previousColor); brush.setColor(previousColor);
_painter->setBrush(brush); _painter->setBrush(brush);
} }
@ -449,9 +455,9 @@ void EasyGraphicsItem::paint(QPainter* _painter, const QStyleOptionGraphicsItem*
rect.setRect(xtext + 1, top, w - 1, h); rect.setRect(xtext + 1, top, w - 1, h);
// text will be painted with inverse color // text will be painted with inverse color
auto textColor = inverseColor; //auto textColor = inverseColor < 0x00808080 ? profiler::colors::Black : profiler::colors::White;
if (textColor == previousColor) textColor = 0; //if (textColor == previousColor) textColor = 0;
_painter->setPen(textColor); _painter->setPen(QColor::fromRgb(textColor));
// drawing text // drawing text
auto name = *itemBlock.tree.node->name() != 0 ? itemBlock.tree.node->name() : easyDescriptor(itemBlock.tree.node->id()).name(); auto name = *itemBlock.tree.node->name() != 0 ? itemBlock.tree.node->name() : easyDescriptor(itemBlock.tree.node->id()).name();
@ -474,6 +480,15 @@ void EasyGraphicsItem::paint(QPainter* _painter, const QStyleOptionGraphicsItem*
const auto& item = m_levels[guiblock.graphics_item_level][guiblock.graphics_item_index]; const auto& item = m_levels[guiblock.graphics_item_level][guiblock.graphics_item_index];
if (item.left() < sceneRight && item.right() > sceneLeft) if (item.left() < sceneRight && item.right() > sceneLeft)
{ {
auto top = levelY(guiblock.graphics_item_level);
decltype(top) h = item.totalHeight;
auto dh = top + h - visibleBottom;
if (dh < h)
{
if (dh > 0)
h -= dh;
QPen pen(Qt::SolidLine); QPen pen(Qt::SolidLine);
pen.setColor(Qt::red); pen.setColor(Qt::red);
pen.setWidth(2); pen.setWidth(2);
@ -482,10 +497,9 @@ void EasyGraphicsItem::paint(QPainter* _painter, const QStyleOptionGraphicsItem*
brush.setColor(SELECTED_ITEM_COLOR); brush.setColor(SELECTED_ITEM_COLOR);
_painter->setBrush(brush); _painter->setBrush(brush);
auto top = levelY(guiblock.graphics_item_level);
auto x = item.left() * currentScale - dx; auto x = item.left() * currentScale - dx;
auto w = ::std::max(item.width() * currentScale, 1.0); auto w = ::std::max(item.width() * currentScale, 1.0);
rect.setRect(x, top, w, item.totalHeight); rect.setRect(x, top, w, h);
_painter->drawRect(rect); _painter->drawRect(rect);
if (w > 20) if (w > 20)
@ -506,11 +520,12 @@ void EasyGraphicsItem::paint(QPainter* _painter, const QStyleOptionGraphicsItem*
w -= (item.right() - sceneRight) * currentScale; w -= (item.right() - sceneRight) * currentScale;
} }
rect.setRect(xtext + 1, top, w - 1, item.totalHeight); rect.setRect(xtext + 1, top, w - 1, h);
// text will be painted with inverse color // text will be painted with inverse color
auto textColor = 0x00ffffff - previousColor; //auto textColor = 0x00ffffff - previousColor;
if (textColor == previousColor) textColor = 0; //if (textColor == previousColor) textColor = 0;
textColor = ::profiler_gui::textColorForRgb(SELECTED_ITEM_COLOR);
_painter->setPen(textColor); _painter->setPen(textColor);
// drawing text // drawing text
@ -522,12 +537,13 @@ void EasyGraphicsItem::paint(QPainter* _painter, const QStyleOptionGraphicsItem*
} }
} }
} }
}
#ifdef EASY_STORE_CSWITCH_SEPARATELY #ifdef EASY_STORE_CSWITCH_SEPARATELY
if (!m_pRoot->sync.empty()) if (!m_pRoot->sync.empty())
{ {
_painter->setBrush(QColor::fromRgba(0xfff08040)); _painter->setBrush(QColor::fromRgba(0xfffe6030));
_painter->setPen(QColor::fromRgb(0x00505050)); _painter->setPen(QColor::fromRgb(0x00505050));
qreal prevRight = -1e100, top = y() - 4, h = 3; qreal prevRight = -1e100, top = y() - 4, h = 3;
@ -923,8 +939,8 @@ void EasyChronometerItem::paint(QPainter* _painter, const QStyleOptionGraphicsIt
auto vcenter = rect.top() + rect.height() * 0.5; auto vcenter = rect.top() + rect.height() * 0.5;
QLinearGradient g(rect.left(), vcenter, rect.right(), vcenter); QLinearGradient g(rect.left(), vcenter, rect.right(), vcenter);
g.setColorAt(0, m_color); g.setColorAt(0, m_color);
g.setColorAt(0.15, QColor::fromRgba(0x10000000 | rgb)); g.setColorAt(0.25, QColor::fromRgba(0x20000000 | rgb));
g.setColorAt(0.85, QColor::fromRgba(0x10000000 | rgb)); g.setColorAt(0.75, QColor::fromRgba(0x20000000 | rgb));
g.setColorAt(1, m_color); g.setColorAt(1, m_color);
_painter->setBrush(g); _painter->setBrush(g);
_painter->setPen(Qt::NoPen); _painter->setPen(Qt::NoPen);
@ -940,7 +956,8 @@ void EasyChronometerItem::paint(QPainter* _painter, const QStyleOptionGraphicsIt
// draw text // draw text
_painter->setCompositionMode(QPainter::CompositionMode_Difference); // This lets the text to be visible on every background _painter->setCompositionMode(QPainter::CompositionMode_Difference); // This lets the text to be visible on every background
_painter->setPen(0xffffffff - rgb); _painter->setRenderHint(QPainter::TextAntialiasing);
_painter->setPen(0x00ffffff - rgb);
_painter->setFont(CHRONOMETER_FONT); _painter->setFont(CHRONOMETER_FONT);
int textFlags = 0; int textFlags = 0;
@ -1173,13 +1190,10 @@ void EasyTimelineIndicatorItem::paint(QPainter* _painter, const QStyleOptionGrap
// Draw scale indicator // Draw scale indicator
_painter->save(); _painter->save();
_painter->setTransform(QTransform::fromTranslate(-x(), -y())); _painter->setTransform(QTransform::fromTranslate(-x(), -y()));
_painter->setCompositionMode(QPainter::CompositionMode_Difference); //_painter->setCompositionMode(QPainter::CompositionMode_Difference);
_painter->setBrush(Qt::NoBrush); _painter->setBrush(Qt::NoBrush);
//_painter->setBrush(Qt::white); QPen pen(Qt::black);
//_painter->setPen(Qt::NoPen);
QPen pen(Qt::white);
pen.setWidth(2); pen.setWidth(2);
pen.setJoinStyle(Qt::MiterJoin); pen.setJoinStyle(Qt::MiterJoin);
_painter->setPen(pen); _painter->setPen(pen);
@ -1188,7 +1202,6 @@ void EasyTimelineIndicatorItem::paint(QPainter* _painter, const QStyleOptionGrap
const auto rect_right = rect.right(); const auto rect_right = rect.right();
const QPointF points[] = {{rect.left(), rect.bottom()}, {rect.left(), rect.top()}, {rect_right, rect.top()}, {rect_right, rect.top() + 5}}; const QPointF points[] = {{rect.left(), rect.bottom()}, {rect.left(), rect.top()}, {rect_right, rect.top()}, {rect_right, rect.top() + 5}};
_painter->drawPolyline(points, sizeof(points) / sizeof(QPointF)); _painter->drawPolyline(points, sizeof(points) / sizeof(QPointF));
//_painter->drawRect(rect);
rect.translate(0, 3); rect.translate(0, 3);
_painter->drawText(rect, Qt::AlignRight | Qt::TextDontClip, text); _painter->drawText(rect, Qt::AlignRight | Qt::TextDontClip, text);
@ -1443,6 +1456,7 @@ void EasyGraphicsView::setTree(const ::profiler::thread_blocks_tree_t& _blocksTr
::profiler::timestamp_t finish = 0; ::profiler::timestamp_t finish = 0;
::profiler::thread_id_t longestTree = 0; ::profiler::thread_id_t longestTree = 0;
const EasyGraphicsItem* longestItem = nullptr; const EasyGraphicsItem* longestItem = nullptr;
const EasyGraphicsItem* mainThreadItem = nullptr;
for (const auto& threadTree : _blocksTree) for (const auto& threadTree : _blocksTree)
{ {
const auto& tree = threadTree.second.children; const auto& tree = threadTree.second.children;
@ -1494,9 +1508,10 @@ void EasyGraphicsView::setTree(const ::profiler::thread_blocks_tree_t& _blocksTr
y += h + THREADS_ROW_SPACING; y += h + THREADS_ROW_SPACING;
if (longestTree == threadTree.first) if (longestTree == threadTree.first)
{
longestItem = item; longestItem = item;
}
if (mainThreadItem == nullptr && !strcmp(threadTree.second.thread_name, "Main"))
mainThreadItem = item;
} }
// Calculating scene rect // Calculating scene rect
@ -1509,6 +1524,9 @@ void EasyGraphicsView::setTree(const ::profiler::thread_blocks_tree_t& _blocksTr
updateVisibleSceneRect(); updateVisibleSceneRect();
setScrollbar(m_pScrollbar); setScrollbar(m_pScrollbar);
if (mainThreadItem != nullptr)
longestItem = mainThreadItem;
if (longestItem != nullptr) if (longestItem != nullptr)
{ {
m_pScrollbar->setMinimapFrom(longestItem->threadId(), longestItem->items(0)); m_pScrollbar->setMinimapFrom(longestItem->threadId(), longestItem->items(0));
@ -1618,9 +1636,8 @@ qreal EasyGraphicsView::setTree(EasyGraphicsItem* _item, const ::profiler::Block
maxh = h; maxh = h;
} }
const auto color = EASY_GLOBALS.descriptors[child.node->id()]->color();
b.block = child_index;// &child; b.block = child_index;// &child;
b.color = ::profiler_gui::fromProfilerRgb(::profiler::colors::get_red(color), ::profiler::colors::get_green(color), ::profiler::colors::get_blue(color)); b.color = EASY_GLOBALS.descriptors[child.node->id()]->color();// ::profiler_gui::fromProfilerRgb(::profiler::colors::get_red(color), ::profiler::colors::get_green(color), ::profiler::colors::get_blue(color));
b.setPos(xbegin, duration); b.setPos(xbegin, duration);
b.totalHeight = GRAPHICS_ROW_SIZE + h; b.totalHeight = GRAPHICS_ROW_SIZE + h;
b.state = BLOCK_ITEM_UNCHANGED; b.state = BLOCK_ITEM_UNCHANGED;

View File

@ -101,7 +101,7 @@ struct do_no_hash {
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
const QRgb DEFAULT_COLOR = 0x00d4b494;//0x00f0e094; const QRgb DEFAULT_COLOR = profiler::DefaultBlockColor;// 0x00d4b494;
inline QRgb toRgb(unsigned int _red, unsigned int _green, unsigned int _blue) inline QRgb toRgb(unsigned int _red, unsigned int _green, unsigned int _blue)
{ {
@ -115,6 +115,12 @@ inline QRgb fromProfilerRgb(unsigned int _red, unsigned int _green, unsigned int
return toRgb(_red, _green, _blue) | 0x00141414; return toRgb(_red, _green, _blue) | 0x00141414;
} }
inline QRgb textColorForRgb(QRgb _color)
{
const QRgb sum = 0xff - ((_color & 0xff000000) >> 24) + ((_color & 0x00ff0000) >> 16) + ((_color & 0x0000ff00) >> 8) + (_color & 0x000000ff);
return sum > 0x215 ? ::profiler::colors::Black : ::profiler::colors::White;
}
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
#pragma pack(push, 1) #pragma pack(push, 1)

View File

@ -354,9 +354,9 @@ void FillTreeClass<T>::setTreeInternal2(T& _safelocker, Items& _items, ThreadedI
} }
const auto color = easyDescriptor(gui_block.tree.node->id()).color(); const auto color = easyDescriptor(gui_block.tree.node->id()).color();
const auto bgColor = ::profiler_gui::fromProfilerRgb(::profiler::colors::get_red(color), ::profiler::colors::get_green(color), ::profiler::colors::get_blue(color)); //const auto bgColor = ::profiler_gui::fromProfilerRgb(::profiler::colors::get_red(color), ::profiler::colors::get_green(color), ::profiler::colors::get_blue(color));
const auto fgColor = 0x00ffffff - bgColor; const auto fgColor = ::profiler_gui::textColorForRgb(color);//0x00ffffff - bgColor;
item->setBackgroundColor(bgColor); item->setBackgroundColor(color);
item->setTextColor(fgColor); item->setTextColor(fgColor);
auto item_index = static_cast<unsigned int>(_items.size()); auto item_index = static_cast<unsigned int>(_items.size());
@ -549,9 +549,9 @@ size_t FillTreeClass<T>::setTreeInternal(T& _safelocker, Items& _items, const ::
} }
const auto color = easyDescriptor(child.node->id()).color(); const auto color = easyDescriptor(child.node->id()).color();
const auto bgColor = ::profiler_gui::fromProfilerRgb(::profiler::colors::get_red(color), ::profiler::colors::get_green(color), ::profiler::colors::get_blue(color)); //const auto bgColor = ::profiler_gui::fromProfilerRgb(::profiler::colors::get_red(color), ::profiler::colors::get_green(color), ::profiler::colors::get_blue(color));
const auto fgColor = 0x00ffffff - bgColor; const auto fgColor = ::profiler_gui::textColorForRgb(color);// 0x00ffffff - bgColor;
item->setBackgroundColor(bgColor); item->setBackgroundColor(color);
item->setTextColor(fgColor); item->setTextColor(fgColor);
auto item_index = static_cast<uint32_t>(_items.size()); auto item_index = static_cast<uint32_t>(_items.size());

View File

@ -26,7 +26,7 @@ void localSleep(int magic=200000)
} }
void loadingResources(){ void loadingResources(){
EASY_FUNCTION(profiler::colors::Darkcyan); EASY_FUNCTION(profiler::colors::DarkCyan);
localSleep(); localSleep();
// std::this_thread::sleep_for(std::chrono::milliseconds(50)); // std::this_thread::sleep_for(std::chrono::milliseconds(50));
} }
@ -85,7 +85,7 @@ void calcBrain(){
} }
void calculateBehavior(){ void calculateBehavior(){
EASY_FUNCTION(profiler::colors::Darkblue); EASY_FUNCTION(profiler::colors::DarkBlue);
calcPhys(); calcPhys();
calcBrain(); calcBrain();
} }
@ -97,7 +97,7 @@ void modellingStep(){
} }
void prepareRender(){ void prepareRender(){
EASY_FUNCTION(profiler::colors::Darkred); EASY_FUNCTION(profiler::colors::DarkRed);
localSleep(); localSleep();
//std::this_thread::sleep_for(std::chrono::milliseconds(8)); //std::this_thread::sleep_for(std::chrono::milliseconds(8));

View File

@ -407,7 +407,7 @@ const char* ProfileManager::setThreadName(const char* name, const char* filename
if (!THREAD_STORAGE->named) if (!THREAD_STORAGE->named)
{ {
const auto id = addBlockDescriptor(_funcname, filename, line, profiler::BLOCK_TYPE_THREAD_SIGN, profiler::colors::Random); const auto id = addBlockDescriptor(_funcname, filename, line, profiler::BLOCK_TYPE_THREAD_SIGN, profiler::colors::Black);
THREAD_STORAGE->storeBlock(profiler::Block(profiler::BLOCK_TYPE_THREAD_SIGN, id, name)); THREAD_STORAGE->storeBlock(profiler::Block(profiler::BLOCK_TYPE_THREAD_SIGN, id, name));
THREAD_STORAGE->name = name; THREAD_STORAGE->name = name;
THREAD_STORAGE->named = true; THREAD_STORAGE->named = true;

View File

@ -340,7 +340,7 @@ extern "C" ::profiler::block_index_t fillTreesFromFile(::std::atomic<int>& progr
blocks.reserve(total_blocks_number); blocks.reserve(total_blocks_number);
while (!inFile.eof() && read_number < total_blocks_number) while (!inFile.eof() && read_number < total_blocks_number)
{ {
EASY_BLOCK("Read thread data", ::profiler::colors::Darkgreen); EASY_BLOCK("Read thread data", ::profiler::colors::DarkGreen);
::profiler::thread_id_t thread_id = 0; ::profiler::thread_id_t thread_id = 0;
inFile.read((char*)&thread_id, sizeof(decltype(thread_id))); inFile.read((char*)&thread_id, sizeof(decltype(thread_id)));