| version 1.1, 2003/11/16 16:43:45 | version 1.2, 2003/11/26 14:55:01 | 
| Line 51  typedef struct { | Line 51  typedef struct { | 
 | RECT_T  scrn; | RECT_T  scrn; | 
 | RECT_T  rect; | RECT_T  rect; | 
 |  |  | 
 |  | int     lpitch; | 
 | int     scrw; | int     scrw; | 
 | int     scrh; | int     scrh; | 
 |  |  | 
 | int     lpitch; |  | 
 |  |  | 
 | /* toolkit depend */ | /* toolkit depend */ | 
| GdkImage*       surface; | GdkImage        *surface; | 
| GdkPixmap*      backsurf; | GdkPixmap       *backsurf; | 
 | unsigned long   pixel[24];      /* pallete */ | unsigned long   pixel[24];      /* pallete */ | 
 |  |  | 
 |  | BOOL            shared_pixmap; | 
 | } DRAWMNG; | } DRAWMNG; | 
 |  |  | 
 | typedef struct { | typedef struct { | 
| Line 145  renewal_client_size(void) | Line 146  renewal_client_size(void) | 
 | static void | static void | 
 | clear_out_of_rect(const RECT_T* target, const RECT_T* base) | clear_out_of_rect(const RECT_T* target, const RECT_T* base) | 
 | { | { | 
 |  | GdkDrawable *d = drawarea->window; | 
 |  | GdkGC *gc = drawarea->style->black_gc; | 
 | RECT_T rect; | RECT_T rect; | 
 |  |  | 
 | rect.left = base->left; | rect.left = base->left; | 
| Line 152  clear_out_of_rect(const RECT_T* target, | Line 155  clear_out_of_rect(const RECT_T* target, | 
 | rect.top = base->top; | rect.top = base->top; | 
 | rect.bottom = target->top; | rect.bottom = target->top; | 
 | if (rect.top < rect.bottom) { | if (rect.top < rect.bottom) { | 
| gdk_draw_rectangle(drawmng.backsurf, | gdk_draw_rectangle(d, gc, TRUE, | 
| drawarea->style->black_gc, TRUE, |  | 
 | rect.left, rect.top, rect.right, rect.bottom); | rect.left, rect.top, rect.right, rect.bottom); | 
 | } | } | 
 | rect.top = target->bottom; | rect.top = target->bottom; | 
 | rect.bottom = base->bottom; | rect.bottom = base->bottom; | 
 | if (rect.top < rect.bottom) { | if (rect.top < rect.bottom) { | 
| gdk_draw_rectangle(drawmng.backsurf, | gdk_draw_rectangle(d, gc, TRUE, | 
| drawarea->style->black_gc, TRUE, |  | 
 | rect.left, rect.top, rect.right, rect.bottom); | rect.left, rect.top, rect.right, rect.bottom); | 
 | } | } | 
 |  |  | 
| Line 170  clear_out_of_rect(const RECT_T* target, | Line 171  clear_out_of_rect(const RECT_T* target, | 
 | rect.left = base->left; | rect.left = base->left; | 
 | rect.right = target->left; | rect.right = target->left; | 
 | if (rect.left < rect.right) { | if (rect.left < rect.right) { | 
| gdk_draw_rectangle(drawmng.backsurf, | gdk_draw_rectangle(d, gc, TRUE, | 
| drawarea->style->black_gc, TRUE, |  | 
 | rect.left, rect.top, rect.right, rect.bottom); | rect.left, rect.top, rect.right, rect.bottom); | 
 | } | } | 
 | rect.left = target->right; | rect.left = target->right; | 
 | rect.right = base->right; | rect.right = base->right; | 
 | if (rect.left < rect.right) { | if (rect.left < rect.right) { | 
| gdk_draw_rectangle(drawmng.backsurf, | gdk_draw_rectangle(d, gc, TRUE, | 
| drawarea->style->black_gc, TRUE, |  | 
 | rect.left, rect.top, rect.right, rect.bottom); | rect.left, rect.top, rect.right, rect.bottom); | 
 | } | } | 
 | } | } | 
| Line 190  clear_outscreen(void) | Line 189  clear_outscreen(void) | 
 | RECT_T target; | RECT_T target; | 
 | RECT_T base; | RECT_T base; | 
 |  |  | 
 |  | base.left = base.top = 0; | 
 |  | base.right = drawmng.scrw; | 
 |  | base.bottom = drawmng.scrh; | 
 | target = drawmng.scrn; | target = drawmng.scrn; | 
 | memset(&base, 0, sizeof(base)); |  | 
 | clear_out_of_rect(&target, &base); | clear_out_of_rect(&target, &base); | 
 | } | } | 
 |  |  | 
| Line 340  scrnmng_create(BYTE mode) | Line 341  scrnmng_create(BYTE mode) | 
 | bytes_per_pixel = bitcolor >> 3; | bytes_per_pixel = bitcolor >> 3; | 
 |  |  | 
 | if (!(mode & SCRNMODE_ROTATE)) { | if (!(mode & SCRNMODE_ROTATE)) { | 
| rect.right = 640; | rect.right = 641; | 
 | rect.bottom = 480; | rect.bottom = 480; | 
 | if (np2oscfg.paddingx) { |  | 
 | rect.right++; |  | 
 | } |  | 
 |  |  | 
 | lpitch = rect.right * bytes_per_pixel; | lpitch = rect.right * bytes_per_pixel; | 
 | if (lpitch % 4) { | if (lpitch % 4) { | 
 | rect.right += (lpitch % 4) / bytes_per_pixel; | rect.right += (lpitch % 4) / bytes_per_pixel; | 
 | } | } | 
 | } else { | } else { | 
 | rect.right = 480; | rect.right = 480; | 
| rect.bottom = 640; | rect.bottom = 641; | 
| if (np2oscfg.paddingx) { |  | 
| rect.bottom++; |  | 
| } |  | 
 | } | } | 
 | lpitch = rect.right * bytes_per_pixel; | lpitch = rect.right * bytes_per_pixel; | 
 | height = 480; | height = 480; | 
| Line 366  scrnmng_create(BYTE mode) | Line 360  scrnmng_create(BYTE mode) | 
 | g_message("can't create surface."); | g_message("can't create surface."); | 
 | return FAILURE; | return FAILURE; | 
 | } | } | 
 |  |  | 
 |  | drawmng.backsurf = NULL; | 
 |  | if (use_shared_pixmap) { | 
 |  | drawmng.backsurf = gdk_pixmap_shpix_new( | 
 |  | drawarea->window, drawmng.surface, | 
 |  | rect.right, rect.bottom, visual->depth); | 
 |  | } | 
 |  | if (drawmng.backsurf == NULL) { | 
 |  | drawmng.shared_pixmap = FALSE; | 
 |  | drawmng.backsurf = gdk_pixmap_new(drawarea->window, | 
 |  | rect.right, rect.bottom, visual->depth); | 
 |  | } | 
 |  | if (drawmng.backsurf == NULL) { | 
 |  | g_message("can't create pixmap."); | 
 |  | return FAILURE; | 
 |  | } | 
 |  | gdk_draw_rectangle(drawmng.backsurf, drawarea->style->black_gc, | 
 |  | TRUE, 0, 0, rect.right, rect.bottom); | 
 | } | } | 
 | scrnmng.bpp = (BYTE)bitcolor; | scrnmng.bpp = (BYTE)bitcolor; | 
 | drawmng.lpitch = lpitch; | drawmng.lpitch = lpitch; | 
| Line 376  scrnmng_create(BYTE mode) | Line 388  scrnmng_create(BYTE mode) | 
 | drawmng.clipping = 0; | drawmng.clipping = 0; | 
 | renewal_client_size(); | renewal_client_size(); | 
 |  |  | 
 | drawmng.backsurf = gdk_pixmap_new(drawarea->window, |  | 
 | drawmng.scrw, drawmng.scrh, visual->depth); |  | 
 | if (drawmng.backsurf == NULL) { |  | 
 | g_message("can't create pixmap."); |  | 
 | return FAILURE; |  | 
 | } |  | 
 | gdk_draw_rectangle(drawmng.backsurf, drawarea->style->black_gc, TRUE, |  | 
 | 0, 0, drawmng.scrw, drawmng.scrh); |  | 
 |  |  | 
 | return SUCCESS; | return SUCCESS; | 
 | } | } | 
 |  |  | 
| Line 471  void | Line 474  void | 
 | scrnmng_surfunlock(const SCRNSURF* surf) | scrnmng_surfunlock(const SCRNSURF* surf) | 
 | { | { | 
 | X11SCRNSURF *ss = (X11SCRNSURF *)surf; | X11SCRNSURF *ss = (X11SCRNSURF *)surf; | 
| GtkWidget *w = drawarea; | GdkDrawable *d = drawarea->window; | 
| GdkGC *gc = w->style->fg_gc[GTK_WIDGET_STATE(w)]; | GdkGC *gc = drawarea->style->fg_gc[GTK_WIDGET_STATE(drawarea)]; | 
 | BYTE *delta = ss->renewal; | BYTE *delta = ss->renewal; | 
 | RECT_T r; | RECT_T r; | 
 | gint h, s; | gint h, s; | 
| Line 482  scrnmng_surfunlock(const SCRNSURF* surf) | Line 485  scrnmng_surfunlock(const SCRNSURF* surf) | 
 | r.right = drawmng.rect.right; | r.right = drawmng.rect.right; | 
 | r.bottom = drawmng.rect.bottom; | r.bottom = drawmng.rect.bottom; | 
 |  |  | 
| if (!(drawmng.scrnmode & SCRNMODE_ROTATE)) { | if (!drawmng.shared_pixmap) { | 
| /* normal */ | if (!(drawmng.scrnmode & SCRNMODE_ROTATE)) { | 
| for (s = h = 0; h < r.bottom; h++) { | /* normal */ | 
| if ((renewal_line[h] != delta[h]) || (s == h)) | for (s = h = 0; h < r.bottom; h++) { | 
| continue; | if ((renewal_line[h] != delta[h]) || (s == h)) | 
|  | continue; | 
| gdk_draw_image(drawmng.backsurf, gc, drawmng.surface, |  | 
| 0, s, r.left, r.top + s, r.right, h - s); | gdk_draw_image(drawmng.backsurf, gc, drawmng.surface, | 
| s = h + 1; | 0, s, r.left, r.top + s, r.right, h - s); | 
| } | s = h + 1; | 
| if (s != h) { | } | 
| gdk_draw_image(drawmng.backsurf, gc, drawmng.surface, | if (s != h) { | 
| 0, s, r.left, r.top + s, r.right, h - s); | gdk_draw_image(drawmng.backsurf, gc, drawmng.surface, | 
| } | 0, s, r.left, r.top + s, r.right, h - s); | 
| } else if (!(drawmng.scrnmode & SCRNMODE_ROTATEDIR)) { | } | 
| /* rotate left */ | } else if (!(drawmng.scrnmode & SCRNMODE_ROTATEDIR)) { | 
| for (s = h = 0; h < r.right; h++) { | /* rotate left */ | 
| if ((renewal_line[h] != delta[h]) || (s == h)) | for (s = h = 0; h < r.right; h++) { | 
| continue; | if ((renewal_line[h] != delta[h]) || (s == h)) | 
|  | continue; | 
| gdk_draw_image(drawmng.backsurf, gc, drawmng.surface, |  | 
| s, 0, r.left + s, r.top, h - s, r.bottom); | gdk_draw_image(drawmng.backsurf, gc, drawmng.surface, | 
| s = h + 1; | s, 0, r.left + s, r.top, h - s, r.bottom); | 
| } | s = h + 1; | 
| if (s != h) { | } | 
| gdk_draw_image(drawmng.backsurf, gc, drawmng.surface, | if (s != h) { | 
| s, 0, r.left + s, r.top, h - s, r.bottom); | gdk_draw_image(drawmng.backsurf, gc, drawmng.surface, | 
| } | s, 0, r.left + s, r.top, h - s, r.bottom); | 
| } else { | } | 
| /* rotate right */ | } else { | 
| for (s = h = 0; h < r.right; h++) { | /* rotate right */ | 
| if ((renewal_line[h] != delta[h]) || (s == h)) | for (s = h = 0; h < r.right; h++) { | 
| continue; | if ((renewal_line[h] != delta[h]) || (s == h)) | 
|  | continue; | 
| gdk_draw_image(drawmng.backsurf, gc, drawmng.surface, |  | 
| r.right - h, 0, | gdk_draw_image(drawmng.backsurf, gc, drawmng.surface, | 
| drawmng.scrn.right - h, r.top, h - s, r.bottom); | r.right - h, 0, | 
| s = h + 1; | drawmng.scrn.right - h, r.top, h - s, r.bottom); | 
| } | s = h + 1; | 
| if (s != h) { | } | 
| gdk_draw_image(drawmng.backsurf, gc, drawmng.surface, | if (s != h) { | 
| r.right - h, 0, | gdk_draw_image(drawmng.backsurf, gc, drawmng.surface, | 
| drawmng.scrn.right - h, r.top, h - s, r.bottom); | r.right - h, 0, | 
|  | drawmng.scrn.right - h, r.top, h - s, r.bottom); | 
|  | } | 
 | } | } | 
 | } | } | 
 |  |  | 
 | scrnmng_update(); |  | 
 | } |  | 
 |  |  | 
 | void |  | 
 | scrnmng_update(void) |  | 
 | { |  | 
 | GdkDrawable *d = (GdkDrawable *)drawarea->window; |  | 
 | GtkWidget *w = drawarea; |  | 
 | GdkGC *gc = w->style->fg_gc[GTK_WIDGET_STATE(w)]; |  | 
 |  |  | 
 | if (scrnmng.palchanged) { | if (scrnmng.palchanged) { | 
 | scrnmng.palchanged = FALSE; | scrnmng.palchanged = FALSE; | 
 | palette_set(); | palette_set(); | 
| Line 550  scrnmng_update(void) | Line 545  scrnmng_update(void) | 
 | { | { | 
 | if (scrnmng.allflash) { | if (scrnmng.allflash) { | 
 | scrnmng.allflash = 0; | scrnmng.allflash = 0; | 
| clear_outscreen(); | if (np2oscfg.paddingx || np2oscfg.paddingy) { | 
|  | clear_outscreen(); | 
|  | } | 
 | } | } | 
 | gdk_draw_pixmap(d, gc, drawmng.backsurf, | gdk_draw_pixmap(d, gc, drawmng.backsurf, | 
| 0, 0, 0, 0, drawmng.scrw, drawmng.scrh); | 0, 0,                                       /* src */ | 
|  | drawmng.scrn.left, drawmng.scrn.top,        /* dest */ | 
|  | drawmng.rect.right, drawmng.rect.bottom);   /* w/h */ | 
 | } | } | 
 | } | } |