| 1610 | #endif /* SDL_HAVE_YUV */ |
| 1611 | |
| 1612 | int SDL_UpdateYUVTexture(SDL_Texture * texture, const SDL_Rect * rect, |
| 1613 | const Uint8 *Yplane, int Ypitch, |
| 1614 | const Uint8 *Uplane, int Upitch, |
| 1615 | const Uint8 *Vplane, int Vpitch) |
| 1616 | { |
| 1617 | #if SDL_HAVE_YUV |
| 1618 | SDL_Renderer *renderer; |
| 1619 | SDL_Rect full_rect; |
| 1620 | |
| 1621 | CHECK_TEXTURE_MAGIC(texture, -1); |
| 1622 | |
| 1623 | if (!Yplane) { |
| 1624 | return SDL_InvalidParamError("Yplane"); |
| 1625 | } |
| 1626 | if (!Ypitch) { |
| 1627 | return SDL_InvalidParamError("Ypitch"); |
| 1628 | } |
| 1629 | if (!Uplane) { |
| 1630 | return SDL_InvalidParamError("Uplane"); |
| 1631 | } |
| 1632 | if (!Upitch) { |
| 1633 | return SDL_InvalidParamError("Upitch"); |
| 1634 | } |
| 1635 | if (!Vplane) { |
| 1636 | return SDL_InvalidParamError("Vplane"); |
| 1637 | } |
| 1638 | if (!Vpitch) { |
| 1639 | return SDL_InvalidParamError("Vpitch"); |
| 1640 | } |
| 1641 | |
| 1642 | if (texture->format != SDL_PIXELFORMAT_YV12 && |
| 1643 | texture->format != SDL_PIXELFORMAT_IYUV) { |
| 1644 | return SDL_SetError("Texture format must by YV12 or IYUV"); |
| 1645 | } |
| 1646 | |
| 1647 | if (!rect) { |
| 1648 | full_rect.x = 0; |
| 1649 | full_rect.y = 0; |
| 1650 | full_rect.w = texture->w; |
| 1651 | full_rect.h = texture->h; |
| 1652 | rect = &full_rect; |
| 1653 | } |
| 1654 | |
| 1655 | if (!rect->w || !rect->h) { |
| 1656 | return 0; /* nothing to do. */ |
| 1657 | } |
| 1658 | |
| 1659 | if (texture->yuv) { |
| 1660 | return SDL_UpdateTextureYUVPlanar(texture, rect, Yplane, Ypitch, Uplane, Upitch, Vplane, Vpitch); |
| 1661 | } else { |
| 1662 | SDL_assert(!texture->native); |
| 1663 | renderer = texture->renderer; |
| 1664 | SDL_assert(renderer->UpdateTextureYUV); |
| 1665 | if (renderer->UpdateTextureYUV) { |
| 1666 | if (FlushRenderCommandsIfTextureNeeded(texture) < 0) { |
| 1667 | return -1; |
| 1668 | } |
| 1669 | return renderer->UpdateTextureYUV(renderer, texture, rect, Yplane, Ypitch, Uplane, Upitch, Vplane, Vpitch); |
nothing calls this directly
no test coverage detected