From ebb249cd477d37ea10c402fd39dccfbbda54b390 Mon Sep 17 00:00:00 2001 From: kichikuou Date: Sun, 4 Oct 2020 15:55:36 +0900 Subject: [PATCH] Remove 15bpp surface operations These were used only with X11 backend. --- modules/Gpx/effectcopy.c | 15 --- modules/NIGHTDLL/sactcg_stretch.c | 1 - modules/NightDemonDemo/jpeg2surface.c | 10 -- modules/SACT/sactcg_stretch.c | 1 - modules/SACT/sprite_eupdate_aff.c | 1 - modules/SACT/sprite_eupdate_perspect.c | 1 - modules/SACT/sprite_eupdate_uneune.c | 1 - modules/ShGraph/ShGraph.c | 34 ------- modules/lib/graph.c | 22 ----- modules/lib/graph2.c | 18 ---- modules/lib/graph_buller.c | 63 ------------ modules/lib/graph_cg.c | 32 ------ modules/lib/graph_copy_bright.c | 15 --- modules/lib/graph_copy_whiteout.c | 15 --- modules/lib/graph_expandcolor_blend.c | 16 --- modules/lib/graph_fillrect.c | 9 -- modules/lib/graph_fillrect_acolor.c | 14 --- modules/lib/graph_rect.c | 3 - modules/lib/graph_stretch.c | 1 - modules/lib/gre_blend.c | 16 --- modules/lib/gre_blend_screen.c | 16 --- modules/lib/gre_blend_useamap.c | 36 ------- modules/lib/surface.c | 5 +- src/ags.h | 21 +--- src/image.c | 132 ------------------------- 25 files changed, 3 insertions(+), 495 deletions(-) diff --git a/modules/Gpx/effectcopy.c b/modules/Gpx/effectcopy.c index fdfa1f6..79d81eb 100644 --- a/modules/Gpx/effectcopy.c +++ b/modules/Gpx/effectcopy.c @@ -169,21 +169,6 @@ void sf_blend_white_level(surface_t *dst, int dx, int dy, surface_t *src, int sx dp = GETOFFSET_PIXEL(dst, dx, dy); switch(dst->depth) { - case 15: - { - WORD *yls, *yld; - - for (y = 0; y < sh; y++) { - yls = (WORD *)(sp + y * src->bytes_per_line); - yld = (WORD *)(dp + y * dst->bytes_per_line); - - for (x = 0; x < sw; x++) { - *yld = WHITELEVEL15(*yls, lv); - yls++; yld++; - } - } - break; - } case 16: { WORD *yls, *yld; diff --git a/modules/NIGHTDLL/sactcg_stretch.c b/modules/NIGHTDLL/sactcg_stretch.c index 21e8849..78b18a2 100644 --- a/modules/NIGHTDLL/sactcg_stretch.c +++ b/modules/NIGHTDLL/sactcg_stretch.c @@ -76,7 +76,6 @@ static surface_t *stretch(surface_t *src, int dw, int dh, int mirror) { switch(dst->depth) { case 8: SCALEDCOPYAREA(BYTE); break; - case 15: case 16: SCALEDCOPYAREA(WORD); break; case 24: diff --git a/modules/NightDemonDemo/jpeg2surface.c b/modules/NightDemonDemo/jpeg2surface.c index 32de579..51d834a 100644 --- a/modules/NightDemonDemo/jpeg2surface.c +++ b/modules/NightDemonDemo/jpeg2surface.c @@ -37,16 +37,6 @@ static void ppm2surface(surface_t *sf, int curscanline, unsigned char *src, int BYTE *dp = GETOFFSET_PIXEL(sf, 0, curscanline); switch (sf->depth) { - case 15: - { - WORD *dst = (WORD *)dp; - while (width--) { - *dst = PIX15(*src, *(src +1), *(src +2)); - dst++; src+= 3; - } - break; - - } case 16: { WORD *dst = (WORD *)dp; diff --git a/modules/SACT/sactcg_stretch.c b/modules/SACT/sactcg_stretch.c index 21e8849..78b18a2 100644 --- a/modules/SACT/sactcg_stretch.c +++ b/modules/SACT/sactcg_stretch.c @@ -76,7 +76,6 @@ static surface_t *stretch(surface_t *src, int dw, int dh, int mirror) { switch(dst->depth) { case 8: SCALEDCOPYAREA(BYTE); break; - case 15: case 16: SCALEDCOPYAREA(WORD); break; case 24: diff --git a/modules/SACT/sprite_eupdate_aff.c b/modules/SACT/sprite_eupdate_aff.c index 43c8c9b..682403c 100644 --- a/modules/SACT/sprite_eupdate_aff.c +++ b/modules/SACT/sprite_eupdate_aff.c @@ -10,7 +10,6 @@ static void do_aff(surface_t *in, surface_t *out, int deg, double zx, double zy) int i, j, m, n; switch(in->depth) { - case 15: case 16: { WORD *src, *dst; diff --git a/modules/SACT/sprite_eupdate_perspect.c b/modules/SACT/sprite_eupdate_perspect.c index 265f545..172d289 100644 --- a/modules/SACT/sprite_eupdate_perspect.c +++ b/modules/SACT/sprite_eupdate_perspect.c @@ -44,7 +44,6 @@ static void do_per(surface_t *in, surface_t *out, float *k) { int ys = in->height /2; switch(in->depth) { - case 15: case 16: { WORD *src, *dst; diff --git a/modules/SACT/sprite_eupdate_uneune.c b/modules/SACT/sprite_eupdate_uneune.c index 04a08ee..f60b87d 100644 --- a/modules/SACT/sprite_eupdate_uneune.c +++ b/modules/SACT/sprite_eupdate_uneune.c @@ -4,7 +4,6 @@ static void uneune(surface_t *in, surface_t *out, int st) { int x, y, m, n; switch(in->depth) { - case 15: case 16: { WORD *src, *dst; for (y = 0; y < in->height; y++) { diff --git a/modules/ShGraph/ShGraph.c b/modules/ShGraph/ShGraph.c index b4c9567..5b8cf12 100644 --- a/modules/ShGraph/ShGraph.c +++ b/modules/ShGraph/ShGraph.c @@ -147,23 +147,6 @@ static void ChangeNotColor() { dp = GETOFFSET_PIXEL(dib, x0, y0); switch(dib->depth) { - case 15: - { - WORD pic15s = PIX15(*src, *(src+1), *(src+2)); - WORD pic15d = PIX15(*dst, *(dst+1), *(dst+2)); - WORD *yl; - - for (y = 0; y < height; y++) { - yl = (WORD *)(dp + y * dib->bytes_per_line); - for (x = 0; x < width; x++) { - if (*yl != pic15s) { - *yl = pic15d; - } - yl++; - } - } - break; - } case 16: { WORD pic16s = PIX16(*src, *(src+1), *(src+2)); @@ -586,23 +569,6 @@ static void copy_sprite(int sx, int sy, int width, int height, int dx, int dy, i dp = GETOFFSET_PIXEL(dib, dx, dy); switch(dib->depth) { - case 15: - { - WORD pic15 = PIX15(r, g, b); - WORD *yls, *yld; - - for (y = 0; y < height; y++) { - yls = (WORD *)(sp + y * dib->bytes_per_line); - yld = (WORD *)(dp + y * dib->bytes_per_line); - for (x = 0; x < width; x++) { - if (*yls != pic15) { - *yld = *yls; - } - yls++; yld++; - } - } - break; - } case 16: { WORD pic16 = PIX16(r, g, b); diff --git a/modules/lib/graph.c b/modules/lib/graph.c index a416643..4adc422 100644 --- a/modules/lib/graph.c +++ b/modules/lib/graph.c @@ -272,28 +272,6 @@ void gr_copy_stretch_blend_alpha_map(surface_t *dst, int dx, int dy, int dw, int } switch(dst->depth) { - case 15: - { - WORD *yls, *yld; - BYTE *yla; - - for (y = 0; y < dh; y++) { - yls = (WORD *)(sp + *(y + col) * src->bytes_per_line); - yld = (WORD *)(dp + y * dst->bytes_per_line); - yla = (BYTE *)(sa + *(y + col) * src->width); - for (x = 0; x < dw; x++) { - *(yld + x) = ALPHABLEND15(*(yls+ *(row + x)), *(yld+x), *(yla+*(row+x))); - } - while(*(col + y) == *(col + y + 1)) { - yld += dst->width; - for (x = 0; x < dw; x++) { - *(yld + x) = ALPHABLEND15(*(yls+ *(row+x)), *(yld+x), *(yla+*(row+x))); - } - y++; - } - } - break; - } case 16: { WORD *yls, *yld; diff --git a/modules/lib/graph2.c b/modules/lib/graph2.c index 6c3f2c3..cae2102 100644 --- a/modules/lib/graph2.c +++ b/modules/lib/graph2.c @@ -94,24 +94,6 @@ void gr_blend_alpha_wds(surface_t *src1, int sx1, int sy1, surface_t *src2, int dp = GETOFFSET_PIXEL(dst, dx, dy); switch(dst->depth) { - case 15: - { - WORD *yls1, *yls2, *yld; - BYTE *yla; - - for (y = 0; y < sh; y++) { - yls1 = (WORD *)(sp1 + y * src1->bytes_per_line); - yls2 = (WORD *)(sp2 + y * src2->bytes_per_line); - yld = (WORD *)(dp + y * dst->bytes_per_line); - yla = (BYTE *)(sa + y * src1->width); - - for (x = 0; x < sw; x++) { - *yld = SUTURADD15(*yls1, ALPHABLEND15(*yls1, *yls2, *yla)); - yls1++; yls2++; yld++; yla++; - } - } - break; - } case 16: // if (nact->mmx_is_ok) { if (0) { diff --git a/modules/lib/graph_buller.c b/modules/lib/graph_buller.c index 056b2be..0d65223 100644 --- a/modules/lib/graph_buller.c +++ b/modules/lib/graph_buller.c @@ -19,39 +19,6 @@ int gr_buller(surface_t *dst, int dx, int dy, surface_t *src, int sx, int sy, in sp = GETOFFSET_PIXEL(src, sx, sy); dp = GETOFFSET_PIXEL(dst, dx, dy); switch(dst->depth) { - case 15: - { - WORD *yld, *yls; - - for (y = 0; y < height; y++) { - yls = (WORD *)(sp + y * src->bytes_per_line); - yld = (WORD *)(dp + y * dst->bytes_per_line); - for (x = 0; x < step; x++) { - *yld = *(yls+step); - yls++; yld++; - } - - for (; x < (width - step*2); x++) { - r1 = PIXR15((*(yls+step))); - g1 = PIXG15((*(yls+step))); - b1 = PIXB15((*(yls+step))); - r2 = PIXR15((*(yls-step))); - g2 = PIXG15((*(yls-step))); - b2 = PIXB15((*(yls-step))); - r3 = min(255, (r1+r2) >> 1); - g3 = min(255, (g1+g2) >> 1); - b3 = min(255, (b1+b2) >> 1); - - *yld = PIX15(r3, g3, b3); - yld++; yls++; - } - for (; x < width; x++) { - *yld = *(yls-step); - yls++; yld++; - } - } - break; - } case 16: { WORD *yld, *yls; @@ -137,36 +104,6 @@ int gr_buller_v(surface_t *dst, int dx, int dy, surface_t *src, int sx, int sy, sp = GETOFFSET_PIXEL(src, sx, sy); dp = GETOFFSET_PIXEL(dst, dx, dy); switch(dst->depth) { - case 15: - { - WORD *yld, *yls; - - for (x = 0; x < width; x++) { - yls = (WORD *)(sp + x * src->bytes_per_pixel); - yld = (WORD *)(dp + x * dst->bytes_per_pixel); - for (y = 0; y < step; y++) { - *(yld+y*dst->width) = *(yls+(y+step)*src->width); - } - - for (; y < (height - step*2); y++) { - r1 = PIXR15((*(yls+(y+step)*src->width))); - g1 = PIXG15((*(yls+(y+step)*src->width))); - b1 = PIXB15((*(yls+(y+step)*src->width))); - r2 = PIXR15((*(yls+(y-step)*src->width))); - g2 = PIXG15((*(yls+(y-step)*src->width))); - b2 = PIXB15((*(yls+(y-step)*src->width))); - r3 = min(255, (r1+r2) >> 1); - g3 = min(255, (g1+g2) >> 1); - b3 = min(255, (b1+b2) >> 1); - - *(yld+y*dst->width) = PIX15(r3, g3, b3); - } - for (; y < height; y++) { - *(yld+y*dst->width) = *(yls+(y-step)*src->width); - } - } - break; - } case 16: { WORD *yld, *yls; diff --git a/modules/lib/graph_cg.c b/modules/lib/graph_cg.c index 32bf0c1..6e4a6cd 100644 --- a/modules/lib/graph_cg.c +++ b/modules/lib/graph_cg.c @@ -57,23 +57,6 @@ void gr_drawimage24(surface_t *ds, cgdata *cg, int x, int y) { dp = GETOFFSET_PIXEL(ds, dx, dy); switch(ds->depth) { - case 15: - { - WORD *yl; - - for (y = 0; y < dh; y++) { - yl = (WORD *)(dp + y * ds->bytes_per_line); - for (x = 0; x < dw; x++) { - r = *sp; - g = *(sp +1); - b = *(sp +2); - *yl = PIX15(r, g, b); - yl++; sp += 3; - } - sp += ((cg->width - dw) * 3); - } - break; - } case 16: { WORD *yl; @@ -138,21 +121,6 @@ void gr_drawimage16(surface_t *ds, cgdata *cg, int x, int y) { dp = GETOFFSET_PIXEL(ds, dx, dy); switch(ds->depth) { - case 15: - { - WORD *yl; - - for (y = 0; y < dh; y++) { - yl = (WORD *)(dp + y * ds->bytes_per_line); - for (x = 0; x < dw; x++) { - pic16 = *sp; - *yl = PIX15(PIXR16(pic16), PIXG16(pic16), PIXB16(pic16)); - yl++; sp ++; - } - sp += (cg->width - dw); - } - break; - } case 16: { for (y = 0; y < dh; y++) { diff --git a/modules/lib/graph_copy_bright.c b/modules/lib/graph_copy_bright.c index 7d92fe5..f79c7c6 100644 --- a/modules/lib/graph_copy_bright.c +++ b/modules/lib/graph_copy_bright.c @@ -19,21 +19,6 @@ void gr_copy_bright(surface_t *dst, int dx, int dy, surface_t *src, int sx, int if (sp == NULL || dp == NULL) return; switch(dst->depth) { - case 15: - { - WORD *yls, *yld; - - for (y = 0; y < height; y++) { - yls = (WORD *)(sp + y * src->bytes_per_line); - yld = (WORD *)(dp + y * dst->bytes_per_line); - - for (x = 0; x < width; x++) { - *yld = ALPHALEVEL15(*yls, lv); - yls++; yld++; - } - } - break; - } case 16: if (nact->mmx_is_ok) { // if (0) { diff --git a/modules/lib/graph_copy_whiteout.c b/modules/lib/graph_copy_whiteout.c index 173702c..20241af 100644 --- a/modules/lib/graph_copy_whiteout.c +++ b/modules/lib/graph_copy_whiteout.c @@ -20,21 +20,6 @@ void gr_copy_whiteout(surface_t *dst, int dx, int dy, surface_t *src, int sx, in if (sp == NULL || dp == NULL) return; switch(dst->depth) { - case 15: - { - WORD *yls, *yld; - - for (y = 0; y < sh; y++) { - yls = (WORD *)(sp + y * src->bytes_per_line); - yld = (WORD *)(dp + y * dst->bytes_per_line); - - for (x = 0; x < sw; x++) { - *yld = WHITELEVEL15(*yls, lv); - yls++; yld++; - } - } - break; - } case 16: { WORD *yls, *yld; diff --git a/modules/lib/graph_expandcolor_blend.c b/modules/lib/graph_expandcolor_blend.c index 0266e9e..ebf6ae4 100644 --- a/modules/lib/graph_expandcolor_blend.c +++ b/modules/lib/graph_expandcolor_blend.c @@ -19,22 +19,6 @@ int gr_expandcolor_blend(surface_t *dst, int dx, int dy, surface_t *src, int sx, dp = GETOFFSET_PIXEL(dst, dx, dy); switch(dst->depth) { - case 15: { - WORD *yd; - BYTE *ys; - col = PIX15(r, g, b); - for (y = 0; y < sh; y++) { - ys = (BYTE *)(sp + y * src->bytes_per_line); - yd = (WORD *)(dp + y * dst->bytes_per_line); - for (x = 0; x < sw; x++) { - if (*ys) { - *yd = ALPHABLEND15(col, *yd, (BYTE)*ys); - } - ys++; yd++; - } - } - break; - } case 16: col = PIX16(r, g, b); //if (nact->mmx_is_ok) { diff --git a/modules/lib/graph_fillrect.c b/modules/lib/graph_fillrect.c index 64a1955..cd54661 100644 --- a/modules/lib/graph_fillrect.c +++ b/modules/lib/graph_fillrect.c @@ -21,15 +21,6 @@ int gr_fill(surface_t *dst, int dx, int dy, int dw, int dh, int r, int g, int b) memset(dp, r, dw); break; - case 15: - { - WORD pic15 = PIX15(r, g, b); - - for (x = 0; x < dw; x++) { - *((WORD *)dp + x) = pic15; - } - break; - } case 16: { WORD pic16 = PIX16(r, g, b); diff --git a/modules/lib/graph_fillrect_acolor.c b/modules/lib/graph_fillrect_acolor.c index 25e5ce3..dcd1fe4 100644 --- a/modules/lib/graph_fillrect_acolor.c +++ b/modules/lib/graph_fillrect_acolor.c @@ -18,20 +18,6 @@ int gr_fill_alpha_color(surface_t *dst, int dx, int dy, int dw, int dh, int r, i dp = GETOFFSET_PIXEL(dst, dx, dy); switch(dst->depth) { - case 15: - { - WORD pic15 = PIX15(r, g, b); - WORD *yls; - - for (y = 0; y < dh; y++) { - yls = (WORD *)(dp + y * dst->bytes_per_line); - for (x = 0; x < dw; x++) { - *yls = ALPHABLEND15(pic15, *yls, lv); - yls++; - } - } - break; - } case 16: if (nact->mmx_is_ok) { #ifdef ENABLE_MMX diff --git a/modules/lib/graph_rect.c b/modules/lib/graph_rect.c index dbf6312..1c035d2 100644 --- a/modules/lib/graph_rect.c +++ b/modules/lib/graph_rect.c @@ -19,8 +19,6 @@ int gr_drawrect(surface_t *dst, int x, int y, int w, int h, int r, int g, int b) switch(dst->depth) { case 8: col = r; break; - case 15: - col = PIX15(r, g, b); break; case 16: col = PIX16(r, g, b); break; case 24: @@ -49,7 +47,6 @@ int gr_drawrect(surface_t *dst, int x, int y, int w, int h, int r, int g, int b) *((BYTE *)dp + i) = col; } break; - case 15: case 16: /* top */ for (i = 0; i < w; i++) { diff --git a/modules/lib/graph_stretch.c b/modules/lib/graph_stretch.c index d529838..5a1cded 100644 --- a/modules/lib/graph_stretch.c +++ b/modules/lib/graph_stretch.c @@ -38,7 +38,6 @@ void gr_copy_stretch(surface_t *dst, int dx, int dy, int dw, int dh, surface_t * } switch(dst->depth) { - case 15: case 16: { WORD *yls, *yld; diff --git a/modules/lib/gre_blend.c b/modules/lib/gre_blend.c index 27957bc..d8d1788 100644 --- a/modules/lib/gre_blend.c +++ b/modules/lib/gre_blend.c @@ -16,22 +16,6 @@ int gre_Blend(surface_t *write, int wx, int wy, surface_t *dst, int dx, int dy, dp = GETOFFSET_PIXEL(dst, dx, dy); switch(dst->depth) { - case 15: - { - WORD *yls, *yld, *ylw; - - for (y = 0; y < height; y++) { - yls = (WORD *)(sp + y * src->bytes_per_line); - yld = (WORD *)(dp + y * dst->bytes_per_line); - ylw = (WORD *)(wp + y * write->bytes_per_line); - - for (x = 0; x < width; x++) { - *ylw = ALPHABLEND15(*yls, *yld, lv); - yls++; yld++; ylw++; - } - } - break; - } case 16: if (nact->mmx_is_ok) { // if (0) { diff --git a/modules/lib/gre_blend_screen.c b/modules/lib/gre_blend_screen.c index 7ca5fdc..9d22b10 100644 --- a/modules/lib/gre_blend_screen.c +++ b/modules/lib/gre_blend_screen.c @@ -15,22 +15,6 @@ int gre_BlendScreen(surface_t *write, int wx, int wy, surface_t *dst, int dx, in dp = GETOFFSET_PIXEL(dst, dx, dy); switch(dst->depth) { - case 15: - { - WORD *yls, *yld, *ylw; - - for (y = 0; y < height; y++) { - yls = (WORD *)(sp + y * src->bytes_per_line); - yld = (WORD *)(dp + y * dst->bytes_per_line); - ylw = (WORD *)(wp + y * write->bytes_per_line); - - for (x = 0; x < width; x++) { - *ylw = SUTURADD15(*yls, *yld); - yls++; yld++; ylw++; - } - } - break; - } case 16: { WORD *yls, *yld, *ylw; diff --git a/modules/lib/gre_blend_useamap.c b/modules/lib/gre_blend_useamap.c index 3a7a522..b51fb2d 100644 --- a/modules/lib/gre_blend_useamap.c +++ b/modules/lib/gre_blend_useamap.c @@ -19,24 +19,6 @@ int gre_BlendUseAMap(surface_t *write, int wx, int wy, surface_t *dst, int dx, i if (lv == 255) { switch(dst->depth) { - case 15: - { - WORD *yls, *yld, *ylw; - BYTE *yla; - - for (y = 0; y < height; y++) { - yls = (WORD *)(sp + y * src->bytes_per_line); - yld = (WORD *)(dp + y * dst->bytes_per_line); - ylw = (WORD *)(wp + y * write->bytes_per_line); - yla = (BYTE *)(ap + y * alpha->width); - - for (x = 0; x < width; x++) { - *ylw = ALPHABLEND15(*yls, *yld, *yla); - yls++; yld++; ylw++; yla++; - } - } - break; - } case 16: if (nact->mmx_is_ok) { // if (0) { @@ -88,24 +70,6 @@ int gre_BlendUseAMap(surface_t *write, int wx, int wy, surface_t *dst, int dx, i } else { switch(dst->depth) { - case 15: - { - WORD *yls, *yld, *ylw; - BYTE *yla; - - for (y = 0; y < height; y++) { - yls = (WORD *)(sp + y * src->bytes_per_line); - yld = (WORD *)(dp + y * dst->bytes_per_line); - ylw = (WORD *)(wp + y * write->bytes_per_line); - yla = (BYTE *)(ap + y * alpha->width); - - for (x = 0; x < width; x++) { - *ylw = ALPHABLEND15(*yls, *yld, (*yla * lv) / 255); - yls++; yld++; ylw++; yla++; - } - } - break; - } case 16: if (nact->mmx_is_ok) { // if (0) { diff --git a/modules/lib/surface.c b/modules/lib/surface.c index 487080a..7d35037 100644 --- a/modules/lib/surface.c +++ b/modules/lib/surface.c @@ -25,7 +25,6 @@ static surface_t *create(int width, int height, int depth, boolean has_pixel, bo s->bytes_per_line = width; s->bytes_per_pixel = 1; break; - case 15: case 16: s->pixel = calloc(width * (height +1) * 2, sizeof(BYTE)); s->bytes_per_line = width * 2; @@ -53,7 +52,7 @@ static surface_t *create(int width, int height, int depth, boolean has_pixel, bo * surfaceの生成 (pixel + alpha) * @param width: surfaceの幅 * @param height: surfaceの高さ - * @param depth: surfaceのpixelのBPP (8|15|16|24|32), alphaは8固定 + * @param depth: surfaceのpixelのBPP (8|16|24|32), alphaは8固定 * @return 生成した surface オブジェクト */ surface_t *sf_create_surface(int width, int height, int depth) { @@ -74,7 +73,7 @@ surface_t *sf_create_alpha(int width, int height) { * surfaceの生成 (pixelのみ) * @param width: surfaceの幅 * @param height: surfaceの高さ - * @param depth: surfaceのBPP(8|15|16|24|32) + * @param depth: surfaceのBPP(8|16|24|32) * @return 生成した surface オブジェクト */ surface_t *sf_create_pixel(int width, int height, int depth) { diff --git a/src/ags.h b/src/ags.h index 6e72ddf..f94c07e 100644 --- a/src/ags.h +++ b/src/ags.h @@ -62,7 +62,7 @@ typedef enum { struct agsurface { int width; /* width of surface */ int height; /* height of surface */ - int depth; /* depth of surface, 8/15/16/24/32 is available */ + int depth; /* depth of surface, 8/16/24/32 is available */ int bytes_per_line; /* bytes per line */ int bytes_per_pixel; /* bytes per pixel */ @@ -232,9 +232,6 @@ extern boolean ags_getAntialiasedStringMode(); extern void ags_fader(ags_faderinfo_t *); extern void ags_autorepeat(boolean bool); -#define RMASK15 0x7c00 -#define GMASK15 0x03e0 -#define BMASK15 0x001f #define RMASK16 0xf800 #define GMASK16 0x07e0 #define BMASK16 0x001f @@ -242,11 +239,6 @@ extern void ags_autorepeat(boolean bool); #define GMASK24 0x0000ff00 #define BMASK24 0x000000ff -#define PIXR15(pic) (BYTE)(((pic) & RMASK15) >> 7) -#define PIXG15(pic) (BYTE)(((pic) & GMASK15) >> 2) -#define PIXB15(pic) (BYTE)(((pic) & BMASK15) << 3) -#define PIX15(r,g,b) (WORD)((((r) & 0xf8) << 7) | (((g) & 0xf8) << 2) | ((b ) >> 3)) - #define PIXR16(pic) (BYTE)(((pic) & RMASK16) >> 8) #define PIXG16(pic) (BYTE)(((pic) & GMASK16) >> 3) #define PIXB16(pic) (BYTE)(((pic) & BMASK16) << 3) @@ -257,16 +249,6 @@ extern void ags_autorepeat(boolean bool); #define PIXB24(pic) (BYTE)(((pic) & BMASK24) ) #define PIX24(r,g,b) (DWORD)((((r) << 16) | ((g) << 8) | (b) )) -#define ALPHABLEND15(f, b, a) (PIX15((((PIXR15((f)) - PIXR15((b))) * (a)) >> 8) + PIXR15((b)),\ - (((PIXG15((f)) - PIXG15((b))) * (a)) >> 8) + PIXG15((b)),\ - (((PIXB15((f)) - PIXB15((b))) * (a)) >> 8) + PIXB15((b)))) - -#define ALPHALEVEL15(p, lv) (PIX15(((PIXR15(p) * (lv)) >> 8),\ - ((PIXG15(p) * (lv)) >> 8),\ - ((PIXB15(p) * (lv)) >> 8))) - -#define WHITELEVEL15(p, lv) ALPHABLEND15(0x7fff, p, lv) - #define ALPHABLEND16(f, b, a) (PIX16((((PIXR16((f)) - PIXR16((b))) * (a)) >> 8)+ PIXR16((b)),\ (((PIXG16((f)) - PIXG16((b))) * (a)) >> 8)+ PIXG16((b)),\ (((PIXB16((f)) - PIXB16((b))) * (a)) >> 8)+ PIXB16((b)))) @@ -287,7 +269,6 @@ extern void ags_autorepeat(boolean bool); #define WHITELEVEL24(p, lv) ALPHABLEND24(0xffffffff, p, lv) -#define SUTURADD15(pa, pb) PIX15(min(255,PIXR15(pa)+PIXR15(pb)), min(255, PIXG15(pa)+PIXG15(pb)), min(255, PIXB15(pa)+PIXB15(pb))); #define SUTURADD16(pa, pb) PIX16(min(255,PIXR16(pa)+PIXR16(pb)), min(255, PIXG16(pa)+PIXG16(pb)), min(255, PIXB16(pa)+PIXB16(pb))); //#define SUTURADD16(pa, pb) PIX16(min(255,(int)(PIXR16(pa))+(int)(PIXR16(pb))), min(255, (int)(PIXG16(pa))+(int)(PIXG16(pb))), min(255, (int)(PIXB16(pa))+(int)(PIXB16(pb)))); #define SUTURADD24(pa, pb) PIX24(min(255,PIXR24(pa)+PIXR24(pb)), min(255, PIXG24(pa)+PIXG24(pb)), min(255, PIXB24(pa)+PIXB24(pb))); diff --git a/src/image.c b/src/image.c index c0a555c..bc5c0cb 100644 --- a/src/image.c +++ b/src/image.c @@ -134,132 +134,6 @@ static void image_fillRectangle8(agsurface_t *dib, int x, int y, int w, int h, i } } -/******************************************************************************/ -/* private methods image操作 15bpp */ -/******************************************************************************/ - -static void image_copy_from_alpha15(agsurface_t *dib, BYTE *sdata, BYTE *ddata, int w, int h, ALPHA_DIB_COPY_TYPE flag) { - int x, y; - BYTE *yls; - WORD *yld; - - switch(flag) { - case TO_16H: - for (y = 0; y < h; y++) { - yls = (BYTE *)(sdata + y * dib->width); - yld = (WORD *)(ddata + y * dib->bytes_per_line); - for (x = 0; x < w; x++) { - /* *yld = */ - yld++; yls++; - } - } - break; - case TO_16L: - for (y = 0; y < h; y++) { - yls = (BYTE *)(sdata + y * dib->width); - yld = (WORD *)(ddata + y * dib->bytes_per_line); - for (x = 0; x < w; x++) { - /* *yld = (WORD)(*yls) | (*yld & 0xff00); */ - yld++; yls++; - } - } - break; - case TO_24R: - for (y = 0; y < h; y++) { - yls = (BYTE *)(sdata + y * dib->width); - yld = (WORD *)(ddata + y * dib->bytes_per_line); - for (x = 0; x < w; x++) { - *yld = PIX15(*yls, PIXG15(*yld), PIXB15(*yld)); - yld++; yls++; - } - } - break; - case TO_24G: - for (y = 0; y < h; y++) { - yls = (BYTE *)(sdata + y * dib->width); - yld = (WORD *)(ddata + y * dib->bytes_per_line); - for (x = 0; x < w; x++) { - *yld = PIX15(PIXR15(*yls), *yls, PIXB15(*yld)); - yld++; yls++; - } - } - break; - case TO_24B: - for (y = 0; y < h; y++) { - yls = (BYTE *)(sdata + y * dib->width); - yld = (WORD *)(ddata + y * dib->bytes_per_line); - for (x = 0; x < w; x++) { - *yld = PIX15(PIXR15(*yld), PIXG15(*yld), *yls); - yld++; yls++; - } - } - break; - default: - break; - } -} - -static void image_copy_to_alpha15(agsurface_t *dib, BYTE *sdata, BYTE *ddata, int w, int h, ALPHA_DIB_COPY_TYPE flag) { - int x, y; - BYTE *yld; - WORD *yls; - - switch(flag) { - case FROM_16H: - for (y = 0; y < h; y++) { - yls = (WORD *)(sdata + y * dib->bytes_per_line); - yld = (BYTE *)(ddata + y * dib->width); - for (x = 0; x < w; x++) { - *yld = (BYTE)(PIX16(PIXR15(*yls), PIXG15(*yls), PIXB15(*yls)) >> 8); - yld++; yls++; - } - } - break; - case FROM_16L: - for (y = 0; y < h; y++) { - yls = (WORD *)(sdata + y * dib->bytes_per_line); - yld = (BYTE *)(ddata + y * dib->width); - for (x = 0; x < w; x++) { - *yld = (BYTE)(PIX16(PIXR15(*yls), PIXG15(*yls), PIXB15(*yls))); - yld++; yls++; - } - } - break; - case FROM_24R: - for (y = 0; y < h; y++) { - yls = (WORD *)(sdata + y * dib->bytes_per_line); - yld = (BYTE *)(ddata + y * dib->width); - for (x = 0; x < w; x++) { - *yld = (BYTE)PIXR15(*yls); - yld++; yls++; - } - } - break; - case FROM_24G: - for (y = 0; y < h; y++) { - yls = (WORD *)(sdata + y * dib->bytes_per_line); - yld = (BYTE *)(ddata + y * dib->width); - for (x = 0; x < w; x++) { - *yld = (BYTE)PIXG15(*yls); - yld++; yls++; - } - } - break; - case FROM_24B: - for (y = 0; y < h; y++) { - yls = (WORD *)(sdata + y * dib->bytes_per_line); - yld = (BYTE *)(ddata + y * dib->width); - for (x = 0; x < w; x++) { - *yld = (BYTE)PIXB15(*yls); - yld++; yls++; - } - } - break; - default: - break; - } -} - /******************************************************************************/ /* private methods image操作 16bpp */ /******************************************************************************/ @@ -817,12 +691,6 @@ void image_setdepth(int depth) { draw_line = image_drawLine8; fill_rectangle = image_fillRectangle8; break; - case 15: - draw_line = image_drawLine16; - fill_rectangle = image_fillRectangle16; - copy_from_alpha = image_copy_from_alpha15; - copy_to_alpha = image_copy_to_alpha15; - break; case 16: draw_line = image_drawLine16; fill_rectangle = image_fillRectangle16;