Merge display constructor function in One

Merge pull request !9 from idea4good/dev
This commit is contained in:
idea4good
2019-01-21 15:27:11 +08:00
parent 281237a8dd
commit b7fd946448
11 changed files with 33 additions and 59 deletions

View File

@@ -15,7 +15,11 @@ typedef enum
Z_ORDER_LEVEL_MAX
}Z_ORDER_LEVEL;
typedef struct struct_color_rect COLOR_RECT;
struct EXTERNAL_GFX_OP
{
void(*draw_pixel)(int x, int y, unsigned int rgb);
void(*fill_rect)(int x0, int y0, int x1, int y1, unsigned int rgb);
};
class c_display;
class c_surface {
@@ -43,7 +47,7 @@ protected:
virtual void fill_rect_on_fb(int x0, int y0, int x1, int y1, unsigned int rgb);
virtual void set_pixel(int x, int y, unsigned int rgb);
virtual void set_surface(void* wnd_root, Z_ORDER_LEVEL max_z_order);
c_surface(c_display* display, unsigned int width, unsigned int height, unsigned int color_bytes);
c_surface(c_display* display, unsigned int width, unsigned int height, unsigned int color_bytes, struct EXTERNAL_GFX_OP* gfx_op);
int m_width; //in pixels
int m_height; //in pixels
int m_color_bytes; //16 bits, 32 bits only
@@ -56,12 +60,13 @@ protected:
void* m_phy_fb;
int* m_phy_write_index;
c_display* m_display;
struct EXTERNAL_GFX_OP* m_gfx_op;
};
class c_surface_16bits : public c_surface {
friend class c_display;
c_surface_16bits(c_display* display, unsigned int width, unsigned int height, unsigned int color_bytes) :
c_surface(display, width, height, color_bytes) {};
c_surface_16bits(c_display* display, unsigned int width, unsigned int height, unsigned int color_bytes, struct EXTERNAL_GFX_OP* gfx_op) :
c_surface(display, width, height, color_bytes, gfx_op) {};
virtual void draw_pixel(int x, int y, unsigned int rgb, unsigned int z_order);
virtual void fill_rect(int x0, int y0, int x1, int y1, unsigned int rgb, unsigned int z_order);
virtual void fill_rect_on_fb(int x0, int y0, int x1, int y1, unsigned int rgb);
@@ -70,14 +75,11 @@ protected:
virtual void set_pixel(int x, int y, unsigned int rgb);
};
struct EXTERNAL_GFX_OP
{
void (*draw_pixel)(int x, int y, unsigned int rgb);
void (*fill_rect)(int x0, int y0, int x1, int y1, unsigned int rgb);
};
class c_surface_mcu : public c_surface {
friend class c_display;
c_surface_mcu(c_display* display, unsigned int width, unsigned int height, unsigned int color_bytes, struct EXTERNAL_GFX_OP* gfx_op);
c_surface_mcu(c_display* display, unsigned int width, unsigned int height, unsigned int color_bytes, struct EXTERNAL_GFX_OP* gfx_op) :
c_surface(display, width, height, color_bytes, gfx_op) {};
virtual void draw_pixel(int x, int y, unsigned int rgb, unsigned int z_order);
virtual void fill_rect(int x0, int y0, int x1, int y1, unsigned int rgb, unsigned int z_order);
virtual void fill_rect_on_fb(int x0, int y0, int x1, int y1, unsigned int rgb);
@@ -85,7 +87,5 @@ class c_surface_mcu : public c_surface {
protected:
virtual void set_pixel(int x, int y, unsigned int rgb);
virtual void set_surface(void* wnd_root, Z_ORDER_LEVEL max_z_order);
private:
struct EXTERNAL_GFX_OP* m_gfx_op;
};
#endif