SCERROR Surface::TransparentBlt_( Surface* to, Surface* from, u32_t trans, int x, int y , const rect_t* rect) { rect_t r; unsigned surfmt = Surface::GET_PIXFORMAT(from->GetFormat()); fail_if ( surfmt != Surface::GET_PIXFORMAT(to->GetFormat()) ); if ( !PrepareRect(r,to,from,x,y,rect) ) return SCE_OK; const int width = r.right-r.left; if ( width == 0 ) return SCE_OK; SurfLock lfrom(from); reterr_if ( lfrom.PeekError() ); SurfLock lto(to); reterr_if ( lto.PeekError() ); int src_stride,dst_stride; // получаем адреса памяти для пикселей cbyte_t* src = (cbyte_t*)lfrom->GetMemory(src_stride); byte_t* dst = (byte_t*)lto->GetMemory(dst_stride); int depth = 0; switch ( surfmt ) { case Surface::RGBx32: depth = 4; break; case Surface::RGB5x5: depth = 2; break; case Surface::PAL: case Surface::ALPHA: depth = 1; break; default: fail_if ("INVALID SURFACE FORMAT"); } dst+=y*dst_stride+x*depth; // src+=r.top*src_stride+r.left*depth; // поправка на координаты switch ( surfmt ) { case Surface::RGBx32: CopyTransparentRect_T(r.bottom-r.top,src,src_stride,dst,dst_stride,width,u32_t(trans)); break; case Surface::RGB5x5: CopyTransparentRect_T(r.bottom-r.top,src,src_stride,dst,dst_stride,width,u16_t(trans)); break; case Surface::PAL: case Surface::ALPHA: CopyTransparentRect_T(r.bottom-r.top,src,src_stride,dst,dst_stride,width,byte_t(trans)); break; default: fail_if ("INVALID SURFACE FORMAT"); } return SCE_OK; }
fd_manager_t::fd_manager_t() { counter=u32_t(-1); counter+=100; reserve(10007); }