1679 |
|
#undef INVERT_8 |
1680 |
|
} |
1681 |
|
|
1682 |
< |
void NQD_invrect(uint32 arg) |
1682 |
> |
void NQD_invrect(uint32 p) |
1683 |
|
{ |
1684 |
< |
D(bug("accl_invrect %08x\n", arg)); |
1685 |
< |
accl_params *p = (accl_params *)arg; |
1684 |
> |
D(bug("accl_invrect %08x\n", p)); |
1685 |
|
|
1686 |
|
// Get inversion parameters |
1687 |
< |
int16 dest_X = p->dest_rect[1] - p->dest_bounds[1]; |
1688 |
< |
int16 dest_Y = p->dest_rect[0] - p->dest_bounds[0]; |
1689 |
< |
int16 width = p->dest_rect[3] - p->dest_rect[1]; |
1690 |
< |
int16 height = p->dest_rect[2] - p->dest_rect[0]; |
1687 |
> |
int16 dest_X = (int16)ReadMacInt16(p + acclDestRect + 2) - (int16)ReadMacInt16(p + acclDestBoundsRect + 2); |
1688 |
> |
int16 dest_Y = (int16)ReadMacInt16(p + acclDestRect + 0) - (int16)ReadMacInt16(p + acclDestBoundsRect + 0); |
1689 |
> |
int16 width = (int16)ReadMacInt16(p + acclDestRect + 6) - (int16)ReadMacInt16(p + acclDestRect + 2); |
1690 |
> |
int16 height = (int16)ReadMacInt16(p + acclDestRect + 4) - (int16)ReadMacInt16(p + acclDestRect + 0); |
1691 |
|
D(bug(" dest X %d, dest Y %d\n", dest_X, dest_Y)); |
1692 |
< |
D(bug(" width %d, height %d, bytes_per_row %d\n", width, height, p->dest_row_bytes)); |
1692 |
> |
D(bug(" width %d, height %d, bytes_per_row %d\n", width, height, (int32)ReadMacInt32(p + acclDestRowBytes))); |
1693 |
|
|
1694 |
|
//!!?? pen_mode == 14 |
1695 |
|
|
1696 |
|
// And perform the inversion |
1697 |
< |
const int bpp = bytes_per_pixel(p->dest_pixel_size); |
1698 |
< |
const int dest_row_bytes = p->dest_row_bytes; |
1699 |
< |
uint8 *dest = (uint8 *)(p->dest_base_addr + (dest_Y * dest_row_bytes) + (dest_X * bpp)); |
1697 |
> |
const int bpp = bytes_per_pixel(ReadMacInt32(p + acclDestPixelSize)); |
1698 |
> |
const int dest_row_bytes = (int32)ReadMacInt32(p + acclDestRowBytes); |
1699 |
> |
uint8 *dest = (uint8 *)(ReadMacInt32(p + acclDestBaseAddr) + (dest_Y * dest_row_bytes) + (dest_X * bpp)); |
1700 |
|
width *= bpp; |
1701 |
|
switch (bpp) { |
1702 |
|
case 1: |
1789 |
|
#undef FILL_8 |
1790 |
|
} |
1791 |
|
|
1792 |
< |
void NQD_fillrect(uint32 arg) |
1792 |
> |
void NQD_fillrect(uint32 p) |
1793 |
|
{ |
1794 |
< |
D(bug("accl_fillrect %08x\n", arg)); |
1796 |
< |
accl_params *p = (accl_params *)arg; |
1794 |
> |
D(bug("accl_fillrect %08x\n", p)); |
1795 |
|
|
1796 |
|
// Get filling parameters |
1797 |
< |
int16 dest_X = p->dest_rect[1] - p->dest_bounds[1]; |
1798 |
< |
int16 dest_Y = p->dest_rect[0] - p->dest_bounds[0]; |
1799 |
< |
int16 width = p->dest_rect[3] - p->dest_rect[1]; |
1800 |
< |
int16 height = p->dest_rect[2] - p->dest_rect[0]; |
1801 |
< |
uint32 color = p->pen_mode == 8 ? p->fore_pen : p->back_pen; |
1797 |
> |
int16 dest_X = (int16)ReadMacInt16(p + acclDestRect + 2) - (int16)ReadMacInt16(p + acclDestBoundsRect + 2); |
1798 |
> |
int16 dest_Y = (int16)ReadMacInt16(p + acclDestRect + 0) - (int16)ReadMacInt16(p + acclDestBoundsRect + 0); |
1799 |
> |
int16 width = (int16)ReadMacInt16(p + acclDestRect + 6) - (int16)ReadMacInt16(p + acclDestRect + 2); |
1800 |
> |
int16 height = (int16)ReadMacInt16(p + acclDestRect + 4) - (int16)ReadMacInt16(p + acclDestRect + 0); |
1801 |
> |
uint32 color = ReadMacInt32(p + acclPenMode) == 8 ? ReadMacInt32(p + acclForePen) : ReadMacInt32(p + acclBackPen); |
1802 |
|
D(bug(" dest X %d, dest Y %d\n", dest_X, dest_Y)); |
1803 |
|
D(bug(" width %d, height %d\n", width, height)); |
1804 |
< |
D(bug(" bytes_per_row %d color %08x\n", p->dest_row_bytes, color)); |
1804 |
> |
D(bug(" bytes_per_row %d color %08x\n", (int32)ReadMacInt32(p + acclDestRowBytes), color)); |
1805 |
|
|
1806 |
|
// And perform the fill |
1807 |
< |
const int bpp = bytes_per_pixel(p->dest_pixel_size); |
1808 |
< |
const int dest_row_bytes = p->dest_row_bytes; |
1809 |
< |
uint8 *dest = (uint8 *)(p->dest_base_addr + (dest_Y * dest_row_bytes) + (dest_X * bpp)); |
1807 |
> |
const int bpp = bytes_per_pixel(ReadMacInt32(p + acclDestPixelSize)); |
1808 |
> |
const int dest_row_bytes = (int32)ReadMacInt32(p + acclDestRowBytes); |
1809 |
> |
uint8 *dest = (uint8 *)(ReadMacInt32(p + acclDestBaseAddr) + (dest_Y * dest_row_bytes) + (dest_X * bpp)); |
1810 |
|
width *= bpp; |
1811 |
|
switch (bpp) { |
1812 |
|
case 1: |
1830 |
|
} |
1831 |
|
} |
1832 |
|
|
1833 |
< |
bool NQD_fillrect_hook(uint32 arg) |
1833 |
> |
bool NQD_fillrect_hook(uint32 p) |
1834 |
|
{ |
1835 |
< |
D(bug("accl_fillrect_hook %08x\n", arg)); |
1838 |
< |
accl_params *p = (accl_params *)arg; |
1835 |
> |
D(bug("accl_fillrect_hook %08x\n", p)); |
1836 |
|
|
1837 |
|
// Check if we can accelerate this fillrect |
1838 |
< |
if (((uint32 *)p)[0x284 >> 2] != 0 && p->dest_pixel_size >= 8) { |
1839 |
< |
if (p->transfer_mode == 8) { |
1838 |
> |
if (ReadMacInt32(p + 0x284) != 0 && ReadMacInt32(p + acclDestPixelSize) >= 8) { |
1839 |
> |
const int transfer_mode = ReadMacInt32(p + acclTransferMode); |
1840 |
> |
if (transfer_mode == 8) { |
1841 |
|
// Fill |
1842 |
< |
p->draw_proc = NativeTVECT(NATIVE_FILLRECT); |
1842 |
> |
WriteMacInt32(p + acclDrawProc, NativeTVECT(NATIVE_FILLRECT)); |
1843 |
|
return true; |
1844 |
|
} |
1845 |
< |
else if (p->transfer_mode == 10) { |
1845 |
> |
else if (transfer_mode == 10) { |
1846 |
|
// Invert |
1847 |
< |
p->draw_proc = NativeTVECT(NATIVE_INVRECT); |
1847 |
> |
WriteMacInt32(p + acclDrawProc, NativeTVECT(NATIVE_INVRECT)); |
1848 |
|
return true; |
1849 |
|
} |
1850 |
|
} |
1853 |
|
|
1854 |
|
// Rectangle blitting |
1855 |
|
// TODO: optimize for VOSF and target pixmap == screen |
1856 |
< |
void NQD_bitblt(uint32 arg) |
1856 |
> |
void NQD_bitblt(uint32 p) |
1857 |
|
{ |
1858 |
< |
D(bug("accl_bitblt %08x\n", arg)); |
1861 |
< |
accl_params *p = (accl_params *)arg; |
1858 |
> |
D(bug("accl_bitblt %08x\n", p)); |
1859 |
|
|
1860 |
|
// Get blitting parameters |
1861 |
< |
int16 src_X = p->src_rect[1] - p->src_bounds[1]; |
1862 |
< |
int16 src_Y = p->src_rect[0] - p->src_bounds[0]; |
1863 |
< |
int16 dest_X = p->dest_rect[1] - p->dest_bounds[1]; |
1864 |
< |
int16 dest_Y = p->dest_rect[0] - p->dest_bounds[0]; |
1865 |
< |
int16 width = p->dest_rect[3] - p->dest_rect[1]; |
1866 |
< |
int16 height = p->dest_rect[2] - p->dest_rect[0]; |
1867 |
< |
D(bug(" src addr %08x, dest addr %08x\n", p->src_base_addr, p->dest_base_addr)); |
1861 |
> |
int16 src_X = (int16)ReadMacInt16(p + acclSrcRect + 2) - (int16)ReadMacInt16(p + acclSrcBoundsRect + 2); |
1862 |
> |
int16 src_Y = (int16)ReadMacInt16(p + acclSrcRect + 0) - (int16)ReadMacInt16(p + acclSrcBoundsRect + 0); |
1863 |
> |
int16 dest_X = (int16)ReadMacInt16(p + acclDestRect + 2) - (int16)ReadMacInt16(p + acclDestBoundsRect + 2); |
1864 |
> |
int16 dest_Y = (int16)ReadMacInt16(p + acclDestRect + 0) - (int16)ReadMacInt16(p + acclDestBoundsRect + 0); |
1865 |
> |
int16 width = (int16)ReadMacInt16(p + acclDestRect + 6) - (int16)ReadMacInt16(p + acclDestRect + 2); |
1866 |
> |
int16 height = (int16)ReadMacInt16(p + acclDestRect + 4) - (int16)ReadMacInt16(p + acclDestRect + 0); |
1867 |
> |
D(bug(" src addr %08x, dest addr %08x\n", ReadMacInt32(p + acclSrcBaseAddr), ReadMacInt32(p + acclDestBaseAddr))); |
1868 |
|
D(bug(" src X %d, src Y %d, dest X %d, dest Y %d\n", src_X, src_Y, dest_X, dest_Y)); |
1869 |
|
D(bug(" width %d, height %d\n", width, height)); |
1870 |
|
|
1871 |
|
// And perform the blit |
1872 |
< |
const int bpp = bytes_per_pixel(p->src_pixel_size); |
1872 |
> |
const int bpp = bytes_per_pixel(ReadMacInt32(p + acclSrcPixelSize)); |
1873 |
|
width *= bpp; |
1874 |
< |
if (p->src_row_bytes > 0) { |
1875 |
< |
const int src_row_bytes = p->src_row_bytes; |
1876 |
< |
const int dst_row_bytes = p->dest_row_bytes; |
1877 |
< |
uint8 *src = (uint8 *)p->src_base_addr + (src_Y * src_row_bytes) + (src_X * bpp); |
1878 |
< |
uint8 *dst = (uint8 *)p->dest_base_addr + (dest_Y * dst_row_bytes) + (dest_X * bpp); |
1874 |
> |
if ((int32)ReadMacInt32(p + acclSrcRowBytes) > 0) { |
1875 |
> |
const int src_row_bytes = (int32)ReadMacInt32(p + acclSrcRowBytes); |
1876 |
> |
const int dst_row_bytes = (int32)ReadMacInt32(p + acclDestRowBytes); |
1877 |
> |
uint8 *src = (uint8 *)ReadMacInt32(p + acclSrcBaseAddr) + (src_Y * src_row_bytes) + (src_X * bpp); |
1878 |
> |
uint8 *dst = (uint8 *)ReadMacInt32(p + acclDestBaseAddr) + (dest_Y * dst_row_bytes) + (dest_X * bpp); |
1879 |
|
for (int i = 0; i < height; i++) { |
1880 |
|
memcpy(dst, src, width); |
1881 |
|
src += src_row_bytes; |
1883 |
|
} |
1884 |
|
} |
1885 |
|
else { |
1886 |
< |
const int src_row_bytes = -p->src_row_bytes; |
1887 |
< |
const int dst_row_bytes = -p->dest_row_bytes; |
1888 |
< |
uint8 *src = (uint8 *)p->src_base_addr + ((src_Y + height - 1) * src_row_bytes) + (src_X * bpp); |
1889 |
< |
uint8 *dst = (uint8 *)p->dest_base_addr + ((dest_Y + height - 1) * dst_row_bytes) + (dest_X * bpp); |
1886 |
> |
const int src_row_bytes = -(int32)ReadMacInt32(p + acclSrcRowBytes); |
1887 |
> |
const int dst_row_bytes = -(int32)ReadMacInt32(p + acclDestRowBytes); |
1888 |
> |
uint8 *src = (uint8 *)ReadMacInt32(p + acclSrcBaseAddr) + ((src_Y + height - 1) * src_row_bytes) + (src_X * bpp); |
1889 |
> |
uint8 *dst = (uint8 *)ReadMacInt32(p + acclDestBaseAddr) + ((dest_Y + height - 1) * dst_row_bytes) + (dest_X * bpp); |
1890 |
|
for (int i = height - 1; i >= 0; i--) { |
1891 |
|
memcpy(dst, src, width); |
1892 |
|
src -= src_row_bytes; |
1916 |
|
50 : hilite |
1917 |
|
*/ |
1918 |
|
|
1919 |
< |
bool NQD_bitblt_hook(uint32 arg) |
1919 |
> |
bool NQD_bitblt_hook(uint32 p) |
1920 |
|
{ |
1921 |
< |
D(bug("accl_draw_hook %08x\n", arg)); |
1925 |
< |
accl_params *p = (accl_params *)arg; |
1921 |
> |
D(bug("accl_draw_hook %08x\n", p)); |
1922 |
|
|
1923 |
|
// Check if we can accelerate this bitblt |
1924 |
< |
if (((uint32 *)p)[0x18 >> 2] + ((uint32 *)p)[0x128 >> 2] == 0 && |
1925 |
< |
((uint32 *)p)[0x130 >> 2] == 0 && |
1926 |
< |
p->src_pixel_size >= 8 && p->src_pixel_size == p->dest_pixel_size && |
1927 |
< |
(p->src_row_bytes ^ p->dest_row_bytes) >= 0 && // same sign? |
1928 |
< |
p->transfer_mode == 0 && // srcCopy? |
1929 |
< |
((uint32 *)p)[0x15c >> 2] > 0) { |
1924 |
> |
if (ReadMacInt32(p + 0x018) + ReadMacInt32(p + 0x128) == 0 && |
1925 |
> |
ReadMacInt32(p + 0x130) == 0 && |
1926 |
> |
ReadMacInt32(p + acclSrcPixelSize) >= 8 && |
1927 |
> |
ReadMacInt32(p + acclSrcPixelSize) == ReadMacInt32(p + acclDestPixelSize) && |
1928 |
> |
(ReadMacInt32(p + acclSrcRowBytes) ^ ReadMacInt32(p + acclDestRowBytes)) >= 0 && // same sign? |
1929 |
> |
ReadMacInt32(p + acclTransferMode) == 0 && // srcCopy? |
1930 |
> |
ReadMacInt32(p + 0x15c) > 0) { |
1931 |
|
|
1932 |
|
// Yes, set function pointer |
1933 |
< |
p->draw_proc = NativeTVECT(NATIVE_BITBLT); |
1933 |
> |
WriteMacInt32(p + acclDrawProc, NativeTVECT(NATIVE_BITBLT)); |
1934 |
|
return true; |
1935 |
|
} |
1936 |
|
return false; |