summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2009-12-29 12:32:52 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2009-12-29 12:32:52 +0000
commitdfc3faf3fdf331e806cf43971c2251e65111f065 (patch)
tree92b0c7d06db93e1584b7485872e8bb70b3023abd
parent9da0b48712c7878a83a479959e5403af6d12e043 (diff)
downloadlibnsfb-dfc3faf3fdf331e806cf43971c2251e65111f065.tar.gz
libnsfb-dfc3faf3fdf331e806cf43971c2251e65111f065.tar.bz2
Move clipping check out of conditional bit in line plotter.
svn path=/trunk/libnsfb/; revision=9766
-rw-r--r--src/32bpp_plotters.c38
1 files changed, 18 insertions, 20 deletions
diff --git a/src/32bpp_plotters.c b/src/32bpp_plotters.c
index 232a000..daa8598 100644
--- a/src/32bpp_plotters.c
+++ b/src/32bpp_plotters.c
@@ -51,12 +51,12 @@ static inline uint32_t colour_to_pixel(nsfb_colour_t c)
#define SIGN(x) ((x<0) ? -1 : ((x>0) ? 1 : 0))
-static bool
-line(nsfb_t *nsfb,
- nsfb_bbox_t *line,
- int line_width,
- nsfb_colour_t c,
- bool dotted,
+static bool
+line(nsfb_t *nsfb,
+ nsfb_bbox_t *line,
+ int line_width,
+ nsfb_colour_t c,
+ bool dotted,
bool dashed)
{
int w;
@@ -72,22 +72,20 @@ line(nsfb_t *nsfb,
ent = colour_to_pixel(c);
+ if (!nsfb_plot_clip_ctx(nsfb, line))
+ return true; /* line outside clipping */
+
if (line->y0 == line->y1) {
/* horizontal line special cased */
- if (!nsfb_plot_clip_ctx(nsfb, line))
- return true; /* line outside clipping */
-
pvideo = get_xy_loc(nsfb, line->x0, line->y0);
w = line->x1 - line->x0;
- while (w-- > 0)
+ while (w-- > 0)
*(pvideo + w) = ent;
-
+
return true;
} else {
/* standard bresenham line */
- if (!nsfb_plot_clip_line_ctx(nsfb, line))
- return true; /* line outside clipping */
/* the horizontal distance of the line */
dx = line->x1 - line->x0;
@@ -195,10 +193,10 @@ static bool point(nsfb_t *nsfb, int x, int y, nsfb_colour_t c)
uint32_t *pvideo;
/* check point lies within clipping region */
- if ((x < nsfb->clip.x0) ||
+ if ((x < nsfb->clip.x0) ||
(x >= nsfb->clip.x1) ||
(y < nsfb->clip.y0) ||
- (y >= nsfb->clip.y1))
+ (y >= nsfb->clip.y1))
return true;
pvideo = get_xy_loc(nsfb, x, y);
@@ -320,12 +318,12 @@ glyph8(nsfb_t *nsfb,
return true;
}
-static bool
+static bool
bitmap(nsfb_t *nsfb,
const nsfb_bbox_t *loc,
- const nsfb_colour_t *pixel,
- int bmp_width,
- int bmp_height,
+ const nsfb_colour_t *pixel,
+ int bmp_width,
+ int bmp_height,
int bmp_stride,
bool alpha)
{
@@ -404,7 +402,7 @@ static bool readrect(nsfb_t *nsfb, nsfb_bbox_t *rect, nsfb_colour_t *buffer)
{
uint32_t *pvideo;
int xloop, yloop;
- int width;
+ int width;
if (!nsfb_plot_clip_ctx(nsfb, rect)) {
return true;