From b129d474d07a3e845081f8eeb81ab6ddf811e52d Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 2 Jul 2019 12:22:46 +0200 Subject: [PATCH] cc_item_progressbar.cpp/h: move CProgressBarCache class into header file Allows usage from other classes --- src/gui/components/cc_item_progressbar.cpp | 61 -------------------- src/gui/components/cc_item_progressbar.h | 65 ++++++++++++++++++++++ 2 files changed, 65 insertions(+), 61 deletions(-) diff --git a/src/gui/components/cc_item_progressbar.cpp b/src/gui/components/cc_item_progressbar.cpp index 290dcff4d..5b94608ed 100644 --- a/src/gui/components/cc_item_progressbar.cpp +++ b/src/gui/components/cc_item_progressbar.cpp @@ -127,69 +127,8 @@ void CProgressBar::initDimensions() col_frame = pb_active_col; } -class CProgressBarCache; -static std::vector pbCache; -class CProgressBarCache -{ - private: - // keys to lookup: - int pbc_height, pbc_width; - int pbc_active_col, pbc_passive_col; - int pbc_design; - bool pbc_invert, pbc_gradient; - int pbc_red, pbc_green, pbc_yellow; - int yoff; - fb_pixel_t *pbc_active, *pbc_passive; - ; - - static inline unsigned int make16color(__u32 rgb){return 0xFF000000 | rgb;}; - - void pbcPaintBoxRel(int x, int y, int dx, int dy, fb_pixel_t *pixbuf, fb_pixel_t col) const; - void pbcApplyGradient(fb_pixel_t *pixbuf); - void pbcCreateBitmaps(); - - CProgressBarCache( int dy, - int dx, - int active_col, - int passive_col, - int design, - bool enable_invert, - bool enable_gradient, - int R, - int G, - int Y) - : pbc_height(dy), - pbc_width(dx), - pbc_active_col(active_col), - pbc_passive_col(passive_col), - pbc_design(design), - pbc_invert(enable_invert), - pbc_gradient(enable_gradient), - pbc_red(R), - pbc_green(G), - pbc_yellow(Y), - yoff(0) - { - if (pbCache.size() > 10) - pbcClear(); - pbcCreateBitmaps(); - } - void pbcClear(); - public: - void pbcPaint(int x, int y, int pbc_active_width, int pbc_passive_width) const; - static CProgressBarCache *pbcLookup( int dy, - int dx, - int active_col, - int passive_col, - int design, - bool enable_invert, - bool enable_gradient, - int R, - int G, - int Y); -}; void CProgressBarCache::pbcClear() { diff --git a/src/gui/components/cc_item_progressbar.h b/src/gui/components/cc_item_progressbar.h index 610402687..dbc5644cd 100644 --- a/src/gui/components/cc_item_progressbar.h +++ b/src/gui/components/cc_item_progressbar.h @@ -53,6 +53,71 @@ #include "cc_item.h" #include +class CProgressBarCache; +static std::vector pbCache; + +class CProgressBarCache +{ + public: + void pbcPaint(int x, int y, int pbc_active_width, int pbc_passive_width) const; + static void pbcClear(); + static CProgressBarCache *pbcLookup( int dy, + int dx, + int active_col, + int passive_col, + int design, + bool enable_invert, + bool enable_gradient, + int R, + int G, + int Y); + private: + // keys to lookup: + int pbc_height, pbc_width; + int pbc_active_col, pbc_passive_col; + int pbc_design; + bool pbc_invert, pbc_gradient; + int pbc_red, pbc_green, pbc_yellow; + int yoff; + + fb_pixel_t *pbc_active, *pbc_passive; + ; + + static inline unsigned int make16color(__u32 rgb){return 0xFF000000 | rgb;}; + + void pbcPaintBoxRel(int x, int y, int dx, int dy, fb_pixel_t *pixbuf, fb_pixel_t col) const; + void pbcApplyGradient(fb_pixel_t *pixbuf); + void pbcCreateBitmaps(); + + CProgressBarCache( int dy, + int dx, + int active_col, + int passive_col, + int design, + bool enable_invert, + bool enable_gradient, + int R, + int G, + int Y) + : pbc_height(dy), + pbc_width(dx), + pbc_active_col(active_col), + pbc_passive_col(passive_col), + pbc_design(design), + pbc_invert(enable_invert), + pbc_gradient(enable_gradient), + pbc_red(R), + pbc_green(G), + pbc_yellow(Y), + yoff(0) + { + if (pbCache.size() > 10) + pbcClear(); + pbcCreateBitmaps(); + } + +}; + class CProgressBar : public CComponentsItem { private: