diff options
| author | SND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2009-11-05 12:20:40 +0000 |
|---|---|---|
| committer | SND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2009-11-05 12:20:40 +0000 |
| commit | 168b0f461224acb3c7b833d4e476a2f8bf660fa0 (patch) | |
| tree | 32769f55075684a67cce35ba652c1fe081b19def /plugins | |
| parent | b89b9fd63accf97dfb46e19e7e6e1129c8fa6c5c (diff) | |
| download | pcsxr-168b0f461224acb3c7b833d4e476a2f8bf660fa0.tar.gz | |
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@35714 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'plugins')
| -rw-r--r-- | plugins/dfxvideo/draw.c | 90 |
1 files changed, 51 insertions, 39 deletions
diff --git a/plugins/dfxvideo/draw.c b/plugins/dfxvideo/draw.c index 3b5a722c..6517594c 100644 --- a/plugins/dfxvideo/draw.c +++ b/plugins/dfxvideo/draw.c @@ -1345,12 +1345,19 @@ void BlitScreen32(unsigned char *surf, int32_t x, int32_t y) unsigned short row, column; unsigned short dx = PreviousPSXDisplay.Range.x1; unsigned short dy = PreviousPSXDisplay.DisplayMode.y; - - //int32_t lPitch = (dx + PreviousPSXDisplay.Range.x0) << 2; + int32_t lPitch = PSXDisplay.DisplayMode.x << 2; uint32_t *destpix; + if (PreviousPSXDisplay.Range.y0) // centering needed? + { + surf += PreviousPSXDisplay.Range.y0 * lPitch; + dy -= PreviousPSXDisplay.Range.y0; + } + + surf += PreviousPSXDisplay.Range.x0 << 2; + if (PSXDisplay.RGB24) { for (column = 0; column < dy; column++) @@ -1392,63 +1399,68 @@ void BlitToYUV(unsigned char * surf,int32_t x,int32_t y) unsigned short dx=PreviousPSXDisplay.Range.x1; unsigned short dy=PreviousPSXDisplay.DisplayMode.y; int Y,U,V, R,G,B; - - //int32_t lPitch=(dx+PreviousPSXDisplay.Range.x0)<<2; - int32_t lPitch=PSXDisplay.DisplayMode.x<<2; - uint32_t *destpix; - if(PSXDisplay.RGB24) + int32_t lPitch=PSXDisplay.DisplayMode.x << 2; + uint32_t *destpix; + + if (PreviousPSXDisplay.Range.y0) // centering needed? + { + surf += PreviousPSXDisplay.Range.y0 * lPitch; + dy -= PreviousPSXDisplay.Range.y0; + } + + surf += PreviousPSXDisplay.Range.x0 << 2; + + if (PSXDisplay.RGB24) { - for(column=0;column<dy;column++) + for (column = 0; column < dy; column++) { - startxy=((1024)*(column+y))+x; - pD=(unsigned char *)&psxVuw[startxy]; - destpix=(uint32_t*)(surf+(column*lPitch)); - for(row=0;row<dx;row++) + startxy = (1024 * (column + y)) + x; + pD = (unsigned char *)&psxVuw[startxy]; + destpix = (uint32_t *)(surf + (column * lPitch)); + for (row = 0; row < dx; row++) { - lu=*((uint32_t *)pD); + lu = *((uint32_t *)pD); - R = RED(lu); - G = GREEN(lu); - B = BLUE(lu); + R = RED(lu); + G = GREEN(lu); + B = BLUE(lu); - Y = min(abs(R * 2104 + G * 4130 + B * 802 + 4096 + 131072) >> 13, 235); - U = min(abs(R * -1214 + G * -2384 + B * 3598 + 4096 + 1048576) >> 13, 240); - V = min(abs(R * 3598 + G * -3013 + B * -585 + 4096 + 1048576) >> 13, 240); + Y = min(abs(R * 2104 + G * 4130 + B * 802 + 4096 + 131072) >> 13, 235); + U = min(abs(R * -1214 + G * -2384 + B * 3598 + 4096 + 1048576) >> 13, 240); + V = min(abs(R * 3598 + G * -3013 + B * -585 + 4096 + 1048576) >> 13, 240); - destpix[row] = #ifdef __BIG_ENDIAN__ - Y << 24 | U << 16 | Y << 8 | V; + destpix[row] = Y << 24 | U << 16 | Y << 8 | V; #else - Y << 24 | V << 16 | Y << 8 | U; + destpix[row] = Y << 24 | V << 16 | Y << 8 | U; #endif - pD+=3; + pD += 3; } } } else { - for(column=0;column<dy;column++) + for (column = 0; column < dy; column++) { - startxy=((1024)*(column+y))+x; - destpix=(uint32_t*)(surf+(column*lPitch)); - for(row=0;row<dx;row++) + startxy = (1024 * (column + y)) + x; + destpix = (uint32_t *)(surf + (column * lPitch)); + for (row = 0; row < dx; row++) { - s=GETLE16(&psxVuw[startxy++]); + s = GETLE16(&psxVuw[startxy++]); - R = (s << 3) &0xf8; - G = (s >> 2) &0xf8; - B = (s >> 7) &0xf8; + R = (s << 3) &0xf8; + G = (s >> 2) &0xf8; + B = (s >> 7) &0xf8; - Y = min(abs(R * 2104 + G * 4130 + B * 802 + 4096 + 131072) >> 13, 235); - U = min(abs(R * -1214 + G * -2384 + B * 3598 + 4096 + 1048576) >> 13, 240); - V = min(abs(R * 3598 + G * -3013 + B * -585 + 4096 + 1048576) >> 13, 240); + Y = min(abs(R * 2104 + G * 4130 + B * 802 + 4096 + 131072) >> 13, 235); + U = min(abs(R * -1214 + G * -2384 + B * 3598 + 4096 + 1048576) >> 13, 240); + V = min(abs(R * 3598 + G * -3013 + B * -585 + 4096 + 1048576) >> 13, 240); - destpix[row] = #ifdef __BIG_ENDIAN__ - Y << 24 | U << 16 | Y << 8 | V; + destpix[row] = Y << 24 | U << 16 | Y << 8 | V; #else - Y << 24 | V << 16 | Y << 8 | U; + destpix[row] = Y << 24 | V << 16 | Y << 8 | U; #endif } } @@ -1579,7 +1591,7 @@ void DoBufferSwap(void) Screen *screen; Window _dw; XvImage *xvi; - unsigned int dstx,dsty,srcy=0; + unsigned int dstx, dsty, srcy = 0; unsigned int _d, _w, _h; //don't care about _d finalw = PSXDisplay.DisplayMode.x; @@ -1627,7 +1639,7 @@ void DoBufferSwap(void) _w = screen->width; _h = screen->height; } - + dstx = 0; dsty = 0; |
