Author: richard
Date: Mon Jan 26 13:18:47 2009
New Revision: 3937

URL: http://svn.slimdevices.com?rev=3937&root=Jive&view=rev
Log:
Bug: N/A
Description:
A better fix to get the correct bit depth when using non 16bpp surfaces.


Modified:
    7.4/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Framework.lua
    7.4/trunk/squeezeplay/src/squeezeplay/src/ui/jive_framework.c
    7.4/trunk/squeezeplay/src/squeezeplay/src/ui/jive_surface.c

Modified: 7.4/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Framework.lua
URL: 
http://svn.slimdevices.com/7.4/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Framework.lua?rev=3937&root=Jive&r1=3936&r2=3937&view=diff
==============================================================================
--- 7.4/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Framework.lua (original)
+++ 7.4/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Framework.lua Mon Jan 
26 13:18:47 2009
@@ -313,27 +313,6 @@
 end
 
 
-
-
---[[
-
-=head2 jive.ui.Framework:setEmulation(w, h, bpp)
-
-Sets the screen size I<w, h>, and bbp I<bpp>. This must be called before 
jive.ui.Framework:init(). This has no effect on a hardware platform.
-
-=cut
---]]
-function setScreenSize(self, w, h, bpp)
-       _assert(type(w) == "number")
-       _assert(type(h) == "number")
-       _assert(type(bpp) == "number")
-
-       screen.bounds[3] = w
-       screen.bounds[4] = h
-       screen.bpp = bpp
-end
-
-
 --[[
 
 =head2 jive.ui.Framework:getScreenSize()

Modified: 7.4/trunk/squeezeplay/src/squeezeplay/src/ui/jive_framework.c
URL: 
http://svn.slimdevices.com/7.4/trunk/squeezeplay/src/squeezeplay/src/ui/jive_framework.c?rev=3937&root=Jive&r1=3936&r2=3937&view=diff
==============================================================================
--- 7.4/trunk/squeezeplay/src/squeezeplay/src/ui/jive_framework.c (original)
+++ 7.4/trunk/squeezeplay/src/squeezeplay/src/ui/jive_framework.c Mon Jan 26 
13:18:47 2009
@@ -133,7 +133,7 @@
        lua_pop(L, 1);
 
        lua_getfield(L, -1, "bpp");
-       screen_bpp = luaL_optint(L, -1, 16);
+       screen_bpp = luaL_optint(L, -1, 0);
        lua_pop(L, 1);
 
        screen_w = r.w;
@@ -151,7 +151,7 @@
 
        /* report video info */
        video_info = SDL_GetVideoInfo();
-       DEBUG_TRACE("%d bits per pixel [R<<%d G<<%d B<<%d]", 
video_info->vfmt->BitsPerPixel, video_info->vfmt->Rshift, 
video_info->vfmt->Gshift, video_info->vfmt->Bshift)
+       DEBUG_TRACE("%d bits/pixel %d bytes/pixel [R<<%d G<<%d B<<%d]", 
video_info->vfmt->BitsPerPixel, video_info->vfmt->BytesPerPixel, 
video_info->vfmt->Rshift, video_info->vfmt->Gshift, video_info->vfmt->Bshift)
        DEBUG_TRACE("Hardware acceleration %s available", 
video_info->hw_available?"is":"is not");
 
        /* Register callback for additional events (used for multimedia keys)*/

Modified: 7.4/trunk/squeezeplay/src/squeezeplay/src/ui/jive_surface.c
URL: 
http://svn.slimdevices.com/7.4/trunk/squeezeplay/src/squeezeplay/src/ui/jive_surface.c?rev=3937&root=Jive&r1=3936&r2=3937&view=diff
==============================================================================
--- 7.4/trunk/squeezeplay/src/squeezeplay/src/ui/jive_surface.c (original)
+++ 7.4/trunk/squeezeplay/src/squeezeplay/src/ui/jive_surface.c Mon Jan 26 
13:18:47 2009
@@ -4,12 +4,10 @@
 ** This file is subject to the Logitech Public Source License Version 1.0. 
Please see the LICENCE file for details.
 */
 
+#define RUNTIME_DEBUG 1
 
 #include "common.h"
 #include "jive.h"
-
-
-Uint16 default_bpp;
 
 
 JiveSurface *jive_surface_set_video_mode(Uint16 w, Uint16 h, Uint16 bpp, bool 
fullscreen) {
@@ -24,18 +22,33 @@
            flags = SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_RESIZABLE;
        }
 
-       sdl = SDL_SetVideoMode (w, h, bpp, flags);
+       sdl = SDL_GetVideoSurface();
+
+       if (sdl) {
+               /* check if we can reuse the existing suface? */
+               Uint32 mask = (SDL_FULLSCREEN | SDL_HWSURFACE | SDL_DOUBLEBUF | 
SDL_RESIZABLE);
+
+               if ((sdl->w != w) || (sdl->h != h)
+                   || (sdl->format->BitsPerPixel != bpp) || ((sdl->flags & 
mask) != flags)) {
+                       sdl = NULL;
+               }
+       }
+
        if (!sdl) {
-               fprintf(stderr, "SDL_SetVideoMode(%d,%d,%d): %s\n",
-                       w, h, bpp, SDL_GetError());
-               return NULL;
-       }
-
-       if ( (sdl->flags & SDL_HWSURFACE) && !(sdl->flags & SDL_DOUBLEBUF)) {
-               DEBUG_ERROR("WARNING: Not using a hardware double buffer\n");
-       }
-
-       default_bpp = bpp;
+               /* create new surface */
+               sdl = SDL_SetVideoMode (w, h, bpp, flags);
+               if (!sdl) {
+                       DEBUG_ERROR("SDL_SetVideoMode(%d,%d,%d): %s",
+                                   w, h, bpp, SDL_GetError());
+                       return NULL;
+               }
+
+               if ( (sdl->flags & SDL_HWSURFACE) && (sdl->flags & 
SDL_DOUBLEBUF)) {
+                       DEBUG_TRACE("Using a hardware double buffer");
+               }
+
+               DEBUG_TRACE("Video mode: %d bits/pixel %d bytes/pixel [R<<%d 
G<<%d B<<%d]", sdl->format->BitsPerPixel, sdl->format->BytesPerPixel, 
sdl->format->Rshift, sdl->format->Gshift, sdl->format->Bshift)
+       }
 
        srf = calloc(sizeof(JiveSurface), 1);
        srf->refcount = 1;
@@ -48,7 +61,7 @@
        JiveSurface *srf;
        SDL_Surface *sdl;
 
-       sdl = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, default_bpp, 0, 0, 0, 
0);
+       sdl = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 0, 0, 0, 0, 0);
 
        /* Opaque surface */
        SDL_SetAlpha(sdl, SDL_SRCALPHA, SDL_ALPHA_OPAQUE);

_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/cgi-bin/mailman/listinfo/jive-checkins

Reply via email to