| 123 | } |
| 124 | |
| 125 | void RectangleDrawable::drawRectangle( const Rectf& R, const Color& TopLeft, |
| 126 | const Color& BottomLeft, const Color& BottomRight, |
| 127 | const Color& TopRight, const Float& Angle, |
| 128 | const Vector2f& Scale ) { |
| 129 | BatchRenderer* sBR = GlobalBatchRenderer::instance(); |
| 130 | sBR->setTexture( NULL ); |
| 131 | sBR->setBlendMode( mBlendMode ); |
| 132 | |
| 133 | switch ( mFillMode ) { |
| 134 | case DRAW_FILL: { |
| 135 | sBR->quadsBegin(); |
| 136 | sBR->quadsSetColorFree( TopLeft, BottomLeft, BottomRight, TopRight ); |
| 137 | |
| 138 | Sizef size = const_cast<Rectf*>( &R )->getSize(); |
| 139 | |
| 140 | sBR->batchQuadEx( R.Left, R.Top, size.getWidth(), size.getHeight(), Angle, Scale ); |
| 141 | break; |
| 142 | } |
| 143 | case DRAW_LINE: { |
| 144 | sBR->setLineWidth( mLineWidth ); |
| 145 | |
| 146 | sBR->lineLoopBegin(); |
| 147 | sBR->lineLoopSetColorFree( TopLeft, BottomLeft ); |
| 148 | |
| 149 | if ( Scale != 1.0f || Angle != 0.0f ) { |
| 150 | Quad2f Q( R ); |
| 151 | Sizef size = const_cast<Rectf*>( &R )->getSize(); |
| 152 | |
| 153 | Q.scale( Scale ); |
| 154 | Q.rotate( Angle, Vector2f( R.Left + size.getWidth() * 0.5f, |
| 155 | R.Top + size.getHeight() * 0.5f ) ); |
| 156 | |
| 157 | sBR->batchLineLoop( Q[0].x, Q[0].y, Q[1].x, Q[1].y ); |
| 158 | sBR->lineLoopSetColorFree( BottomRight, TopRight ); |
| 159 | sBR->batchLineLoop( Q[2].x, Q[2].y, Q[3].x, Q[3].y ); |
| 160 | } else { |
| 161 | sBR->batchLineLoop( R.Left, R.Top, R.Left, R.Bottom ); |
| 162 | sBR->lineLoopSetColorFree( BottomRight, TopRight ); |
| 163 | sBR->batchLineLoop( R.Right, R.Bottom, R.Right, R.Top ); |
| 164 | } |
| 165 | |
| 166 | break; |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | sBR->draw(); |
| 171 | } |
| 172 | |
| 173 | void RectangleDrawable::updateVertex() { |
| 174 | if ( mCorners == 0 ) |
nothing calls this directly
no test coverage detected