| 556 | } |
| 557 | |
| 558 | void Tr2Sprite2dScene::PushClipRectangle( float x, float y, float width, float height ) |
| 559 | { |
| 560 | //CCP_STATS_ZONE( __FUNCTION__ ); |
| 561 | |
| 562 | CCP_ASSERT( width >= 0.0f ); |
| 563 | CCP_ASSERT( height >= 0.0f ); |
| 564 | |
| 565 | if( m_ignoreClip ) |
| 566 | { |
| 567 | return; |
| 568 | } |
| 569 | |
| 570 | // TODO: Implement for 3d rendering |
| 571 | if( !m_is2dRender ) |
| 572 | { |
| 573 | return; |
| 574 | } |
| 575 | |
| 576 | Tr2Sprite2dClipRect rect; |
| 577 | |
| 578 | if( !m_transformStack->empty() ) |
| 579 | { |
| 580 | const TransformStackEntry& top = m_transformStack->back(); |
| 581 | |
| 582 | if( top.isTranslationOnly ) |
| 583 | { |
| 584 | rect.left = ( x + top.translation.x ); |
| 585 | rect.top = ( y + top.translation.y ); |
| 586 | rect.right = ( rect.left + width ); |
| 587 | rect.bottom = ( rect.top + height ); |
| 588 | } |
| 589 | else |
| 590 | { |
| 591 | const Matrix& transform = top.transform; |
| 592 | |
| 593 | Vector4 corners[4]; |
| 594 | for( int i = 0; i < 4; ++i ) |
| 595 | { |
| 596 | corners[i] = Vector4( 0.f, 0.f, 0.f, 1.f ); |
| 597 | } |
| 598 | |
| 599 | corners[0].x = x; |
| 600 | corners[0].y = y; |
| 601 | corners[1].x = x + width; |
| 602 | corners[1].y = y; |
| 603 | corners[2].x = x + width; |
| 604 | corners[2].y = y + height; |
| 605 | corners[3].x = x; |
| 606 | corners[3].y = y + height; |
| 607 | |
| 608 | XMVector4TransformStream( (XMFLOAT4*)corners, |
| 609 | sizeof( Vector4 ), |
| 610 | (const XMFLOAT4*)corners, |
| 611 | sizeof( Vector4 ), |
| 612 | 4, |
| 613 | transform ); |
| 614 | |
| 615 | float minX = FLT_MAX; |
no test coverage detected