Mercurial > sdl-ios-xcode
comparison src/video/quartz/SDL_QuartzYUV.m @ 3871:4d11f2ae7582 SDL-1.2
Fixed bug #276
PlanarPixmapInfoYUV420 is a big endian structure.
Fix contributed by Jean-Charles BERTIN
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 24 Sep 2006 00:04:06 +0000 |
parents | eed7a3f396ce |
children | a1b03ba2fcd0 |
comparison
equal
deleted
inserted
replaced
3870:571c75f3d093 | 3871:4d11f2ae7582 |
---|---|
272 if (pixels == NULL || pitches == NULL) { | 272 if (pixels == NULL || pitches == NULL) { |
273 SDL_OutOfMemory(); | 273 SDL_OutOfMemory(); |
274 return NULL; | 274 return NULL; |
275 } | 275 } |
276 | 276 |
277 /* Fix: jc.bertin@free.fr | |
278 PlanarPixmapInfoYUV420 is a big-endian struct */ | |
277 yuv_pixmap = (PlanarPixmapInfoYUV420*) | 279 yuv_pixmap = (PlanarPixmapInfoYUV420*) |
278 SDL_malloc (sizeof(PlanarPixmapInfoYUV420) + | 280 SDL_malloc (sizeof(PlanarPixmapInfoYUV420) + |
279 (width * height * 2)); | 281 (width * height * 2)); |
280 if (yuv_pixmap == NULL) { | 282 if (yuv_pixmap == NULL) { |
281 SDL_OutOfMemory (); | 283 SDL_OutOfMemory (); |
289 | 291 |
290 pixels[0] = (Uint8*)yuv_pixmap + offset; | 292 pixels[0] = (Uint8*)yuv_pixmap + offset; |
291 /* CHECK_ALIGN(pixels[0]); */ | 293 /* CHECK_ALIGN(pixels[0]); */ |
292 | 294 |
293 pitches[0] = width; | 295 pitches[0] = width; |
294 yuv_pixmap->componentInfoY.offset = offset; | 296 yuv_pixmap->componentInfoY.offset = EndianS32_NtoB(offset); |
295 yuv_pixmap->componentInfoY.rowBytes = width; | 297 yuv_pixmap->componentInfoY.rowBytes = EndianU32_NtoB(width); |
296 | 298 |
297 offset += width * height; | 299 offset += width * height; |
298 pixels[plane2] = (Uint8*)yuv_pixmap + offset; | 300 pixels[plane2] = (Uint8*)yuv_pixmap + offset; |
299 pitches[plane2] = width / 2; | 301 pitches[plane2] = width / 2; |
300 yuv_pixmap->componentInfoCb.offset = offset; | 302 yuv_pixmap->componentInfoCb.offset = EndianS32_NtoB(offset); |
301 yuv_pixmap->componentInfoCb.rowBytes = width / 2; | 303 yuv_pixmap->componentInfoCb.rowBytes = EndianU32_NtoB(width / 2); |
302 | 304 |
303 offset += (width * height / 4); | 305 offset += (width * height / 4); |
304 pixels[plane3] = (Uint8*)yuv_pixmap + offset; | 306 pixels[plane3] = (Uint8*)yuv_pixmap + offset; |
305 pitches[plane3] = width / 2; | 307 pitches[plane3] = width / 2; |
306 yuv_pixmap->componentInfoCr.offset = offset; | 308 yuv_pixmap->componentInfoCr.offset = EndianS32_NtoB(offset); |
307 yuv_pixmap->componentInfoCr.rowBytes = width / 2; | 309 yuv_pixmap->componentInfoCr.rowBytes = EndianU32_NtoB(width / 2); |
308 | 310 |
309 overlay->pixels = pixels; | 311 overlay->pixels = pixels; |
310 overlay->pitches = pitches; | 312 overlay->pitches = pitches; |
311 } | 313 } |
312 | 314 |