aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorergosys <ergosys@gmail.com>2014-12-13 14:44:53 -0800
committerergosys <ergosys@gmail.com>2014-12-13 15:09:37 -0800
commit555fda21708519de00dd10a213e346d084c50023 (patch)
treebfda2007e4fccda9bf6a805986701dccd45d6139 /drivers
parentd3b3020a078fff9607fd169c32210888ee6b0c5c (diff)
downloaduGFX-555fda21708519de00dd10a213e346d084c50023.tar.gz
uGFX-555fda21708519de00dd10a213e346d084c50023.tar.bz2
uGFX-555fda21708519de00dd10a213e346d084c50023.zip
Implement "hardware" fills
Implement hardware fills by drawing on the framebuffer. This provides a significant performance boost for filled geometric primitives and a small one for font drawing. Tested at all orientations.
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gdisp/SSD1306/gdisp_lld_SSD1306.c40
-rw-r--r--drivers/gdisp/SSD1306/gdisp_lld_config.h1
2 files changed, 41 insertions, 0 deletions
diff --git a/drivers/gdisp/SSD1306/gdisp_lld_SSD1306.c b/drivers/gdisp/SSD1306/gdisp_lld_SSD1306.c
index 1885ffac..a13b82a8 100644
--- a/drivers/gdisp/SSD1306/gdisp_lld_SSD1306.c
+++ b/drivers/gdisp/SSD1306/gdisp_lld_SSD1306.c
@@ -166,6 +166,46 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
}
#endif
+#if GDISP_HARDWARE_FILLS
+ LLDSPEC void gdisp_lld_fill_area(GDisplay *g) {
+ coord_t sy = g->p.y;
+ coord_t ey = sy + g->p.cy - 1;
+ coord_t sx = g->p.x;
+ coord_t ex = g->p.x + g->p.cx - 1;
+ if (g->g.Orientation == GDISP_ROTATE_90 || g->g.Orientation == GDISP_ROTATE_270) {
+ coord_t tmp;
+ tmp = sx; sx = sy; sy = tmp;
+ tmp = ex; ex = ey; ey = tmp;
+ }
+ unsigned spage = sy / 8;
+ uint8_t * base = RAM(g) + GDISP_SCREEN_WIDTH * spage;
+ uint8_t mask = 0xff << (sy&7);
+ unsigned zpages = (ey / 8) - spage;
+ coord_t col;
+ if (gdispColor2Native(g->p.color)==Black) {
+ while (zpages--) {
+ for (col = sx; col <= ex; col++)
+ base[col] &= ~mask;
+ mask = 0xff;
+ base += GDISP_SCREEN_WIDTH;
+ }
+ mask &= (0xff >> (7 - (ey&7)));
+ for (col = sx; col <= ex; col++)
+ base[col] &= ~mask;
+ } else {
+ while (zpages--) {
+ for (col = sx; col <= ex; col++)
+ base[col] |= mask;
+ mask = 0xff;
+ base += GDISP_SCREEN_WIDTH;
+ }
+ mask &= (0xff >> (7 - (ey&7)));
+ for (col = sx; col <= ex; col++)
+ base[col] |= mask;
+ }
+ }
+#endif
+
#if GDISP_HARDWARE_DRAWPIXEL
LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) {
coord_t x = g->p.x;
diff --git a/drivers/gdisp/SSD1306/gdisp_lld_config.h b/drivers/gdisp/SSD1306/gdisp_lld_config.h
index 9c502157..a0961dcf 100644
--- a/drivers/gdisp/SSD1306/gdisp_lld_config.h
+++ b/drivers/gdisp/SSD1306/gdisp_lld_config.h
@@ -19,6 +19,7 @@
#define GDISP_HARDWARE_PIXELREAD TRUE
#define GDISP_HARDWARE_CONTROL TRUE
#define GDISP_HARDWARE_CLEARS TRUE
+#define GDISP_HARDWARE_FILLS TRUE
#define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_MONO