~ubuntu-branches/ubuntu/trusty/libsdl2/trusty

« back to all changes in this revision

Viewing changes to src/render/SDL_yuv_sw.c

  • Committer: Package Import Robot
  • Author(s): Manuel A. Fernandez Montecelo
  • Date: 2013-08-12 20:45:31 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20130812204531-ohq46dgh5s6fp7pi
Tags: 2.0.0+dfsg1-1
* New upstream release
* Filter upstream tarball from binaries and unneeded cruft
  - Remove from debian/copyright files that are now filtered out when creating
    the orig.tar
* Add build-dependency on libdbus-1-dev, to use D-Bus
* Switch to @debian.org address
* Bring the man page of sdl-config up to date

Show diffs side-by-side

added added

removed removed

Lines of Context:
82
82
 * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
83
83
 */
84
84
 
 
85
#include "SDL_assert.h"
85
86
#include "SDL_video.h"
86
87
#include "SDL_cpuinfo.h"
87
88
#include "SDL_yuv_sw_c.h"
1029
1030
    int i;
1030
1031
    int CR, CB;
1031
1032
 
 
1033
    switch (format) {
 
1034
    case SDL_PIXELFORMAT_YV12:
 
1035
    case SDL_PIXELFORMAT_IYUV:
 
1036
    case SDL_PIXELFORMAT_YUY2:
 
1037
    case SDL_PIXELFORMAT_UYVY:
 
1038
    case SDL_PIXELFORMAT_YVYU:
 
1039
        break;
 
1040
    default:
 
1041
        SDL_SetError("Unsupported YUV format");
 
1042
        return NULL;
 
1043
    }
 
1044
 
1032
1045
    swdata = (SDL_SW_YUVTexture *) SDL_calloc(1, sizeof(*swdata));
1033
1046
    if (!swdata) {
1034
1047
        SDL_OutOfMemory();
1035
1048
        return NULL;
1036
1049
    }
1037
1050
 
1038
 
    switch (format) {
1039
 
    case SDL_PIXELFORMAT_YV12:
1040
 
    case SDL_PIXELFORMAT_IYUV:
1041
 
    case SDL_PIXELFORMAT_YUY2:
1042
 
    case SDL_PIXELFORMAT_UYVY:
1043
 
    case SDL_PIXELFORMAT_YVYU:
1044
 
        break;
1045
 
    default:
1046
 
        SDL_SW_DestroyYUVTexture(swdata);
1047
 
        SDL_SetError("Unsupported YUV format");
1048
 
        return NULL;
1049
 
    }
1050
 
 
1051
1051
    swdata->format = format;
1052
1052
    swdata->target_format = SDL_PIXELFORMAT_UNKNOWN;
1053
1053
    swdata->w = w;
1095
1095
        swdata->planes[0] = swdata->pixels;
1096
1096
        break;
1097
1097
    default:
1098
 
        /* We should never get here (caught above) */
 
1098
        SDL_assert(0 && "We should never get here (caught above)");
1099
1099
        break;
1100
1100
    }
1101
1101
 
1202
1202
        break;
1203
1203
    }
1204
1204
 
1205
 
    *pixels = swdata->planes[0] + rect->y * swdata->pitches[0] + rect->x * 2;
 
1205
    if (rect) {
 
1206
        *pixels = swdata->planes[0] + rect->y * swdata->pitches[0] + rect->x * 2;
 
1207
    } else {
 
1208
        *pixels = swdata->planes[0];
 
1209
    }
1206
1210
    *pitch = swdata->pitches[0];
1207
1211
    return 0;
1208
1212
}