MCPcopy Create free account
hub / github.com/anjo76/angelscript / Resize

Method Resize

sdk/add_on/scriptgrid/scriptgrid.cpp:441–467  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

439}
440
441void 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
469CScriptGrid::CScriptGrid(asUINT width, asUINT height, void *defVal, asITypeInfo *ti)
470{

Callers 10

GetCommandLineArgsFunction · 0.45
GetFilesMethod · 0.45
GetDirsMethod · 0.45
TestFunction · 0.45
StringSplit_GenericFunction · 0.45
asStringClass · 0.45
TestFunction · 0.45
FillASArrayFunction · 0.45
RestoreMethod · 0.45

Calls

no outgoing calls

Tested by 5

TestFunction · 0.36
StringSplit_GenericFunction · 0.36
TestFunction · 0.36
FillASArrayFunction · 0.36
RestoreMethod · 0.36