diff --git a/library/graphics/hwlib-graphics-window.hpp b/library/graphics/hwlib-graphics-window.hpp index d04ca8b..b6eebb1 100644 --- a/library/graphics/hwlib-graphics-window.hpp +++ b/library/graphics/hwlib-graphics-window.hpp @@ -46,7 +46,7 @@ class window : public noncopyable { /// The default implementation writes to all pixels in sequence. /// A concrete window can provide a faster implementation. virtual void clear_implementation( - color col + color col = unspecified ){ for( const auto p : all( size ) ){ write_implementation( p, col.specify( background ) ); @@ -87,7 +87,7 @@ class window : public noncopyable { size{ size }, background{ background }, foreground{ foreground } - { clear( background ); } + {} /// write a pixel /// diff --git a/library/peripherals/hwlib-glcd-oled.hpp b/library/peripherals/hwlib-glcd-oled.hpp index 541c84c..9e28f79 100644 --- a/library/peripherals/hwlib-glcd-oled.hpp +++ b/library/peripherals/hwlib-glcd-oled.hpp @@ -330,6 +330,7 @@ class glcd_oled_i2c_128x64_direct : public ssd1306_i2c, public window { ssd1306_initialization, sizeof( ssd1306_initialization ) / sizeof( uint8_t ) ); + clear(); } void flush() override {} @@ -394,7 +395,7 @@ class glcd_oled_spi_128x64_direct_res_dc_cs : command( ssd1306_commands::display_all_on_resume ); command( ssd1306_commands::normal_display ); command( ssd1306_commands::display_on ); - + clear(); } void clear_implementation( color c ) override { @@ -454,6 +455,7 @@ class glcd_oled_i2c_128x64_buffered : public ssd1306_i2c, public window { ssd1306_initialization, sizeof( ssd1306_initialization ) / sizeof( uint8_t ) ); + clear(); } void flush() override { @@ -527,6 +529,7 @@ class glcd_oled_i2c_128x64_fast_buffered : public ssd1306_i2c, public window { ssd1306_initialization, sizeof( ssd1306_initialization ) / sizeof( uint8_t ) ); + clear(); } void flush() override { diff --git a/library/peripherals/hwlib-glcd-st7789.hpp b/library/peripherals/hwlib-glcd-st7789.hpp index 40824db..57349bc 100644 --- a/library/peripherals/hwlib-glcd-st7789.hpp +++ b/library/peripherals/hwlib-glcd-st7789.hpp @@ -179,6 +179,8 @@ class st7789_spi_dc_cs_rst : public st7789, public window { wait_ms( 100 ); command( commands::DISPON ); wait_ms( 100 ); + + clear(); } void flush() override {