I am trying to save a texture to a png and the only thing I'm getting
is a screenshot of a portion of the screen.

my code example: 

```
src_texture =  SDL_CreateTextureFromSurface( renderer, some_surface );
/*.........*/

/*create target texture */
SDL_Texture *tmp_texture = SDL_CreateTexture(renderer, format, SDL_TEXTUREACCESS_TARGET , w, h);
SDL_SetTextureBlendMode(tmp_texture, SDL_BLENDMODE_NONE);
SDL_SetRenderTarget(renderer, tmp_texture);
SDL_RenderCopy(renderer, src_texture, NULL, NULL);

/*create surface and get pixels from texture*/
PixelFormat mask = GetMask(format);
s = SDL_CreateRGBSurface(0, w, h, 32, mask.Rmask, mask.Gmask, mask.Bmask, mask.Amask);
if (s) {
    SDL_SetRenderTarget(renderer, tmp_texture);
    SDL_RenderReadPixels(renderer, NULL, s->format->format, s->pixels, s->pitch);
    IMG_SavePNG(s, "image.png");

}
SDL_DestroyTexture(tmp_texture);

```

Any idea how to achieve this?