src/render/opengles2/SDL_render_gles2.c
changeset 5214 b0797947dd1c
parent 5213 25ad4a50d34f
child 5222 c66b2a778b7e
equal deleted inserted replaced
5213:25ad4a50d34f 5214:b0797947dd1c
   387                     rect->w,
   387                     rect->w,
   388                     rect->h,
   388                     rect->h,
   389                     tdata->pixel_format,
   389                     tdata->pixel_format,
   390                     tdata->pixel_type,
   390                     tdata->pixel_type,
   391                     src);
   391                     src);
       
   392     SDL_free(blob);
       
   393 
   392     if (glGetError() != GL_NO_ERROR)
   394     if (glGetError() != GL_NO_ERROR)
   393     {
   395     {
   394         SDL_SetError("Failed to update texture");
   396         SDL_SetError("Failed to update texture");
   395         return -1;
   397         return -1;
   396     }
   398     }
   397 
       
   398     /* Update the (streaming) texture buffer, in one pass if possible */
       
   399     if (tdata->pixel_data)
       
   400     {
       
   401         dest = (Uint8 *)tdata->pixel_data +
       
   402                (tdata->pitch * rect->y) +
       
   403                (SDL_BYTESPERPIXEL(texture->format) * rect->x);
       
   404         if (rect->w == texture->w)
       
   405         {
       
   406             SDL_memcpy(dest, src, srcPitch * rect->h);
       
   407         }
       
   408         else
       
   409         {
       
   410             for (y = 0; y < rect->h; ++y)
       
   411             {
       
   412                 SDL_memcpy(dest, src, srcPitch);
       
   413                 src += srcPitch;
       
   414                 dest += tdata->pitch;
       
   415             }
       
   416         }
       
   417     }
       
   418 
       
   419     /* Clean up and return */
       
   420     SDL_free(blob);
       
   421     return 0;
   399     return 0;
   422 }
   400 }
   423 
   401 
   424 /*************************************************************************************************
   402 /*************************************************************************************************
   425  * Shader management functions                                                                   *
   403  * Shader management functions                                                                   *