diff src/video/ps3/SDL_ps3render.c @ 3153:a16c4ec43631 gsoc2009_ps3

Fixed bug in texture format.
author Martin Lowinski <martin@goldtopf.org>
date Mon, 10 Aug 2009 13:28:58 +0000
parents 7f3341cccf42
children cce01ba54174
line wrap: on
line diff
--- a/src/video/ps3/SDL_ps3render.c	Thu Aug 06 12:24:47 2009 +0000
+++ b/src/video/ps3/SDL_ps3render.c	Mon Aug 10 13:28:58 2009 +0000
@@ -326,9 +326,6 @@
                 /* We should never get here (caught above) */
                 break;
         }
-        if ((texture->format & SDL_PIXELFORMAT_YV12 || texture->format & SDL_PIXELFORMAT_IYUV)
-                && texture->w % 16 == 0 && texture->h % 16 == 0) {
-        }
     } else {
         data->pixels = NULL;
         data->pixels = SDL_malloc(texture->h * data->pitch);
@@ -536,8 +533,8 @@
     deprintf(1, "texture->h = %u\n", texture->h);
 
     if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) {
-        deprintf(1, "SDL_ISPIXELFORMAT_FOURCC = true\n");
-        if ((texture->format & SDL_PIXELFORMAT_YV12 || texture->format & SDL_PIXELFORMAT_IYUV)
+        deprintf(1, "Texture is in a FOURCC format\n");
+        if ((texture->format == SDL_PIXELFORMAT_YV12 || texture->format == SDL_PIXELFORMAT_IYUV)
                 && texture->w % 8 == 0 && texture->h % 8 == 0
                 && dstrect->w % 8 == 0 && dstrect->h % 8 == 0) {
             deprintf(1, "Use SPE for scaling/converting\n");
@@ -546,7 +543,7 @@
             Uint8 *lum, *Cr, *Cb;
             Uint8 *scaler_out = NULL;
             Uint8 *dstpixels;
-            switch (swdata->format) {
+            switch (texture->format) {
                 case SDL_PIXELFORMAT_YV12:
                     lum = swdata->planes[0];
                     Cr = swdata->planes[1];
@@ -558,10 +555,13 @@
                     Cb = swdata->planes[1];
                     break;
                 default:
+                    /* We should never get here (caught above) */
                     return -1;
             }
 
             if (srcrect->w != dstrect->w || srcrect->h != dstrect->h) {
+                deprintf(1, "We need to scale the texture from %u x %u to %u x %u\n",
+                        srcrect->w, srcrect->h, dstrect->w, dstrect->h);
                 /* Alloc mem for scaled YUV picture */
                 scaler_out = (Uint8 *) memalign(16, dstrect->w * dstrect->h + ((dstrect->w * dstrect->h) >> 1));
                 if (scaler_out == NULL) {