src/render/opengl/SDL_render_gl.c
changeset 5265 48724afcdc6e
parent 5264 7ace5f8f432f
child 5276 8e421890cdb8
equal deleted inserted replaced
5264:7ace5f8f432f 5265:48724afcdc6e
   551     renderdata->glBindTexture(data->type, data->texture);
   551     renderdata->glBindTexture(data->type, data->texture);
   552     renderdata->glTexSubImage2D(data->type, 0, rect->x, rect->y, rect->w,
   552     renderdata->glTexSubImage2D(data->type, 0, rect->x, rect->y, rect->w,
   553                                 rect->h, data->format, data->formattype,
   553                                 rect->h, data->format, data->formattype,
   554                                 pixels);
   554                                 pixels);
   555     if (data->yuv) {
   555     if (data->yuv) {
       
   556         const void *top;
       
   557 
       
   558         renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH, (pitch / 2));
       
   559 
   556         /* Skip to the top of the next texture */
   560         /* Skip to the top of the next texture */
   557         const void *top = (const void*)((const Uint8*)pixels + (texture->h-rect->y) * pitch - rect->x);
   561         top = (const void*)((const Uint8*)pixels + (texture->h-rect->y) * pitch - rect->x);
   558 
   562 
   559         /* Skip to the correct offset into the next texture */
   563         /* Skip to the correct offset into the next texture */
   560         pixels = (const void*)((const Uint8*)top + (rect->y / 2) * pitch + rect->x / 2);
   564         pixels = (const void*)((const Uint8*)top + (rect->y / 2) * pitch + rect->x / 2);
   561         if (texture->format == SDL_PIXELFORMAT_YV12) {
   565         if (texture->format == SDL_PIXELFORMAT_YV12) {
   562             renderdata->glBindTexture(data->type, data->vtexture);
   566             renderdata->glBindTexture(data->type, data->vtexture);