| 439 | } |
| 440 | |
| 441 | void CScriptGrid::Resize(asUINT width, asUINT height) |
| 442 | { |
| 443 | // Make sure the size isn't too large for us to handle |
| 444 | if( !CheckMaxSize(width, height) ) |
| 445 | return; |
| 446 | |
| 447 | // Create a new buffer |
| 448 | SGridBuffer *tmpBuffer = 0; |
| 449 | CreateBuffer(&tmpBuffer, width, height); |
| 450 | if( tmpBuffer == 0 ) |
| 451 | return; |
| 452 | |
| 453 | if( buffer ) |
| 454 | { |
| 455 | // Copy the existing values to the new buffer |
| 456 | asUINT w = width > buffer->width ? buffer->width : width; |
| 457 | asUINT h = height > buffer->height ? buffer->height : height; |
| 458 | for( asUINT y = 0; y < h; y++ ) |
| 459 | for( asUINT x = 0; x < w; x++ ) |
| 460 | SetValue(tmpBuffer, x, y, At(buffer, x, y)); |
| 461 | |
| 462 | // Replace the internal buffer |
| 463 | DeleteBuffer(buffer); |
| 464 | } |
| 465 | |
| 466 | buffer = tmpBuffer; |
| 467 | } |
| 468 | |
| 469 | CScriptGrid::CScriptGrid(asUINT width, asUINT height, void *defVal, asITypeInfo *ti) |
| 470 | { |
no outgoing calls