Hi guys I can't really do Nearest Neighboor Resizing on 1D array bitmap with my arduino this is my code

Code:
uint16_t* resizePixels(uint16_t *pixels,int w1,int h1,int w2,int h2) {
    uint16_t *temp = new uint16_t[w2*h2] ;
    double x_ratio = w1/(double)w2 ;
    double y_ratio = h1/(double)h2 ;
    double px, py ; 
    for (int i=0;i<h2;i++) {
        for (int j=0;j<w2;j++) {
            px = floor(j*x_ratio) ;
            py = floor(i*y_ratio) ;
            temp[(i*w2)+j] = pixels[(uint16_t)((py*w1)+px)] ;
        }
    }
    return temp ;
}
it seems to do nothing. I use it like this (dbc is drawbitmap function that works)
Code:
dBC(x, y, w,h,resizePixels(Bit1,60,30,w,h));
Nothing happened on the screen. but without resize code,it displays so i know dbc function works