[xiph-commits] r9743 - trunk/planarity
xiphmont at svn.xiph.org
xiphmont at svn.xiph.org
Fri Aug 12 22:20:23 PDT 2005
Author: xiphmont
Date: 2005-08-12 22:20:20 -0700 (Fri, 12 Aug 2005)
New Revision: 9743
Modified:
trunk/planarity/buttonbar.c
trunk/planarity/finish.c
trunk/planarity/gameboard.c
trunk/planarity/gameboard.h
trunk/planarity/pause.c
trunk/planarity/version.h
Log:
Back out the animated curtain; repeating patterns with alpha have poor
rendering performance (for now).
Modified: trunk/planarity/buttonbar.c
===================================================================
--- trunk/planarity/buttonbar.c 2005-08-12 20:44:38 UTC (rev 9742)
+++ trunk/planarity/buttonbar.c 2005-08-13 05:20:20 UTC (rev 9743)
@@ -24,12 +24,6 @@
if(!g->first_expose)return 1;
- if(get_curtain(g)>0.){
- set_curtain(g,get_curtain(g)-.25);
- return 1;
- }
- set_curtain(g,0);
-
ret=animate_button_frame(g);
if(!ret && timer!=0){
@@ -50,11 +44,11 @@
}else
ret=1;
- if(get_curtain(g)==0.){
-
+ {
+
int width=get_board_width();
int w2=width/2;
-
+
for(i=0;i<NUMBUTTONS;i++){
buttonstate *b=states+i;
if(b->position){
@@ -67,13 +61,6 @@
ret|=animate_button_frame(ptr);
}
- if(!ret){
- if(get_curtain(g)<.625){
- set_curtain(g,get_curtain(g)+.25);
- ret=1;
- }
- }
-
if(!ret)
// undeploy finished... call the undeploy callback
undeploy_callback(g);
Modified: trunk/planarity/finish.c
===================================================================
--- trunk/planarity/finish.c 2005-08-12 20:44:38 UTC (rev 9742)
+++ trunk/planarity/finish.c 2005-08-13 05:20:20 UTC (rev 9743)
@@ -42,7 +42,7 @@
}
static void finish_quit (Gameboard *g){
- quit();
+ gtk_main_quit();
}
static void undeploy_buttons(Gameboard *g){
Modified: trunk/planarity/gameboard.c
===================================================================
--- trunk/planarity/gameboard.c 2005-08-12 20:44:38 UTC (rev 9742)
+++ trunk/planarity/gameboard.c 2005-08-13 05:20:20 UTC (rev 9743)
@@ -498,55 +498,35 @@
#define CW 4
static void cache_curtain(Gameboard *g){
- cairo_surface_t *ret=
+ int x,y;
+ cairo_t *c;
+ g->curtains=
cairo_surface_create_similar (cairo_get_target (g->wc),
CAIRO_CONTENT_COLOR_ALPHA,
CW,CW);
-
- g->curtains=ret;
- g->curtain_alpha=0.;
-}
-
-void set_curtain(Gameboard *g, double alpha){
- if(alpha != g->curtain_alpha){
-
- if(g->curtainp)
- cairo_pattern_destroy(g->curtainp);
- g->curtainp=0;
-
- if(alpha<1.){
- cairo_t *c = cairo_create(g->curtains);
- int x,y;
+
+ c = cairo_create(g->curtains);
+ cairo_save(c);
+ cairo_set_operator(c,CAIRO_OPERATOR_CLEAR);
+ cairo_set_source_rgba (c, 1,1,1,1);
+ cairo_paint(c);
+ cairo_restore(c);
- cairo_save(c);
- cairo_set_operator(c,CAIRO_OPERATOR_CLEAR);
- cairo_set_source_rgba (c, 1,1,1,1);
- cairo_paint(c);
- cairo_restore(c);
-
- cairo_set_line_width(c,1);
- cairo_set_source_rgba (c, 0,0,0,alpha);
-
- for(y=0;y<CW;y++){
- for(x=y&1;x<CW;x+=2){
- cairo_move_to(c,x+.5,y);
- cairo_rel_line_to(c,0,1);
- }
- }
- cairo_stroke(c);
- cairo_destroy(c);
-
- g->curtainp=cairo_pattern_create_for_surface (g->curtains);
- cairo_pattern_set_extend (g->curtainp, CAIRO_EXTEND_REPEAT);
+ cairo_set_line_width(c,1);
+ cairo_set_source_rgba (c, 0,0,0,.5);
+
+ for(y=0;y<CW;y++){
+ for(x=y&1;x<CW;x+=2){
+ cairo_move_to(c,x+.5,y);
+ cairo_rel_line_to(c,0,1);
}
-
- run_immediate_expose(g,0,0,get_board_width(),get_board_height());
- g->curtain_alpha=alpha;
}
-}
+ cairo_stroke(c);
+ cairo_destroy(c);
+
+ g->curtainp=cairo_pattern_create_for_surface (g->curtains);
+ cairo_pattern_set_extend (g->curtainp, CAIRO_EXTEND_REPEAT);
-double get_curtain(Gameboard *g){
- return g->curtain_alpha;
}
static gint mouse_motion(GtkWidget *widget,
@@ -867,31 +847,28 @@
}
void push_curtain(Gameboard *g,void(*redraw_callback)(Gameboard *g)){
- if(g->pushed_background){
- if(!g->pushed_curtain){
- cairo_t *c = cairo_create(g->background);
- int w = g->w.allocation.width;
- int h = g->w.allocation.height;
- g->pushed_curtain=1;
-
- g->redraw_callback=redraw_callback;
- cairo_set_source (c, g->curtainp);
- cairo_rectangle (c, 0, 0, get_board_width(), get_board_height());
- cairo_fill (c);
- cairo_destroy(c);
-
- if(redraw_callback)redraw_callback(g);
-
- {
- GdkRectangle r;
- r.x=0;
- r.y=0;
- r.width=w;
- r.height=h;
-
- gdk_window_invalidate_rect (g->w.window, &r, FALSE);
- }
-
+ if(!g->pushed_background)push_background(g,0);
+ if(!g->pushed_curtain){
+ cairo_t *c = cairo_create(g->background);
+ int w = g->w.allocation.width;
+ int h = g->w.allocation.height;
+ g->pushed_curtain=1;
+
+ g->redraw_callback=redraw_callback;
+ cairo_set_source (c, g->curtainp);
+ cairo_paint(c);
+ cairo_destroy(c);
+
+ if(redraw_callback)redraw_callback(g);
+
+ {
+ GdkRectangle r;
+ r.x=0;
+ r.y=0;
+ r.width=w;
+ r.height=h;
+
+ gdk_window_invalidate_rect (g->w.window, &r, FALSE);
}
}
}
@@ -929,14 +906,6 @@
expose_intersections(g,c,x,y,w,h);
}
- if(!g->pushed_curtain){
- if(g->curtain_alpha>0.){
- cairo_set_source (c, g->curtainp);
- cairo_rectangle (c, 0, 0, get_board_width(), get_board_height());
- cairo_fill (c);
- }
- }
-
expose_buttons(g,c,x,y,w,h);
cairo_destroy(c);
Modified: trunk/planarity/gameboard.h
===================================================================
--- trunk/planarity/gameboard.h 2005-08-12 20:44:38 UTC (rev 9742)
+++ trunk/planarity/gameboard.h 2005-08-13 05:20:20 UTC (rev 9743)
@@ -53,7 +53,7 @@
cairo_surface_t *foreground;
cairo_pattern_t *curtainp;
cairo_surface_t *curtains;
- double curtain_alpha;
+
int delayed_background;
vertex *grabbed_vertex;
@@ -103,8 +103,6 @@
extern void invalidate_region_vertex(Gameboard *g, vertex *v);
extern int selected(Gameboard *g);
extern void update_full(Gameboard *g);
-extern double get_curtain(Gameboard *g);
-extern void set_curtain(Gameboard *g, double alpha);
extern void pop_background(Gameboard *g);
extern void push_background(Gameboard *g, void (*callback)(Gameboard *g));
extern void push_curtain(Gameboard *g, void (*callback)(Gameboard *g));
Modified: trunk/planarity/pause.c
===================================================================
--- trunk/planarity/pause.c 2005-08-12 20:44:38 UTC (rev 9742)
+++ trunk/planarity/pause.c 2005-08-13 05:20:20 UTC (rev 9743)
@@ -45,7 +45,7 @@
}
static void unpause_quit (Gameboard *g){
- quit();
+ gtk_main_quit();
}
static void undeploy_buttons(Gameboard *g){
Modified: trunk/planarity/version.h
===================================================================
--- trunk/planarity/version.h 2005-08-12 20:44:38 UTC (rev 9742)
+++ trunk/planarity/version.h 2005-08-13 05:20:20 UTC (rev 9743)
@@ -1,2 +1,2 @@
#define VERSION "$Id$ "
-/* DO NOT EDIT: Automated versioning hack [Thu Aug 11 20:51:22 EDT 2005] */
+/* DO NOT EDIT: Automated versioning hack [Sat Aug 13 01:18:54 EDT 2005] */
More information about the commits
mailing list