Changeset 41157 for trunk/Ohana/src/kapa2/src/Refresh.c
- Timestamp:
- Nov 27, 2019, 11:00:17 AM (7 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/kapa2/src/Refresh.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/kapa2/src/Refresh.c
r36833 r41157 1 1 # include "Ximage.h" 2 2 3 # define USE_BUFFERED_DRAW 1 4 5 void bDrawXimage (bDrawBuffer *buffer); 6 void Refresh_Buffered (void); 7 void Refresh_Unbuffered (void); 8 3 9 void Refresh (void) { 10 if (USE_BUFFERED_DRAW) { 11 Refresh_Buffered(); 12 } else { 13 Refresh_Unbuffered(); 14 } 15 } 16 17 void Refresh_Buffered (void) { 18 19 int Npalette; 20 Graphic *graphic; 21 22 if (!USE_XWINDOW) return; 23 // if (HAVE_BACKING) return; 24 25 graphic = GetGraphic(); 26 27 // limit the png window to the min needed to contain the active graphic regions 28 SectionMinBoundary (graphic); 29 30 // is the palette reasonable in modern context? 31 png_color *palette = KapaPNGPalette (&Npalette); 32 33 bDrawBuffer *buffer = bDrawIt (palette, Npalette, 3); 34 35 /* XClearWindow (graphic.display, graphic.window); */ 36 XSetForeground (graphic->display, graphic->gc, graphic->back); 37 XFillRectangle (graphic->display, graphic->window, graphic->gc, 0, 0, graphic->dx, graphic->dy); 38 XSetForeground (graphic->display, graphic->gc, graphic->fore); 39 40 // copy buffer to Xwindow as image? 41 bDrawXimage (buffer); 42 bDrawBufferFree (buffer); 43 free (palette); 44 45 // draw image tool for all sections 46 int Nsection = GetNumberOfSections (); 47 for (int i = 0; i < Nsection; i++) { 48 Section *section = GetSectionByNumber (i); 49 50 KapaImageWidget *image = section->image; 51 DrawImageTool (image); 52 53 /*** PaintOverlay is called in DrawImage *** 54 if (!image) continue; 55 for (int j = 0; j < NOVERLAYS; j++) { 56 if (image[0].overlay[j].active) { 57 PaintOverlay (graphic, image, j); 58 } 59 } 60 */ 61 } 62 63 FlushDisplay (); 64 } 65 66 void Refresh_Unbuffered (void) { 4 67 5 68 int i, Nsection; … … 20 83 Nsection = GetNumberOfSections (); 21 84 for (i = 0; i < Nsection; i++) { 22 section = GetSectionByNumber (i); 23 DrawSectionBG (graphic, section); 24 DrawImage (section->image); 25 DrawGraph (section->graph); 85 section = GetSectionByNumber (i); 86 DrawSectionBG (graphic, section); 87 88 KapaImageWidget *image = section->image; 89 DrawImage (image); 90 DrawImageTool (image); 91 92 /*** the overlay is added in DrawImage ***/ 93 if (image) { 94 for (int j = 0; j < NOVERLAYS; j++) { 95 if (image[0].overlay[j].active) { 96 PaintOverlay (graphic, image, j); 97 } 98 } 99 } 100 101 DrawGraph (section->graph); 26 102 } 27 103
Note:
See TracChangeset
for help on using the changeset viewer.
