summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Fred <fredrik.sandq@gmail.com>2025-02-18 19:54:36 +0100
committer GitHub <noreply@github.com>2025-02-19 05:54:36 +1100
commit3333c7526256a25b92999e542e8e087b8b1dea78 (patch)
tree8fe3042a7a7ab22fffdeff2b628a085cfa3143e7
parent86c41357f29c302e4b6ce40b6daca9394e5e2d75 (diff)
video/k053936.cpp: Corrected source/destination parameter order to alpha blending function. (#13380)
Also moved blending tests inside the loop.
-rw-r--r--src/devices/video/k053936.cpp109
1 files changed, 31 insertions, 78 deletions
diff --git a/src/devices/video/k053936.cpp b/src/devices/video/k053936.cpp
index c9900430b53..0464ab5f933 100644
--- a/src/devices/video/k053936.cpp
+++ b/src/devices/video/k053936.cpp
@@ -605,95 +605,48 @@ static inline void K053936GP_copyroz32clip( running_machine &machine,
cy = starty;
cx = startx;
- if (blend > 0)
- {
- dst_ptr += dst_pitch; // draw blended
- starty += incyy;
- startx += incyx;
+ dst_ptr += dst_pitch;
+ starty += incyy;
+ startx += incyx;
+ do {
do {
- do {
- int srcx = (cx >> 16) & 0x1fff;
- int srcy = (cy >> 16) & 0x1fff;
- int pixel;
- uint32_t offs;
- offs = srcy * src_pitch + srcx;
+ int srcx = (cx >> 16) & 0x1fff;
+ int srcy = (cy >> 16) & 0x1fff;
+ int pixel;
+ uint32_t offs;
+ offs = srcy * src_pitch + srcx;
- cx += incxx;
- cy += incxy;
+ cx += incxx;
+ cy += incxy;
- if (offs>=src_size)
- continue;
+ if (offs>=src_size)
+ continue;
- if (srcx < src_minx || srcx > src_maxx || srcy < src_miny || srcy > src_maxy)
- continue;
+ if (srcx < src_minx || srcx > src_maxx || srcy < src_miny || srcy > src_maxy)
+ continue;
- pixel = src_base[offs];
- if (!(pixel & cmask))
- continue;
+ pixel = src_base[offs];
+ if (!(pixel & cmask))
+ continue;
- if ((dst_ptr+ecx+dst_base2)<dst_size) dst_base[dst_ptr+ecx+dst_base2] = alpha_blend_r32(pal_base[pixel], dst_base[dst_ptr+ecx+dst_base2], alpha);
+ if ((dst_ptr+ecx+dst_base2)<dst_size)
+ dst_base[dst_ptr+ecx+dst_base2] = (blend > 0) ? alpha_blend_r32(dst_base[dst_ptr+ecx+dst_base2], pal_base[pixel], alpha) : pal_base[pixel];
- if (pixeldouble_output)
- {
- ecx++;
- if ((dst_ptr+ecx+dst_base2)<dst_size) dst_base[dst_ptr+ecx+dst_base2] = alpha_blend_r32(pal_base[pixel], dst_base[dst_ptr+ecx+dst_base2], alpha);
- }
+ if (pixeldouble_output)
+ {
+ ecx++;
+ if ((dst_ptr+ecx+dst_base2)<dst_size)
+ dst_base[dst_ptr+ecx+dst_base2] = (blend > 0) ? alpha_blend_r32(dst_base[dst_ptr+ecx+dst_base2], pal_base[pixel], alpha) : pal_base[pixel];
}
- while (++ecx < 0);
+ }
+ while (++ecx < 0);
- ecx = tx;
- dst_ptr += dst_pitch;
- cy = starty; starty += incyy;
- cx = startx; startx += incyx;
- } while (--ty);
- }
- else // draw solid
- {
+ ecx = tx;
dst_ptr += dst_pitch;
- starty += incyy;
- startx += incyx;
-
- do {
- do {
- int srcx = (cx >> 16) & 0x1fff;
- int srcy = (cy >> 16) & 0x1fff;
- int pixel;
- uint32_t offs;
-
- offs = srcy * src_pitch + srcx;
-
- cx += incxx;
- cy += incxy;
-
- if (offs>=src_size)
- continue;
-
- if (srcx < src_minx || srcx > src_maxx || srcy < src_miny || srcy > src_maxy)
- continue;
-
- pixel = src_base[offs];
- if (!(pixel & cmask))
- continue;
-
-
-
- if ((dst_ptr+ecx+dst_base2)<dst_size) dst_base[dst_ptr+ecx+dst_base2] = pal_base[pixel];
-
- if (pixeldouble_output)
- {
- ecx++;
- if ((dst_ptr+ecx+dst_base2)<dst_size) dst_base[dst_ptr+ecx+dst_base2] = pal_base[pixel];
- }
- }
- while (++ecx < 0);
-
- ecx = tx;
- dst_ptr += dst_pitch;
- cy = starty; starty += incyy;
- cx = startx; startx += incyx;
- } while (--ty);
- }
+ cy = starty; starty += incyy;
+ cx = startx; startx += incyx;
+ } while (--ty);
}
// adapted from generic K053936_zoom_draw()