From f9a912d8501420e5211c801a129df8a11bbfcf13 Mon Sep 17 00:00:00 2001 From: Kjell Ericson Date: Mon, 28 Oct 2002 20:04:53 +0000 Subject: Using the structures "rectangle" and "points" when drawing (Win32 doesn't have XPoint). Added the funtion drawrectangles() that is used for the player simulation. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2762 a1c6a512-1295-4272-9138-f99709370657 --- uisimulator/x11/uibasic.c | 43 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/uisimulator/x11/uibasic.c b/uisimulator/x11/uibasic.c index 78ba500b6d..051f5a8b6f 100644 --- a/uisimulator/x11/uibasic.c +++ b/uisimulator/x11/uibasic.c @@ -34,6 +34,7 @@ #include "version.h" #include "lcd-x11.h" +#include "lcd-playersim.h" #define MAX(x,y) ((x)>(y)?(x):(y)) #define MIN(x,y) ((x)<(y)?(x):(y)) @@ -49,6 +50,7 @@ static int display_zoom=1; Display *dpy; Window window; +bool lcd_display_redraw=true; XrmOptionDescRec options [] = { /* { "-subtractive", ".additive", XrmoptionNoArg, "false" }, */ @@ -96,6 +98,21 @@ void screen_resized(int width, int height) XSetForeground (dpy, draw_gc, get_pixel_resource ("background", "Background", dpy, cmap)); XFillRectangle(dpy, window, draw_gc, 0, 0, width*display_zoom, height*display_zoom); + lcd_display_redraw=true; + screen_redraw(); +} + +void drawrect(int color, int x1, int y1, int x2, int y2) +{ + if (color==0) { + XSetForeground(dpy, draw_gc, + get_pixel_resource("background", "Background", dpy, cmap)); + } + else + XSetForeground(dpy, draw_gc, + get_pixel_resource("foreground", "Foreground", dpy, cmap)); + XFillRectangle(dpy, window, draw_gc, x1*display_zoom, y1*display_zoom, + x2*display_zoom, y2*display_zoom); } @@ -137,7 +154,7 @@ void drawdot(int color, int x, int y) display_zoom, display_zoom); } -void drawdots(int color, XPoint *points, int count) +void drawdots(int color, struct coordinate *points, int count) { if (color==0) { XSetForeground(dpy, draw_gc, @@ -147,7 +164,7 @@ void drawdots(int color, XPoint *points, int count) XSetForeground(dpy, draw_gc, get_pixel_resource("foreground", "Foreground", dpy, cmap)); - while (count-->=0) { + while (count--) { XFillRectangle(dpy, window, draw_gc, points[count].x*display_zoom, points[count].y*display_zoom, @@ -156,6 +173,26 @@ void drawdots(int color, XPoint *points, int count) } } +void drawrectangles(int color, struct rectangle *points, int count) +{ + if (color==0) { + XSetForeground(dpy, draw_gc, + get_pixel_resource("background", "Background", dpy, cmap)); + } + else + XSetForeground(dpy, draw_gc, + get_pixel_resource("foreground", "Foreground", dpy, cmap)); + + while (count--) { + XFillRectangle(dpy, window, draw_gc, + points[count].x*display_zoom, + points[count].y*display_zoom, + points[count].width*display_zoom, + points[count].height*display_zoom); + + } +} + void drawtext(int color, int x, int y, char *text) { if (color==0) { @@ -197,7 +234,6 @@ screenhack (Display *the_dpy, Window the_window) void screen_redraw() { /* draw a border around the "Recorder" screen */ - #define X1 0 #define Y1 0 #define X2 (LCD_WIDTH + MARGIN_X*2) @@ -207,6 +243,5 @@ void screen_redraw() drawline(1, X2, Y1, X2, Y2); drawline(1, X1, Y2, X2, Y2); drawline(1, X1, Y1, X1, Y2); - lcd_update(); } -- cgit v1.2.3