mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 13:15:18 -05:00
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
This commit is contained in:
parent
dbab14de1f
commit
f9a912d850
1 changed files with 39 additions and 4 deletions
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue