cc_item_progressbar.cpp/h: move CProgressBarCache class into header file

Allows usage from other classes
This commit is contained in:
2019-07-02 12:22:46 +02:00
parent 4f071d99b9
commit b129d474d0
2 changed files with 65 additions and 61 deletions

View File

@@ -127,69 +127,8 @@ void CProgressBar::initDimensions()
col_frame = pb_active_col;
}
class CProgressBarCache;
static std::vector<CProgressBarCache *> 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()
{

View File

@@ -53,6 +53,71 @@
#include "cc_item.h"
#include <string>
class CProgressBarCache;
static std::vector<CProgressBarCache *> 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: