trunk/src/mame/video/deco_mlc.c
| r21879 | r21880 | |
| 60 | 60 | #endif |
| 61 | 61 | |
| 62 | 62 | static void mlc_drawgfxzoomline( |
| 63 | | bitmap_rgb32 &dest_bmp,const rectangle &clip,gfx_element *gfx, |
| 63 | UINT32* dest,const rectangle &clip,gfx_element *gfx, |
| 64 | 64 | UINT32 code1,UINT32 code2, UINT32 color,int flipx,int sx, |
| 65 | 65 | int transparent_color,int use8bpp, |
| 66 | | int scalex, int alpha, int usey, int srcline ) |
| 66 | int scalex, int alpha, int srcline ) |
| 67 | 67 | { |
| 68 | | rectangle myclip; |
| 69 | 68 | |
| 70 | 69 | if (!scalex) return; |
| 71 | 70 | |
| r21879 | r21880 | |
| 77 | 76 | */ |
| 78 | 77 | |
| 79 | 78 | /* KW 991012 -- Added code to force clip to bitmap boundary */ |
| 80 | | myclip = clip; |
| 81 | | myclip &= dest_bmp.cliprect(); |
| 82 | 79 | |
| 83 | | if( usey < myclip.min_y ) |
| 84 | | return; |
| 85 | 80 | |
| 86 | | if( usey > myclip.max_y+1 ) |
| 87 | | return; |
| 88 | | |
| 89 | 81 | const pen_t *pal = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())]; |
| 90 | 82 | const UINT8 *code_base1 = gfx->get_data(code1 % gfx->elements()); |
| 91 | 83 | const UINT8 *code_base2 = gfx->get_data(code2 % gfx->elements()); |
| r21879 | r21880 | |
| 114 | 106 | |
| 115 | 107 | |
| 116 | 108 | |
| 117 | | if( sx < myclip.min_x) |
| 109 | if( sx < clip.min_x) |
| 118 | 110 | { /* clip left */ |
| 119 | | int pixels = myclip.min_x-sx; |
| 111 | int pixels = clip.min_x-sx; |
| 120 | 112 | sx += pixels; |
| 121 | 113 | x_index_base += pixels*dx; |
| 122 | 114 | } |
| 123 | 115 | /* NS 980211 - fixed incorrect clipping */ |
| 124 | | if( ex > myclip.max_x+1 ) |
| 116 | if( ex > clip.max_x+1 ) |
| 125 | 117 | { /* clip right */ |
| 126 | | int pixels = ex-myclip.max_x-1; |
| 118 | int pixels = ex-clip.max_x-1; |
| 127 | 119 | ex -= pixels; |
| 128 | 120 | } |
| 129 | 121 | |
| r21879 | r21880 | |
| 135 | 127 | { |
| 136 | 128 | const UINT8 *source1 = code_base1 + (srcline) * gfx->rowbytes(); |
| 137 | 129 | const UINT8 *source2 = code_base2 + (srcline) * gfx->rowbytes(); |
| 138 | | UINT32 *dest = &dest_bmp.pix32(usey); |
| 139 | 130 | |
| 140 | 131 | int x, x_index = x_index_base; |
| 141 | 132 | |
| r21879 | r21880 | |
| 153 | 144 | else |
| 154 | 145 | { |
| 155 | 146 | const UINT8 *source = code_base1 + (srcline) * gfx->rowbytes(); |
| 156 | | UINT32 *dest = &dest_bmp.pix32(usey); |
| 157 | 147 | |
| 158 | 148 | int x, x_index = x_index_base; |
| 159 | 149 | for( x=sx; x<ex; x++ ) |
| r21879 | r21880 | |
| 167 | 157 | } |
| 168 | 158 | } |
| 169 | 159 | |
| 160 | |
| 170 | 161 | void deco_mlc_state::draw_sprites( bitmap_rgb32 &bitmap,const rectangle &cliprect) |
| 171 | 162 | { |
| 172 | 163 | UINT32 *index_ptr=0; |
| r21879 | r21880 | |
| 365 | 356 | |
| 366 | 357 | |
| 367 | 358 | |
| 368 | | for (by=0; by<h; by++) { |
| 359 | for (by=0; by<h; by++) |
| 360 | { |
| 369 | 361 | |
| 362 | |
| 363 | |
| 370 | 364 | int realybase = ybase + by * yinc; |
| 371 | | |
| 372 | | //for (int y=0; |
| 373 | 365 | int sprite_screen_height = ((yscale<<8)*16+(realybase&0xffff))>>16; |
| 374 | | int ey = (realybase>>16)+sprite_screen_height; |
| 375 | | realybase >>= 16; |
| 376 | 366 | |
| 377 | | if (!sprite_screen_height) |
| 378 | | continue; |
| 367 | for (int yi=0;yi<sprite_screen_height;yi++) |
| 368 | { |
| 369 | int y = (realybase>>16)+yi; |
| 379 | 370 | |
| 380 | | int dy = (16<<16)/sprite_screen_height; |
| 371 | rectangle myclip; |
| 372 | myclip = user_clip; |
| 373 | myclip &= bitmap.cliprect(); |
| 381 | 374 | |
| 375 | if( y < myclip.min_y ) |
| 376 | continue; |
| 382 | 377 | |
| 383 | | |
| 384 | | int counter = 0; |
| 385 | | for (int y=realybase;y<ey;y++) |
| 386 | | { |
| 387 | | int dystuff = counter * dy; |
| 388 | | counter++; |
| 378 | if( y > myclip.max_y+1 ) |
| 379 | continue; |
| 389 | 380 | |
| 390 | | int y_index; |
| 381 | UINT32 *dest = &bitmap.pix32(y); |
| 382 | |
| 383 | if (!sprite_screen_height) |
| 384 | continue; |
| 385 | |
| 386 | int dy = (16<<16)/sprite_screen_height; |
| 387 | |
| 388 | |
| 389 | |
| 390 | int dystuff = yi * dy; |
| 391 | |
| 392 | int srcline; |
| 393 | srcline = dystuff >> 16; |
| 394 | |
| 391 | 395 | if( fy ) |
| 392 | 396 | { |
| 393 | | y_index = (sprite_screen_height-1)*dy-dystuff; |
| 397 | srcline = (srcline &~15) | (15-(srcline&15)); |
| 394 | 398 | } |
| 395 | | else |
| 396 | | { |
| 397 | | y_index = dystuff; |
| 398 | | } |
| 399 | 399 | |
| 400 | |
| 400 | 401 | for (bx=0; bx<w; bx++) { |
| 401 | 402 | |
| 402 | 403 | int realxbase = xbase + bx * xinc; |
| r21879 | r21880 | |
| 467 | 468 | } |
| 468 | 469 | } |
| 469 | 470 | |
| 470 | | // if (rasterMode) |
| 471 | | // rasterDirty=1; |
| 472 | 471 | |
| 472 | |
| 473 | |
| 473 | 474 | mlc_drawgfxzoomline( |
| 474 | | /*rasterMode ? temp_bitmap : */bitmap,user_clip,machine().gfx[0], |
| 475 | dest,user_clip,machine().gfx[0], |
| 475 | 476 | tile,tile2, |
| 476 | 477 | color + colorOffset,fx,realxbase, |
| 477 | 478 | 0, |
| 478 | | use8bppMode,(xscale<<8),alpha, y, y_index>>16); |
| 479 | use8bppMode,(xscale<<8),alpha, srcline); |
| 479 | 480 | |
| 480 | 481 | } |
| 481 | 482 | |