code/SoftRenderer/addon.cpp
// function to change buffer from js
function to change buffer from js
function to change buffer from js
NAN_METHOD(rotate) {
    char* buffer = (char*) node::Buffer::Data(info[0]->ToObject());
    unsigned int size = info[1]->Uint32Value();
    unsigned int rot = info[2]->Uint32Value();
    for(unsigned int i = 0; i < size; i++ ) {
        buffer[i] += rot;
    }
    s_counter++;
}
NAN_METHOD ( rotate ) { char * buffer = ( char * ) node :: Buffer :: Data ( info [ 0 ] -> ToObject ( ) ) ; unsigned int size = info [ 1 ] -> Uint32Value ( ) ; unsigned int rot = info [ 2 ] -> Uint32Value ( ) ; for ( unsigned int i = 0 ; i < size ; i ++ ) { buffer [ i ] += rot ; } s_counter ++ ; }
function to change buffer from js
function to change buffer from js