src/render/opengles/SDL_render_gles.c
changeset 7420 fe82b639c4d6
parent 7239 04dda95ba22c
child 7502 6ff02ff3cf06
equal deleted inserted replaced
7419:a22566f42281 7420:fe82b639c4d6
  1004 static int
  1004 static int
  1005 GLES_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
  1005 GLES_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
  1006                     Uint32 pixel_format, void * pixels, int pitch)
  1006                     Uint32 pixel_format, void * pixels, int pitch)
  1007 {
  1007 {
  1008     GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
  1008     GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
  1009     SDL_Window *window = renderer->window;
       
  1010     Uint32 temp_format = SDL_PIXELFORMAT_ABGR8888;
  1009     Uint32 temp_format = SDL_PIXELFORMAT_ABGR8888;
  1011     void *temp_pixels;
  1010     void *temp_pixels;
  1012     int temp_pitch;
  1011     int temp_pitch;
  1013     Uint8 *src, *dst, *tmp;
  1012     Uint8 *src, *dst, *tmp;
  1014     int w, h, length, rows;
  1013     int w, h, length, rows;
  1020     temp_pixels = SDL_malloc(rect->h * temp_pitch);
  1019     temp_pixels = SDL_malloc(rect->h * temp_pitch);
  1021     if (!temp_pixels) {
  1020     if (!temp_pixels) {
  1022         return SDL_OutOfMemory();
  1021         return SDL_OutOfMemory();
  1023     }
  1022     }
  1024 
  1023 
  1025     SDL_GetWindowSize(window, &w, &h);
  1024     SDL_GetRendererOutputSize(renderer, &w, &h);
  1026 
  1025 
  1027     data->glPixelStorei(GL_PACK_ALIGNMENT, 1);
  1026     data->glPixelStorei(GL_PACK_ALIGNMENT, 1);
  1028 
  1027 
  1029     data->glReadPixels(rect->x, (h-rect->y)-rect->h, rect->w, rect->h,
  1028     data->glReadPixels(rect->x, (h-rect->y)-rect->h, rect->w, rect->h,
  1030                        GL_RGBA, GL_UNSIGNED_BYTE, temp_pixels);
  1029                        GL_RGBA, GL_UNSIGNED_BYTE, temp_pixels);