projects
/
dosdemo
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed warnings
[dosdemo]
/
src
/
gfxutil.c
diff --git
a/src/gfxutil.c
b/src/gfxutil.c
index
cb51780
..
37eb4c5
100644
(file)
--- a/
src/gfxutil.c
+++ b/
src/gfxutil.c
@@
-149,20
+149,21
@@
void draw_line(int x0, int y0, int x1, int y1, unsigned short color)
int sum = sptr[0] * (rad + 1); \
int count = (rad * 2 + 1) << 8; \
int midsize = w - rad * 2; \
int sum = sptr[0] * (rad + 1); \
int count = (rad * 2 + 1) << 8; \
int midsize = w - rad * 2; \
+ int firstpix = sptr[0]; \
int lastpix = sptr[pstep * (w - 1)]; \
/* add up the contributions for the -1 pixel */ \
for(j=0; j<rad; j++) { \
sum += sptr[pstep * j]; \
} \
/* first part adding sptr[rad] and subtracting sptr[0] */ \
int lastpix = sptr[pstep * (w - 1)]; \
/* add up the contributions for the -1 pixel */ \
for(j=0; j<rad; j++) { \
sum += sptr[pstep * j]; \
} \
/* first part adding sptr[rad] and subtracting sptr[0] */ \
- for(j=0; j<rad + 1; j++) { \
- sum += (int)sptr[pstep * rad] - (int)sptr[0]; \
+ for(j=0; j<=rad; j++) { \
+ sum += (int)sptr[pstep * rad] - firstpix; \
sptr += pstep; \
*dptr = scale * sum / count; \
dptr += pstep; \
} \
/* middle part adding sptr[rad] and subtracting sptr[-(rad+1)] */ \
sptr += pstep; \
*dptr = scale * sum / count; \
dptr += pstep; \
} \
/* middle part adding sptr[rad] and subtracting sptr[-(rad+1)] */ \
- for(j=0; j<midsize - 1; j++) { \
+ for(j=1; j<midsize; j++) { \
sum += (int)sptr[pstep * rad] - (int)sptr[-(rad + 1) * pstep]; \
sptr += pstep; \
*dptr = scale * sum / count; \
sum += (int)sptr[pstep * rad] - (int)sptr[-(rad + 1) * pstep]; \
sptr += pstep; \
*dptr = scale * sum / count; \
@@
-201,3
+202,16
@@
void blur_grey_vert(uint16_t *dest, uint16_t *src, int xsz, int ysz, int rad, in
BLUR(ysz, xsz, pixel_step, scanline_step);
}
BLUR(ysz, xsz, pixel_step, scanline_step);
}
+
+void convimg_rgb24_rgb16(uint16_t *dest, unsigned char *src, int xsz, int ysz)
+{
+ int i;
+ int npixels = xsz * ysz;
+
+ for(i=0; i<npixels; i++) {
+ int r = *src++;
+ int g = *src++;
+ int b = *src++;
+ *dest++ = PACK_RGB16(r, g, b);
+ }
+}