Did more aggressive fullscreen ctk codesize optimization. Now ctk draw implementations need adjustment as the struct window member x and y are gone. Another potential optimization would be to remove clipping...
This commit is contained in:
parent
1b5ae78a95
commit
878f56837d
3 changed files with 26 additions and 16 deletions
|
@ -29,7 +29,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the "ctk" console GUI toolkit for cc65
|
* This file is part of the "ctk" console GUI toolkit for cc65
|
||||||
*
|
*
|
||||||
* $Id: ctk-conio.c,v 1.10 2007/12/16 13:00:51 oliverschmidt Exp $
|
* $Id: ctk-conio.c,v 1.11 2007/12/20 20:45:06 oliverschmidt Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -240,8 +240,13 @@ ctk_draw_widget(struct ctk_widget *w, unsigned char focus,
|
||||||
struct ctk_window *win = w->window;
|
struct ctk_window *win = w->window;
|
||||||
unsigned char posx, posy;
|
unsigned char posx, posy;
|
||||||
|
|
||||||
|
#if CTK_CONF_WINDOWS
|
||||||
posx = win->x + 1;
|
posx = win->x + 1;
|
||||||
posy = win->y + 1 + CTK_CONF_MENUS;
|
posy = win->y + 1 + CTK_CONF_MENUS;
|
||||||
|
#else /* CTK_CONF_WINDOWS */
|
||||||
|
posx = 0;
|
||||||
|
posy = 0;
|
||||||
|
#endif /* CTK_CONF_WINDOWS */
|
||||||
|
|
||||||
if(w == win->focused) {
|
if(w == win->focused) {
|
||||||
focus |= CTK_FOCUS_WIDGET;
|
focus |= CTK_FOCUS_WIDGET;
|
||||||
|
@ -259,7 +264,9 @@ ctk_draw_clear_window(struct ctk_window *window, unsigned char focus,
|
||||||
unsigned char clipy1, unsigned char clipy2)
|
unsigned char clipy1, unsigned char clipy2)
|
||||||
{
|
{
|
||||||
unsigned char i;
|
unsigned char i;
|
||||||
|
#if CTK_CONF_WINDOWS
|
||||||
unsigned char h;
|
unsigned char h;
|
||||||
|
#endif /* CTK_CONF_WINDOWS */
|
||||||
|
|
||||||
if(focus & CTK_FOCUS_WINDOW) {
|
if(focus & CTK_FOCUS_WINDOW) {
|
||||||
(void)textcolor(WINDOWCOLOR_FOCUS);
|
(void)textcolor(WINDOWCOLOR_FOCUS);
|
||||||
|
@ -267,6 +274,7 @@ ctk_draw_clear_window(struct ctk_window *window, unsigned char focus,
|
||||||
(void)textcolor(WINDOWCOLOR);
|
(void)textcolor(WINDOWCOLOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CTK_CONF_WINDOWS
|
||||||
h = window->y + 1 + CTK_CONF_MENUS + window->h;
|
h = window->y + 1 + CTK_CONF_MENUS + window->h;
|
||||||
|
|
||||||
/* Clear window contents. */
|
/* Clear window contents. */
|
||||||
|
@ -275,6 +283,13 @@ ctk_draw_clear_window(struct ctk_window *window, unsigned char focus,
|
||||||
cclearxy(window->x + 1, i, window->w);
|
cclearxy(window->x + 1, i, window->w);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else /* CTK_CONF_WINDOWS */
|
||||||
|
for(i = 0; i < window->h; ++i) {
|
||||||
|
if(i >= clipy1 && i < clipy2) {
|
||||||
|
cclearxy(0, i, window->w);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* CTK_CONF_WINDOWS */
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
static void
|
static void
|
||||||
|
@ -311,11 +326,10 @@ ctk_draw_window(struct ctk_window *window, unsigned char focus,
|
||||||
unsigned char clipy1, unsigned char clipy2,
|
unsigned char clipy1, unsigned char clipy2,
|
||||||
unsigned char draw_borders)
|
unsigned char draw_borders)
|
||||||
{
|
{
|
||||||
|
#if CTK_CONF_WINDOWS
|
||||||
unsigned char x, y;
|
unsigned char x, y;
|
||||||
unsigned char x1, y1, x2, y2;
|
unsigned char x1, y1, x2, y2;
|
||||||
#if CTK_CONF_WINDOWS
|
|
||||||
unsigned char h;
|
unsigned char h;
|
||||||
#endif /* CTK_CONF_WINDOWS */
|
|
||||||
|
|
||||||
if(window->y + CTK_CONF_MENUS >= clipy2) {
|
if(window->y + CTK_CONF_MENUS >= clipy2) {
|
||||||
return;
|
return;
|
||||||
|
@ -328,7 +342,6 @@ ctk_draw_window(struct ctk_window *window, unsigned char focus,
|
||||||
x2 = x1 + window->w;
|
x2 = x1 + window->w;
|
||||||
y2 = y1 + window->h;
|
y2 = y1 + window->h;
|
||||||
|
|
||||||
#if CTK_CONF_WINDOWS
|
|
||||||
if(draw_borders) {
|
if(draw_borders) {
|
||||||
|
|
||||||
/* Draw window frame. */
|
/* Draw window frame. */
|
||||||
|
@ -373,9 +386,14 @@ ctk_draw_window(struct ctk_window *window, unsigned char focus,
|
||||||
cputcxy(x2, y2, (char)CH_LRCORNER);
|
cputcxy(x2, y2, (char)CH_LRCORNER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* CTK_CONF_WINDOWS */
|
|
||||||
|
|
||||||
draw_window_contents(window, focus, clipy1, clipy2, x1, x2, y + 1, y2);
|
draw_window_contents(window, focus, clipy1, clipy2, x1, x2, y + 1, y2);
|
||||||
|
|
||||||
|
#else /* CTK_CONF_WINDOWS */
|
||||||
|
|
||||||
|
draw_window_contents(window, focus, clipy1, clipy2, 0, window->w, 0, window->h);
|
||||||
|
|
||||||
|
#endif /* CTK_CONF_WINDOWS */
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
#if CTK_CONF_WINDOWS
|
#if CTK_CONF_WINDOWS
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: ctk.c,v 1.17 2007/12/15 21:29:46 oliverschmidt Exp $
|
* $Id: ctk.c,v 1.18 2007/12/20 20:45:06 oliverschmidt Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -688,9 +688,6 @@ window_new(CC_REGISTER_ARG struct ctk_window *window,
|
||||||
} else {
|
} else {
|
||||||
window->y = (height - h - 2 - ctk_draw_windowtitle_height) / 2;
|
window->y = (height - h - 2 - ctk_draw_windowtitle_height) / 2;
|
||||||
}
|
}
|
||||||
#else /* CTK_CONF_WINDOWS */
|
|
||||||
window->x = -1;
|
|
||||||
window->y = -1;
|
|
||||||
#endif /* CTK_CONF_WINDOWS */
|
#endif /* CTK_CONF_WINDOWS */
|
||||||
|
|
||||||
window->w = w;
|
window->w = w;
|
||||||
|
@ -1613,13 +1610,13 @@ PROCESS_THREAD(ctk_process, ev, data)
|
||||||
ctk_window_open(window);
|
ctk_window_open(window);
|
||||||
redraw |= REDRAW_ALL;
|
redraw |= REDRAW_ALL;
|
||||||
} else {
|
} else {
|
||||||
#endif /* CTK_CONF_WINDOWS */
|
|
||||||
|
|
||||||
/* Find out which widget currently is under the mouse
|
/* Find out which widget currently is under the mouse
|
||||||
pointer and give it focus, unless it already has
|
pointer and give it focus, unless it already has
|
||||||
focus. */
|
focus. */
|
||||||
mxc = mxc - window->x - ctk_draw_windowborder_width;
|
mxc = mxc - window->x - ctk_draw_windowborder_width;
|
||||||
myc = myc - window->y - ctk_draw_windowtitle_height;
|
myc = myc - window->y - ctk_draw_windowtitle_height;
|
||||||
|
#endif /* CTK_CONF_WINDOWS */
|
||||||
|
|
||||||
/* See if the mouse pointer is on a widget. If so, it
|
/* See if the mouse pointer is on a widget. If so, it
|
||||||
should be selected and, if the button is clicked,
|
should be selected and, if the button is clicked,
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki desktop OS.
|
* This file is part of the Contiki desktop OS.
|
||||||
*
|
*
|
||||||
* $Id: ctk.h,v 1.4 2007/12/14 23:34:19 oliverschmidt Exp $
|
* $Id: ctk.h,v 1.5 2007/12/20 20:45:06 oliverschmidt Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -528,11 +528,6 @@ struct ctk_window {
|
||||||
characters. */
|
characters. */
|
||||||
y; /**< The y coordinate of the window, in
|
y; /**< The y coordinate of the window, in
|
||||||
characters. */
|
characters. */
|
||||||
#else /* CTK_CONF_WINDOWS */
|
|
||||||
signed char x, /**< The x coordinate of the window, in
|
|
||||||
characters. */
|
|
||||||
y; /**< The y coordinate of the window, in
|
|
||||||
characters. */
|
|
||||||
#endif /* CTK_CONF_WINDOWS */
|
#endif /* CTK_CONF_WINDOWS */
|
||||||
unsigned char w, /**< The width of the window, excluding
|
unsigned char w, /**< The width of the window, excluding
|
||||||
window borders. */
|
window borders. */
|
||||||
|
|
Loading…
Add table
Reference in a new issue