Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. /*
  2.  * Copyright 2009 Vincent Sanders <vince@simtec.co.uk>
  3.  * Copyright 2010 Michael Drake <tlsa@netsurf-browser.org>
  4.  *
  5.  * This file is part of libnsfb, http://www.netsurf-browser.org/
  6.  * Licenced under the MIT License,
  7.  *                http://www.opensource.org/licenses/mit-license.php
  8.  */
  9.  
  10. #include "common.c"
  11. #include <menuet/os.h>
  12.  
  13. static bool fill(nsfb_t *nsfb, nsfb_bbox_t *rect, nsfb_colour_t c)
  14. {
  15.         int w;
  16.         uint32_t *pvid;
  17.         uint32_t ent;
  18.         uint32_t llen;
  19.         uint32_t width;
  20.         uint32_t height;
  21.                
  22.                 __menuet__debug_out("nsfb fill:in\n");
  23.         if (!nsfb_plot_clip_ctx(nsfb, rect))
  24.                 return true; /* fill lies outside current clipping region */
  25.  
  26.         ent = colour_to_pixel(nsfb, c);
  27.         width = rect->x1 - rect->x0;
  28.         height = rect->y1 - rect->y0;
  29.         llen = (nsfb->linelen >> 2) - width;
  30.  
  31.         pvid = get_xy_loc(nsfb, rect->x0, rect->y0);
  32.  
  33.         __menuet__debug_out("nsfb fill:loooop\n");
  34.         while (height-- > 0) {
  35.                 w = width;
  36.                 while (w >= 16) {
  37.                        *pvid++ = ent; *pvid++ = ent;
  38.                        *pvid++ = ent; *pvid++ = ent;
  39.                        *pvid++ = ent; *pvid++ = ent;
  40.                        *pvid++ = ent; *pvid++ = ent;
  41.                        *pvid++ = ent; *pvid++ = ent;
  42.                        *pvid++ = ent; *pvid++ = ent;
  43.                        *pvid++ = ent; *pvid++ = ent;
  44.                        *pvid++ = ent; *pvid++ = ent;
  45.                        w-=16;
  46.                 }
  47.                 while (w >= 4) {
  48.                        *pvid++ = ent; *pvid++ = ent;
  49.                        *pvid++ = ent; *pvid++ = ent;
  50.                        w-=4;
  51.                 }
  52.                 while (w > 0) {
  53.                        *pvid++ = ent;
  54.                        w--;
  55.                 }
  56.                 pvid += llen;
  57.         }
  58.  
  59.         __menuet__debug_out("nsfb fill:finish\n");
  60.         return true;
  61. }
  62.  
  63. /*
  64.  * Local Variables:
  65.  * c-basic-offset:8
  66.  * End:
  67.  */
  68.