Author: richard
Date: Mon Feb 9 06:48:26 2009
New Revision: 4089
URL: http://svn.slimdevices.com?rev=4089&root=Jive&view=rev
Log:
Bug: N/A
Description:
Another attempt at fixing default bpp in Surface:newRGB().
Added Framework:draw() to draw the whole screen to a surface, this can be used
for transitions.
Some white space cleanup.
Modified:
7.4/trunk/squeezeplay/src/squeezeplay/share/applets/Screenshot/ScreenshotApplet.lua
7.4/trunk/squeezeplay/src/squeezeplay/share/jive/JiveMain.lua
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/applets/Screenshot/ScreenshotApplet.lua
URL:
http://svn.slimdevices.com/7.4/trunk/squeezeplay/src/squeezeplay/share/applets/Screenshot/ScreenshotApplet.lua?rev=4089&root=Jive&r1=4088&r2=4089&view=diff
==============================================================================
---
7.4/trunk/squeezeplay/src/squeezeplay/share/applets/Screenshot/ScreenshotApplet.lua
(original)
+++
7.4/trunk/squeezeplay/src/squeezeplay/share/applets/Screenshot/ScreenshotApplet.lua
Mon Feb 9 06:48:26 2009
@@ -51,7 +51,6 @@
end
end
end
-
local file = path .. string.format("/squeezeplay%04d.bmp", self.number)
self.number = self.number + 1
Modified: 7.4/trunk/squeezeplay/src/squeezeplay/share/jive/JiveMain.lua
URL:
http://svn.slimdevices.com/7.4/trunk/squeezeplay/src/squeezeplay/share/jive/JiveMain.lua?rev=4089&root=Jive&r1=4088&r2=4089&view=diff
==============================================================================
--- 7.4/trunk/squeezeplay/src/squeezeplay/share/jive/JiveMain.lua (original)
+++ 7.4/trunk/squeezeplay/src/squeezeplay/share/jive/JiveMain.lua Mon Feb 9
06:48:26 2009
@@ -355,6 +355,7 @@
return _fullscreen
end
+
function JiveMain:setFullscreen(fullscreen)
_fullscreen = fullscreen
end
@@ -363,12 +364,12 @@
function JiveMain:setSelectedSkin(appletName)
log:warn(appletName)
if _loadSkin(self, appletName, false, true) then
- self.selectedSkin = appletName
- end
-end
+ self.selectedSkin = appletName
+ end
+end
+
function JiveMain:getSkinParam(key)
-
local skinName = self.selectedSkin or JiveMain:getDefaultSkin()
if key and self.skinParams and self.skinParams[skinName] and
self.skinParams[skinName][key] then
@@ -377,18 +378,16 @@
log:error('no value for skinParam ', key, ' found')
return nil
end
-
-end
+end
+
-- service method to allow other applets to set skin-specific settings like
THUMB_SIZE
function JiveMain:setSkinParams(skinName, settings)
-
_assert(type(settings) == 'table')
if not self.skinParams then
self.skinParams = {}
end
self.skinParams[skinName] = settings
-
end
@@ -399,25 +398,16 @@
end
--- loadSkin
--- XXXX deprecated, to be replaced with per window skinning
-function JiveMain:loadSkin(appletName, method)
- log:debug("loadSkin(", appletName, ")")
-
- local obj = appletManager:loadApplet(appletName)
- assert(obj, "Cannot load skin " .. appletName)
-
- obj[method](obj, jive.ui.style)
-end
-
function JiveMain:setDefaultSkin(appletName)
log:debug("setDefaultSkin(", appletName, ")")
_defaultSkin = appletName
end
+
function JiveMain:getDefaultSkin()
return _defaultSkin or "DefaultSkin"
end
+
-----------------------------------------------------------------------------
-- main()
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=4089&root=Jive&r1=4088&r2=4089&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 Feb
9 06:48:26 2009
@@ -221,6 +221,8 @@
module.KEY_PAGE_DOWN = jive.ui.KEY_PAGE_DOWN
module.KEY_VOLUME_UP = jive.ui.KEY_VOLUME_UP
module.KEY_VOLUME_DOWN = jive.ui.KEY_VOLUME_DOWN
+
+ module.FRAME_RATE = jive.ui.FRAME_RATE
end
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=4089&root=Jive&r1=4088&r2=4089&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 Feb 9
06:48:26 2009
@@ -321,30 +321,25 @@
}
-static int _update_screen(lua_State *L) {
+static int _draw_screen(lua_State *L) {
JiveSurface *srf;
- Uint32 t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0;
+ Uint32 t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0;
clock_t c0 = 0, c1 = 0;
+ bool_t force_redraw;
+
JIVEL_STACK_CHECK_BEGIN(L);
-
- if (!update_screen) {
- return 0;
- }
/* stack is:
* 1: framework
- */
-
- lua_getfield(L, 1, "screen");
- lua_getfield(L, -1, "surface");
- srf = tolua_tousertype(L, -1, 0);
- lua_replace(L, -2);
-
-
- /* Exit if we have no windows. We need to check
- * again as the event handlers may have changed
- * the window stack */
+ * 2: surface (in screen format)
+ * 3: force_redraw
+ */
+
+ srf = tolua_tousertype(L, 2, 0);
+ force_redraw = lua_toboolean(L, 3);
+
+ /* Exit if we have no windows, nothing to draw */
lua_getfield(L, 1, "windowStack");
if (lua_objlen(L, -1) == 0) {
lua_pop(L, 2);
@@ -353,7 +348,6 @@
return 0;
}
lua_rawgeti(L, -1, 1);
-
if (perfwarn.screen) {
t0 = SDL_GetTicks();
@@ -427,11 +421,8 @@
lua_pushvalue(L, -3); // widget
lua_pushvalue(L, 2); // surface
lua_call(L, 2, 0);
-
- if (perfwarn.screen) t4 = SDL_GetTicks();
- jive_surface_flip(srf);
- }
- else if (jive_dirty_region.w) {
+ }
+ else if (jive_dirty_region.w || force_redraw) {
#if 0
printf("REDRAW: %d,%d %dx%d\n", jive_dirty_region.x,
jive_dirty_region.y, jive_dirty_region.w, jive_dirty_region.h);
#endif
@@ -454,25 +445,21 @@
lua_call(L, 3, 0);
}
jive_dirty_region.w = 0;
-
- /* Flip buffer */
- if (perfwarn.screen) t4 = SDL_GetTicks();
- jive_surface_flip(srf);
}
if (perfwarn.screen) {
- t5 = SDL_GetTicks();
+ t4 = SDL_GetTicks();
c1 = clock();
- if (t5-t0 > perfwarn.screen) {
+ if (t4-t0 > perfwarn.screen) {
if (!t3) {
- t3 = t2; t4 = t2;
- }
- printf("update_screen > %dms: %4dms (%dms) [layout:%dms
animate:%dms background:%dms draw:%dms flip:%dms]\n",
- perfwarn.screen, t5-t0, (int)((c1-c0) * 1000
/ CLOCKS_PER_SEC), t1-t0, t2-t1, t3-t2, t4-t3, t5-t4);
+ t3 = t2;
+ }
+ printf("update_screen > %dms: %4dms (%dms) [layout:%dms
animate:%dms background:%dms draw:%dms]\n",
+ perfwarn.screen, t4-t0, (int)((c1-c0) * 1000
/ CLOCKS_PER_SEC), t1-t0, t2-t1, t3-t2, t4-t3);
}
}
- lua_pop(L, 4);
+ lua_pop(L, 3);
JIVEL_STACK_CHECK_END(L);
@@ -480,22 +467,62 @@
}
-int jiveL_update_screen(lua_State *L) {
+int jiveL_draw(lua_State *L) {
/* stack is:
* 1: framework
+ * 2: surface
*/
lua_pushcfunction(L, jive_traceback); /* push traceback function */
- lua_pushcfunction(L, _update_screen);
+ lua_pushcfunction(L, _draw_screen);
lua_pushvalue(L, 1);
-
- if (lua_pcall(L, 1, 0, 2) != 0) {
- fprintf(stderr, "error in event function:\n\t%s\n",
lua_tostring(L, -1));
+ lua_pushvalue(L, 2);
+ lua_pushboolean(L, 1);
+
+ if (lua_pcall(L, 3, 0, 3) != 0) {
+ fprintf(stderr, "error in draw_screen:\n\t%s\n",
lua_tostring(L, -1));
return 0;
}
lua_pop(L, 1);
+
+ return 0;
+}
+
+
+int jiveL_update_screen(lua_State *L) {
+ JiveSurface *screen;
+
+ /* stack is:
+ * 1: framework
+ */
+
+ if (!update_screen) {
+ return 0;
+ }
+
+ lua_pushcfunction(L, jive_traceback); /* push traceback function */
+
+ lua_pushcfunction(L, _draw_screen);
+ lua_pushvalue(L, 1);
+
+ lua_getfield(L, 1, "screen");
+ lua_getfield(L, -1, "surface");
+ lua_replace(L, -2);
+ screen = tolua_tousertype(L, -1, 0);
+
+ lua_pushboolean(L, 0);
+
+ if (lua_pcall(L, 3, 0, 2) != 0) {
+ fprintf(stderr, "error in update_screen:\n\t%s\n",
lua_tostring(L, -1));
+ return 0;
+ }
+
+ /* flip screen */
+ jive_surface_flip(screen);
+
+ lua_pop(L, 2);
return 0;
}
@@ -1272,6 +1299,7 @@
{ "quit", jiveL_quit },
{ "processEvents", jiveL_process_events },
{ "setUpdateScreen", jiveL_set_update_screen },
+ { "draw", jiveL_draw },
{ "updateScreen", jiveL_update_screen },
{ "reDraw", jiveL_redraw },
{ "pushEvent", jiveL_push_event },
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=4089&root=Jive&r1=4088&r2=4089&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 Feb 9
06:48:26 2009
@@ -8,9 +8,6 @@
#include "common.h"
#include "jive.h"
-
-Uint16 default_bpp;
-
JiveSurface *jive_surface_set_video_mode(Uint16 w, Uint16 h, Uint16 bpp, bool
fullscreen) {
@@ -53,8 +50,6 @@
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)
}
- default_bpp = bpp;
-
srf = calloc(sizeof(JiveSurface), 1);
srf->refcount = 1;
srf->sdl = sdl;
@@ -64,9 +59,13 @@
JiveSurface *jive_surface_newRGB(Uint16 w, Uint16 h) {
JiveSurface *srf;
- SDL_Surface *sdl;
-
- sdl = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, default_bpp, 0, 0, 0,
0);
+ SDL_Surface *screen, *sdl;
+ int bpp;
+
+ screen = SDL_GetVideoSurface();
+ bpp = screen->format->BitsPerPixel;
+
+ sdl = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, bpp, 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