1
0
mirror of git://projects.qi-hardware.com/openwrt-packages.git synced 2025-04-21 12:27:27 +03:00

liballegro: minor cleanup, fixes, tuning

This commit is contained in:
David Kühling
2011-06-02 13:05:26 +02:00
parent 3fe0b2e5d7
commit 61755836b8
3 changed files with 67 additions and 34 deletions

View File

@@ -1,7 +1,7 @@
Index: allegro-4.4.2/demos/shooter/demo.c
===================================================================
--- allegro-4.4.2.orig/demos/shooter/demo.c 2011-06-01 20:05:58.000000000 +0200
+++ allegro-4.4.2/demos/shooter/demo.c 2011-06-01 20:06:18.000000000 +0200
--- allegro-4.4.2.orig/demos/shooter/demo.c 2011-06-02 12:32:25.000000000 +0200
+++ allegro-4.4.2/demos/shooter/demo.c 2011-06-02 12:32:44.000000000 +0200
@@ -1,3 +1,5 @@
+#define DEBUGMODE
+
@@ -18,8 +18,8 @@ Index: allegro-4.4.2/demos/shooter/demo.c
set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
Index: allegro-4.4.2/demos/shooter/display.c
===================================================================
--- allegro-4.4.2.orig/demos/shooter/display.c 2011-06-01 20:05:59.000000000 +0200
+++ allegro-4.4.2/demos/shooter/display.c 2011-06-01 20:06:18.000000000 +0200
--- allegro-4.4.2.orig/demos/shooter/display.c 2011-06-02 12:30:09.000000000 +0200
+++ allegro-4.4.2/demos/shooter/display.c 2011-06-02 12:32:44.000000000 +0200
@@ -28,18 +28,19 @@
break;
}
@@ -53,13 +53,13 @@ Index: allegro-4.4.2/demos/shooter/display.c
set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
Index: allegro-4.4.2/demos/shooter/game.c
===================================================================
--- allegro-4.4.2.orig/demos/shooter/game.c 2011-06-01 20:05:59.000000000 +0200
+++ allegro-4.4.2/demos/shooter/game.c 2011-06-01 20:37:13.000000000 +0200
--- allegro-4.4.2.orig/demos/shooter/game.c 2011-06-02 12:30:09.000000000 +0200
+++ allegro-4.4.2/demos/shooter/game.c 2011-06-02 12:36:29.000000000 +0200
@@ -58,12 +58,18 @@
static void draw_intro_item(int item, int size)
{
BITMAP *b = (BITMAP *) data[item].dat;
+ BITMAP *b_n = create_bitmap_ex(32, b->w, b->h);
+ BITMAP *b_n = create_bitmap_ex(bitmap_color_depth(screen), b->w, b->h);
+ clear_to_color(b_n,0xffff);
+ set_palette(data[GAME_PAL].dat);
+ blit (b, b_n, 0, 0, 0, 0, b->w, b->h);
@@ -77,34 +77,52 @@ Index: allegro-4.4.2/demos/shooter/game.c
Index: allegro-4.4.2/demos/shooter/title.c
===================================================================
--- allegro-4.4.2.orig/demos/shooter/title.c 2011-06-01 20:05:58.000000000 +0200
+++ allegro-4.4.2/demos/shooter/title.c 2011-06-01 20:06:18.000000000 +0200
@@ -843,10 +843,11 @@
--- allegro-4.4.2.orig/demos/shooter/title.c 2011-06-02 12:32:26.000000000 +0200
+++ allegro-4.4.2/demos/shooter/title.c 2011-06-02 12:38:29.000000000 +0200
@@ -844,10 +844,18 @@
scroll_count = 1;
install_int(scroll_counter, 5);
- while ((c = scroll_count) < 160)
+ /* fix for stretch_blit: won't work over different color depth */
+ BITMAP *title = data[TITLE_BMP].dat;
+ BITMAP *title_n = create_bitmap_ex(bitmap_color_depth(screen),
+ title->w, title->h);
+ blit (title, title_n, 0, 0, 0, 0, title->w, title->h);
while ((c = scroll_count) < 160)
- stretch_blit(data[TITLE_BMP].dat, screen, 0, 0, 320, 128,
- SCREEN_W / 2 - c, SCREEN_H / 2 - c * 64 / 160 - 32,
- c * 2, c * 128 / 160);
+ /* todo: stretch_blit won't work over color depth */
+ /* while ((c = scroll_count) < 160) */
+ /* stretch_blit(data[TITLE_BMP].dat, screen, 0, 0, 320, 128, */
+ /* SCREEN_W / 2 - c, SCREEN_H / 2 - c * 64 / 160 - 32, */
+ /* c * 2, c * 128 / 160); */
+ {
+ stretch_blit(title_n, screen, 0, 0, 320, 128,
SCREEN_W / 2 - c, SCREEN_H / 2 - c * 64 / 160 - 32,
c * 2, c * 128 / 160);
+ }
+ destroy_bitmap(title_n);
remove_int(scroll_counter);
Index: allegro-4.4.2/demos/shooter/dirty.c
===================================================================
--- allegro-4.4.2.orig/demos/shooter/dirty.c 2011-06-01 20:11:58.000000000 +0200
+++ allegro-4.4.2/demos/shooter/dirty.c 2011-06-01 20:12:08.000000000 +0200
@@ -93,7 +93,7 @@
--- allegro-4.4.2.orig/demos/shooter/dirty.c 2011-06-02 12:30:09.000000000 +0200
+++ allegro-4.4.2/demos/shooter/dirty.c 2011-06-02 12:33:37.000000000 +0200
@@ -92,10 +92,13 @@
acquire_screen();
+ /* setup palette_color[] */
+ set_color_depth(32);
+
for (c = 0; c < old_dirty.count; c++) {
- if ((old_dirty.rect[c].w == 1) && (old_dirty.rect[c].h == 1)) {
+ if (0 && (old_dirty.rect[c].w == 1) && (old_dirty.rect[c].h == 1)) {
if ((old_dirty.rect[c].w == 1) && (old_dirty.rect[c].h == 1)) {
putpixel(screen, old_dirty.rect[c].x, old_dirty.rect[c].y,
getpixel(bmp, old_dirty.rect[c].x, old_dirty.rect[c].y));
- getpixel(bmp, old_dirty.rect[c].x, old_dirty.rect[c].y));
+ palette_color[getpixel(bmp, old_dirty.rect[c].x, old_dirty.rect[c].y)]);
}
else {
blit(bmp, screen, old_dirty.rect[c].x, old_dirty.rect[c].y,
@@ -103,6 +106,7 @@
old_dirty.rect[c].w, old_dirty.rect[c].h);
}
}
+ set_color_depth(8);
release_screen();
}