aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/multiple
diff options
context:
space:
mode:
authorinmarket <andrewh@inmarket.com.au>2013-09-30 00:05:07 +1000
committerinmarket <andrewh@inmarket.com.au>2013-09-30 00:05:07 +1000
commit6499da5be310f8f3ef8f2d11dfcfb662499c8c17 (patch)
tree36322d95790e500c4aaca1097c806ba277b0bf0b /drivers/multiple
parenta2aa837e09cd80a3d2fd9bd3097062ab06905227 (diff)
downloaduGFX-6499da5be310f8f3ef8f2d11dfcfb662499c8c17.tar.gz
uGFX-6499da5be310f8f3ef8f2d11dfcfb662499c8c17.tar.bz2
uGFX-6499da5be310f8f3ef8f2d11dfcfb662499c8c17.zip
SSD1289 streaming driver (untested)
X streaming driver (untested) Nokia6610 fixes Read pixel streaming support for low level driver.
Diffstat (limited to 'drivers/multiple')
-rw-r--r--drivers/multiple/Win32/gdisp_lld.c4
-rw-r--r--drivers/multiple/X/gdisp_lld.c136
-rw-r--r--drivers/multiple/X/gdisp_lld_config.h11
3 files changed, 80 insertions, 71 deletions
diff --git a/drivers/multiple/Win32/gdisp_lld.c b/drivers/multiple/Win32/gdisp_lld.c
index f55f3700..41141a90 100644
--- a/drivers/multiple/Win32/gdisp_lld.c
+++ b/drivers/multiple/Win32/gdisp_lld.c
@@ -463,7 +463,7 @@ LLDSPEC bool_t gdisp_lld_init(GDISPDriver *g) {
#endif
#if GDISP_HARDWARE_BITFILLS
- void gdisp_lld_blit_area(GDISPDriver *g) {
+ LLDSPEC void gdisp_lld_blit_area(GDISPDriver *g) {
BITMAPV4HEADER bmpInfo;
HDC dcScreen;
pixel_t * buffer;
@@ -577,7 +577,7 @@ LLDSPEC bool_t gdisp_lld_init(GDISPDriver *g) {
#endif
#if GDISP_NEED_SCROLL && GDISP_HARDWARE_SCROLL
- void gdisp_lld_vertical_scroll(GDISPDriver *g) {
+ LLDSPEC void gdisp_lld_vertical_scroll(GDISPDriver *g) {
HDC dcScreen;
RECT rect;
coord_t lines;
diff --git a/drivers/multiple/X/gdisp_lld.c b/drivers/multiple/X/gdisp_lld.c
index 13368bc1..9c6a7123 100644
--- a/drivers/multiple/X/gdisp_lld.c
+++ b/drivers/multiple/X/gdisp_lld.c
@@ -14,6 +14,9 @@
#if GFX_USE_GDISP
+#define GDISP_LLD_DECLARATIONS
+#include "gdisp/lld/gdisp_lld.h"
+
/**
* Our color model - Default or 24 bit only.
*
@@ -25,26 +28,23 @@
#define GDISP_FORCE_24BIT FALSE
#endif
+#ifndef GDISP_SCREEN_HEIGHT
+ #define GDISP_SCREEN_HEIGHT 480
+#endif
+#ifndef GDISP_SCREEN_WIDTH
+ #define GDISP_SCREEN_WIDTH 640
+#endif
+
#if GINPUT_NEED_MOUSE
/* Include mouse support code */
#include "ginput/lld/mouse.h"
#endif
-/* Include the emulation code for things we don't support */
-#include "gdisp/lld/emulation.c"
-
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <stdio.h>
#include <stdlib.h>
-#ifndef GDISP_SCREEN_HEIGHT
- #define GDISP_SCREEN_HEIGHT 480
-#endif
-#ifndef GDISP_SCREEN_WIDTH
- #define GDISP_SCREEN_WIDTH 640
-#endif
-
Display *dis;
int scr;
Window win;
@@ -130,7 +130,7 @@ static int FatalXIOError(Display *d) {
exit(0);
}
-bool_t gdisp_lld_init(void)
+LLDSPEC bool_t gdisp_lld_init(GDISPDriver *g) {
{
XSizeHints *pSH;
XSetWindowAttributes xa;
@@ -212,69 +212,81 @@ bool_t gdisp_lld_init(void)
gfxThreadClose(hth);
/* Initialise the GDISP structure to match */
- GDISP.Orientation = GDISP_ROTATE_0;
- GDISP.Powermode = powerOn;
- GDISP.Backlight = 100;
- GDISP.Contrast = 50;
- GDISP.Width = GDISP_SCREEN_WIDTH;
- GDISP.Height = GDISP_SCREEN_HEIGHT;
- #if GDISP_NEED_VALIDATION || GDISP_NEED_CLIP
- GDISP.clipx0 = 0;
- GDISP.clipy0 = 0;
- GDISP.clipx1 = GDISP.Width;
- GDISP.clipy1 = GDISP.Height;
- #endif
+ g->g.Orientation = g->g_ROTATE_0;
+ g->g.Powermode = powerOn;
+ g->g.Backlight = 100;
+ g->g.Contrast = 50;
+ g->g.Width = GDISP_SCREEN_WIDTH;
+ g->g.Height = GDISP_SCREEN_HEIGHT;
return TRUE;
}
-void gdisp_lld_draw_pixel(coord_t x, coord_t y, color_t color)
+LLDSPEC void gdisp_lld_draw_pixel(GDISPDriver *g)
{
XColor col;
- #if GDISP_NEED_VALIDATION || GDISP_NEED_CLIP
- // Clip pre orientation change
- if (x < GDISP.clipx0 || y < GDISP.clipy0 || x >= GDISP.clipx1 || y >= GDISP.clipy1) return;
- #endif
-
- col.red = RED_OF(color) << 8;
- col.green = GREEN_OF(color) << 8;
- col.blue = BLUE_OF(color) << 8;
+ col.red = RED_OF(g->p.color) << 8;
+ col.green = GREEN_OF(g->p.color) << 8;
+ col.blue = BLUE_OF(g->p.color) << 8;
XAllocColor(dis, cmap, &col);
XSetForeground(dis, gc, col.pixel);
- XDrawPoint(dis, pix, gc, (int)x, (int)y );
- XDrawPoint(dis, win, gc, (int)x, (int)y );
+ XDrawPoint(dis, pix, gc, (int)g->p.x, (int)g->p.y );
+ XDrawPoint(dis, win, gc, (int)g->p.x, (int)g->p.y );
XFlush(dis);
}
-void gdisp_lld_fill_area(coord_t x, coord_t y, coord_t cx, coord_t cy, color_t color) {
- XColor col;
-
- #if GDISP_NEED_VALIDATION || GDISP_NEED_CLIP
- // Clip pre orientation change
- if (x < GDISP.clipx0) { cx -= GDISP.clipx0 - x; x = GDISP.clipx0; }
- if (y < GDISP.clipy0) { cy -= GDISP.clipy0 - y; y = GDISP.clipy0; }
- if (cx <= 0 || cy <= 0 || x >= GDISP.clipx1 || y >= GDISP.clipy1) return;
- if (x+cx > GDISP.clipx1) cx = GDISP.clipx1 - x;
- if (y+cy > GDISP.clipy1) cy = GDISP.clipy1 - y;
- #endif
-
- col.red = RED_OF(color) << 8;
- col.green = GREEN_OF(color) << 8;
- col.blue = BLUE_OF(color) << 8;
- XAllocColor(dis, cmap, &col);
- XSetForeground(dis, gc, col.pixel);
- XFillRectangle(dis, pix, gc, x, y, cx, cy);
- XFillRectangle(dis, win, gc, x, y, cx, cy);
- XFlush(dis);
-}
+#if GDISP_HARDWARE_FILLS
+ LLDSPEC void gdisp_lld_fill_area(GDISPDriver *g) {
+ XColor col;
+
+ col.red = RED_OF(g->p.color) << 8;
+ col.green = GREEN_OF(g->p.color) << 8;
+ col.blue = BLUE_OF(g->p.color) << 8;
+ XAllocColor(dis, cmap, &col);
+ XSetForeground(dis, gc, col.pixel);
+ XFillRectangle(dis, pix, gc, g->p.x, g->p.y, g->p.cx, g->p.cy);
+ XFillRectangle(dis, win, gc, g->p.x, g->p.y, g->p.cx, g->p.cy);
+ XFlush(dis);
+ }
+#endif
+
+#if 0 && GDISP_HARDWARE_BITFILLS
+ LLDSPEC void gdisp_lld_blit_area(GDISPDriver *g) {
+ // Start of Bitblit code
+
+ //XImage bitmap;
+ //pixel_t *bits;
+ // bits = malloc(vis.depth * GDISP_SCREEN_WIDTH * GDISP_SCREEN_HEIGHT);
+ // bitmap = XCreateImage(dis, vis, vis.depth, ZPixmap,
+ // 0, bits, GDISP_SCREEN_WIDTH, GDISP_SCREEN_HEIGHT,
+ // 0, 0);
+ }
+#endif
+
+#if GDISP_HARDWARE_PIXELREAD
+ LLDSPEC color_t gdisp_lld_get_pixel_color(GDISPDriver *g) {
+ XColor color;
+ XImage *img;
-// Start of Bitblit code
-//XImage bitmap;
-//pixel_t *bits;
-// bits = malloc(vis.depth * GDISP_SCREEN_WIDTH * GDISP_SCREEN_HEIGHT);
-// bitmap = XCreateImage(dis, vis, vis.depth, ZPixmap,
-// 0, bits, GDISP_SCREEN_WIDTH, GDISP_SCREEN_HEIGHT,
-// 0, 0);
+ img = XGetImage (dis, pix, g->p.x, g->p.y, 1, 1, AllPlanes, XYPixmap);
+ color->pixel = XGetPixel (img, 0, 0);
+ XFree(img);
+ XQueryColor(dis, cmap, &color);
+ return RGB2COLOR(c.red>>8, c.green>>8, c.blue>>8);
+ }
+#endif
+
+#if GDISP_NEED_SCROLL && GDISP_HARDWARE_SCROLL
+ LLDSPEC void gdisp_lld_vertical_scroll(GDISPDriver *g) {
+ if (g->p.y1 > 0) {
+ XCopyArea(dis, pix, pix, gc, g->p.x, g->p.y+g->p.y1, g->p.cx, g->p.cy-g->p.y1, g->p.x, g->p.y);
+ XCopyArea(dis, pix, win, gc, g->p.x, g->p.y, g->p.cx, g->p.cy-g->p.y1, g->p.x, g->p.y);
+ } else {
+ XCopyArea(dis, pix, pix, gc, g->p.x, g->p.y, g->p.cx, g->p.cy+g->p.y1, g->p.x, g->p.y-g->p.y1);
+ XCopyArea(dis, pix, win, gc, g->p.x, g->p.y-lines, g->p.cx, g->p.cy+g->p.y1, g->p.x, g->p.y-g->p.y1);
+ }
+ }
+#endif
#if GINPUT_NEED_MOUSE
diff --git a/drivers/multiple/X/gdisp_lld_config.h b/drivers/multiple/X/gdisp_lld_config.h
index 0cacc4f8..0bd76a2c 100644
--- a/drivers/multiple/X/gdisp_lld_config.h
+++ b/drivers/multiple/X/gdisp_lld_config.h
@@ -23,17 +23,14 @@
/*===========================================================================*/
#define GDISP_DRIVER_NAME "Linux emulator - X11"
+#define GDISP_DRIVER_STRUCT GDISP_X11
-#define GDISP_HARDWARE_CLEARS FALSE
+#define GDISP_HARDWARE_DRAWPIXEL TRUE
#define GDISP_HARDWARE_FILLS TRUE
#define GDISP_HARDWARE_BITFILLS FALSE
-#define GDISP_HARDWARE_SCROLL FALSE
-#define GDISP_HARDWARE_PIXELREAD FALSE
+#define GDISP_HARDWARE_SCROLL TRUE
+#define GDISP_HARDWARE_PIXELREAD TRUE
#define GDISP_HARDWARE_CONTROL FALSE
-#define GDISP_HARDWARE_CIRCLES FALSE
-#define GDISP_HARDWARE_CIRCLEFILLS FALSE
-#define GDISP_HARDWARE_ARCS FALSE
-#define GDISP_HARDWARE_ARCFILLS FALSE
#define GDISP_PIXELFORMAT GDISP_PIXELFORMAT_RGB888