gfx.h 1.0 KB

12345678910111213141516171819202122232425
  1. /* Window-local RGB565 canvas + blit into the VGA shadow buffer. */
  2. #ifndef GFX_H
  3. #define GFX_H
  4. struct gfx_canvas {
  5. unsigned short *px; /* w*h RGB565, page-aligned; NULL = none */
  6. unsigned int w, h;
  7. unsigned int seq; /* frames the owner has presented */
  8. unsigned int drawn; /* last seq the WM composited (catch-up safe) */
  9. };
  10. /* Allocate a canvas of w*h pixels (zeroed; fresh memory is not). Returns 0/-1. */
  11. int gfx_alloc(struct gfx_canvas *c, unsigned int w, unsigned int h);
  12. void gfx_free(struct gfx_canvas *c);
  13. /* Copy the canvas into the shadow buffer at pixel origin (x0, y0), converting
  14. * RGB565 to the mode's 16/24/32 bpp, and mark the affected rows dirty. */
  15. void gfx_blit(const struct gfx_canvas *c, unsigned int x0, unsigned int y0);
  16. /* Same, but only the part whose destination bounds intersect the clip rect
  17. * (cx, cy, cw, ch) - used to restore window slivers. */
  18. void gfx_blit_clip(const struct gfx_canvas *c, unsigned int x0, unsigned int y0,
  19. unsigned int cx, unsigned int cy, unsigned int cw, unsigned int ch);
  20. #endif