fix display init bug, update readme

This commit is contained in:
idea4good 2020-05-23 00:29:24 +08:00
parent 06a68e056a
commit 841c283e17
4 changed files with 21 additions and 4 deletions

View File

@ -415,7 +415,7 @@ public:
} }
int snap_shot(const char* file_name) int snap_shot(const char* file_name)
{ {
if (!m_phy_fb) if (!m_phy_fb || (m_color_bytes !=2 && m_color_bytes != 4))
{ {
return -1; return -1;
} }
@ -912,6 +912,7 @@ inline c_display::c_display(void* phy_fb, int display_width, int display_height,
} }
inline c_display::c_display(void* phy_fb, int display_width, int display_height, c_surface* surface) : m_width(display_width), m_height(display_height), m_phy_fb(phy_fb), m_phy_read_index(0), m_phy_write_index(0), m_surface_cnt(1), m_surface_index(0) inline c_display::c_display(void* phy_fb, int display_width, int display_height, c_surface* surface) : m_width(display_width), m_height(display_height), m_phy_fb(phy_fb), m_phy_read_index(0), m_phy_write_index(0), m_surface_cnt(1), m_surface_index(0)
{ {
m_color_bytes = surface->m_color_bytes;
surface->m_is_active = true; surface->m_is_active = true;
(m_surface_group[0] = surface)->attach_display(this); (m_surface_group[0] = surface)->attach_display(this);
} }

View File

@ -131,4 +131,11 @@ Most of the demos have about 100 lines of UI code, more details [here.](https://
## 📞Community Channel ## 📞Community Channel
Thanks for the help from the community, you all make GuiLite better! And welcome to any new friend to join us. Thanks for the help from the community, you all make GuiLite better! And welcome to any new friend to join us.
- [**@Twitter**](https://twitter.com/idea4good) - [**@Twitter**](https://twitter.com/idea4good)
- QQ code:<br>[<img src="documents/qq.group-1.jpg">](https://jq.qq.com/?_wv=1027&k=qfvGGAa7) [<img src="documents/qq.group-2.jpg">](https://jq.qq.com/?_wv=1027&k=yKnUJj1B) [<img src="documents/qq.group-3.jpg">](https://jq.qq.com/?_wv=1027&k=5hc3qwj) - QQ group code:
<table>
<tr>
<td align="center"><a href="https://jq.qq.com/?_wv=1027&k=qfvGGAa7"><img src="documents/qq.group-1.jpg" width="240px;"/><br /><sub><b>大群527251257</b></sub></a>
<td align="center"><a href="https://jq.qq.com/?_wv=1027&k=yKnUJj1B"><img src="documents/qq.group-2.jpg" width="240px;"/><br /><sub><b>中群841031761</b></sub></a>
<td align="center"><a href="https://jq.qq.com/?_wv=1027&k=5hc3qwj"><img src="documents/qq.group-3.jpg" width="240px;"/><br /><sub><b>小群717471210</b></sub></a>
</tr>
</table>

View File

@ -127,4 +127,12 @@
大部分demo的UI代码只有100行左右更多信息点[这里。](https://gitee.com/idea4good/GuiLiteSamples) 大部分demo的UI代码只有100行左右更多信息点[这里。](https://gitee.com/idea4good/GuiLiteSamples)
## 📞社区交流 ## 📞社区交流
- 感谢开发者群的所有同学是你们塑造了今天的GuiLite也欢迎新的大神/小白加入我们。<br>[<img src="documents/qq.group-1.jpg">](https://jq.qq.com/?_wv=1027&k=qfvGGAa7) [<img src="documents/qq.group-2.jpg">](https://jq.qq.com/?_wv=1027&k=yKnUJj1B) [<img src="documents/qq.group-3.jpg">](https://jq.qq.com/?_wv=1027&k=5hc3qwj) - 感谢开发者群的所有同学是你们塑造了今天的GuiLite也欢迎新的大神/小白加入我们。
- GuiLite开发者QQ群
<table>
<tr>
<td align="center"><a href="https://jq.qq.com/?_wv=1027&k=qfvGGAa7"><img src="documents/qq.group-1.jpg" width="240px;"/><br /><sub><b>大群527251257</b></sub></a>
<td align="center"><a href="https://jq.qq.com/?_wv=1027&k=yKnUJj1B"><img src="documents/qq.group-2.jpg" width="240px;"/><br /><sub><b>中群841031761</b></sub></a>
<td align="center"><a href="https://jq.qq.com/?_wv=1027&k=5hc3qwj"><img src="documents/qq.group-3.jpg" width="240px;"/><br /><sub><b>小群717471210</b></sub></a>
</tr>
</table>

View File

@ -56,7 +56,7 @@ public:
int snap_shot(const char* file_name) int snap_shot(const char* file_name)
{ {
if (!m_phy_fb) if (!m_phy_fb || (m_color_bytes !=2 && m_color_bytes != 4))
{ {
return -1; return -1;
} }
@ -605,6 +605,7 @@ inline c_display::c_display(void* phy_fb, int display_width, int display_height,
inline c_display::c_display(void* phy_fb, int display_width, int display_height, c_surface* surface) : m_width(display_width), m_height(display_height), m_phy_fb(phy_fb), m_phy_read_index(0), m_phy_write_index(0), m_surface_cnt(1), m_surface_index(0) inline c_display::c_display(void* phy_fb, int display_width, int display_height, c_surface* surface) : m_width(display_width), m_height(display_height), m_phy_fb(phy_fb), m_phy_read_index(0), m_phy_write_index(0), m_surface_cnt(1), m_surface_index(0)
{ {
m_color_bytes = surface->m_color_bytes;
surface->m_is_active = true; surface->m_is_active = true;
(m_surface_group[0] = surface)->attach_display(this); (m_surface_group[0] = surface)->attach_display(this);
} }