add valid check for wav_ctrl

This commit is contained in:
idea4good 2019-01-10 15:05:08 +08:00
parent e4d73bf327
commit c796a4b286
2 changed files with 5 additions and 4 deletions

View File

@ -594,7 +594,6 @@ void c_surface_mcu::fill_rect(int x0, int y0, int x1, int y1, unsigned int rgb,
{ {
return m_gfx_op->fill_rect(x0, y0, x1, y1, rgb); return m_gfx_op->fill_rect(x0, y0, x1, y1, rgb);
} }
for (; y0 <= y1; y0++) for (; y0 <= y1; y0++)
{ {
draw_hline(x0, x1, y0, rgb, z_order); draw_hline(x0, x1, y0, rgb, z_order);

View File

@ -258,16 +258,18 @@ void c_wave_ctrl::restore_background()
register int width = rect.Width(); register int width = rect.Width();
register int top = rect.m_top; register int top = rect.m_top;
register int left = rect.m_left; register int left = rect.m_left;
unsigned int* p_fb = m_bg_fb;
for (int y_pos = (m_wave_top - 1); y_pos <= (m_wave_bottom + 1); y_pos++) for (int y_pos = (m_wave_top - 1); y_pos <= (m_wave_bottom + 1); y_pos++)
{ {
draw_pixel(x, y_pos, p_fb[(y_pos - top) * width + (x - left)]); (m_bg_fb) ? draw_pixel(x, y_pos, m_bg_fb[(y_pos - top) * width + (x - left)]) : draw_pixel(x, y_pos, 0);
} }
} }
void c_wave_ctrl::save_background() void c_wave_ctrl::save_background()
{ {
if (!m_bg_fb)
{
return;
}
c_rect rect; c_rect rect;
get_screen_rect(rect); get_screen_rect(rect);