mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-22 22:41:30 +03:00
[project @ 2004-03-21 12:50:10 by bursa]
Animation support, not yet optimised. svn path=/import/netsurf/; revision=641
This commit is contained in:
parent
f962f4301c
commit
15537fb20d
@ -65,6 +65,7 @@ typedef enum {
|
|||||||
CONTENT_MSG_STATUS, /**< new status string */
|
CONTENT_MSG_STATUS, /**< new status string */
|
||||||
CONTENT_MSG_REDIRECT, /**< replacement URL */
|
CONTENT_MSG_REDIRECT, /**< replacement URL */
|
||||||
CONTENT_MSG_REFORMAT, /**< content_reformat done */
|
CONTENT_MSG_REFORMAT, /**< content_reformat done */
|
||||||
|
CONTENT_MSG_REDRAW, /**< needs redraw (eg. new animation frame) */
|
||||||
#ifdef WITH_AUTH
|
#ifdef WITH_AUTH
|
||||||
CONTENT_MSG_AUTH /**< authentication required */
|
CONTENT_MSG_AUTH /**< authentication required */
|
||||||
#endif
|
#endif
|
||||||
|
@ -276,6 +276,10 @@ void browser_window_callback(content_msg msg, struct content *c,
|
|||||||
browser_window_update(bw, false);
|
browser_window_update(bw, false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CONTENT_MSG_REDRAW:
|
||||||
|
gui_window_redraw_window(bw->window);
|
||||||
|
break;
|
||||||
|
|
||||||
#ifdef WITH_AUTH
|
#ifdef WITH_AUTH
|
||||||
case CONTENT_MSG_AUTH:
|
case CONTENT_MSG_AUTH:
|
||||||
gui_401login_open(bw, c, error);
|
gui_401login_open(bw, c, error);
|
||||||
@ -474,6 +478,9 @@ void download_window_callback(content_msg msg, struct content *c,
|
|||||||
case CONTENT_MSG_REFORMAT:
|
case CONTENT_MSG_REFORMAT:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CONTENT_MSG_REDRAW:
|
||||||
|
break;
|
||||||
|
|
||||||
#ifdef WITH_AUTH
|
#ifdef WITH_AUTH
|
||||||
case CONTENT_MSG_AUTH:
|
case CONTENT_MSG_AUTH:
|
||||||
break;
|
break;
|
||||||
|
@ -641,6 +641,11 @@ void html_object_callback(content_msg msg, struct content *object,
|
|||||||
case CONTENT_MSG_REFORMAT:
|
case CONTENT_MSG_REFORMAT:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CONTENT_MSG_REDRAW:
|
||||||
|
/** \todo send up box coordinates */
|
||||||
|
content_broadcast(c, CONTENT_MSG_REDRAW, 0);
|
||||||
|
break;
|
||||||
|
|
||||||
#ifdef WITH_AUTH
|
#ifdef WITH_AUTH
|
||||||
case CONTENT_MSG_AUTH:
|
case CONTENT_MSG_AUTH:
|
||||||
c->data.html.object[i].content = 0;
|
c->data.html.object[i].content = 0;
|
||||||
|
39
riscos/gif.c
39
riscos/gif.c
@ -22,6 +22,7 @@
|
|||||||
#include "netsurf/utils/config.h"
|
#include "netsurf/utils/config.h"
|
||||||
#include "netsurf/content/content.h"
|
#include "netsurf/content/content.h"
|
||||||
#include "netsurf/riscos/gif.h"
|
#include "netsurf/riscos/gif.h"
|
||||||
|
#include "netsurf/riscos/gui.h"
|
||||||
#include "netsurf/riscos/options.h"
|
#include "netsurf/riscos/options.h"
|
||||||
#include "netsurf/riscos/tinct.h"
|
#include "netsurf/riscos/tinct.h"
|
||||||
#include "netsurf/utils/log.h"
|
#include "netsurf/utils/log.h"
|
||||||
@ -56,6 +57,9 @@
|
|||||||
|
|
||||||
static bool nsgif_decompress_frame(struct content *c, anim *p_gif_animation,
|
static bool nsgif_decompress_frame(struct content *c, anim *p_gif_animation,
|
||||||
unsigned int cur_frame);
|
unsigned int cur_frame);
|
||||||
|
static void nsgif_animate(void *p);
|
||||||
|
static osspriteop_header *nsgif_get_sprite_address(struct content *c,
|
||||||
|
unsigned int frame);
|
||||||
static void CompressSpriteLine( pixel *dest, const pixel *src, int n, int bpp );
|
static void CompressSpriteLine( pixel *dest, const pixel *src, int n, int bpp );
|
||||||
static void CompressMaskLine( pixel *dest, const pixel *src, int n, int bpp );
|
static void CompressMaskLine( pixel *dest, const pixel *src, int n, int bpp );
|
||||||
|
|
||||||
@ -224,6 +228,9 @@ int nsgif_convert(struct content *c, unsigned int iwidth, unsigned int iheight)
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (c->data.gif.animate_gif)
|
||||||
|
schedule(frame_delays[0], nsgif_animate, c);
|
||||||
|
|
||||||
/* Exit as a success
|
/* Exit as a success
|
||||||
*/
|
*/
|
||||||
return 0;
|
return 0;
|
||||||
@ -367,7 +374,7 @@ void nsgif_redraw(struct content *c, long x, long y,
|
|||||||
|
|
||||||
/* Hack - animate as if 4cs have passed every redraw
|
/* Hack - animate as if 4cs have passed every redraw
|
||||||
*/
|
*/
|
||||||
nsgif_animate(c, 4);
|
/* nsgif_animate(c, 4); */
|
||||||
|
|
||||||
/* Check if we need to expand the current frame to 32bpp
|
/* Check if we need to expand the current frame to 32bpp
|
||||||
*/
|
*/
|
||||||
@ -412,13 +419,30 @@ void nsgif_destroy(struct content *c) {
|
|||||||
/** Performs any necessary animation.
|
/** Performs any necessary animation.
|
||||||
|
|
||||||
@param c The content to animate
|
@param c The content to animate
|
||||||
@param advance_time The number of cs to move the animation forwards
|
|
||||||
@return 0 for no further scheduling as the animation has finished, or
|
|
||||||
>0 to indicate the number of cs until the next animation frame, or
|
|
||||||
<0 to indicate that an animation has occured. The absolute value
|
|
||||||
indicates the number of cs until the next animation frame.
|
|
||||||
*/
|
*/
|
||||||
int nsgif_animate(struct content *c, unsigned int advance_time) {
|
void nsgif_animate(void *p)
|
||||||
|
{
|
||||||
|
struct content *c = p;
|
||||||
|
|
||||||
|
/* at the moment just advance by one frame */
|
||||||
|
c->data.gif.current_frame++;
|
||||||
|
if (c->data.gif.current_frame == c->data.gif.total_frames) {
|
||||||
|
if (!c->data.gif.loop_gif) {
|
||||||
|
c->data.gif.current_frame--;
|
||||||
|
c->data.gif.animate_gif = false;
|
||||||
|
return;
|
||||||
|
} else
|
||||||
|
c->data.gif.current_frame = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
schedule(c->data.gif.frame_transitions[c->data.gif.current_frame],
|
||||||
|
nsgif_animate, c);
|
||||||
|
|
||||||
|
content_broadcast(c, CONTENT_MSG_REDRAW, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
unsigned int max_frame;
|
unsigned int max_frame;
|
||||||
unsigned int cur_frame;
|
unsigned int cur_frame;
|
||||||
unsigned int old_frame;
|
unsigned int old_frame;
|
||||||
@ -478,6 +502,7 @@ int nsgif_animate(struct content *c, unsigned int advance_time) {
|
|||||||
return (advance_time - delay_values[cur_frame]);
|
return (advance_time - delay_values[cur_frame]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
10
riscos/gif.h
10
riscos/gif.h
@ -19,7 +19,7 @@ struct content_gif_data {
|
|||||||
/* The sprite area containing the 8bpp frames.
|
/* The sprite area containing the 8bpp frames.
|
||||||
*/
|
*/
|
||||||
osspriteop_area *sprite_area;
|
osspriteop_area *sprite_area;
|
||||||
|
|
||||||
/* The sprite header of the current 32bpp image.
|
/* The sprite header of the current 32bpp image.
|
||||||
*/
|
*/
|
||||||
osspriteop_header *buffer_header;
|
osspriteop_header *buffer_header;
|
||||||
@ -27,7 +27,7 @@ struct content_gif_data {
|
|||||||
/** The current frame number of the GIF to display, [0...(max-1)]
|
/** The current frame number of the GIF to display, [0...(max-1)]
|
||||||
*/
|
*/
|
||||||
unsigned int current_frame;
|
unsigned int current_frame;
|
||||||
|
|
||||||
/** The current frame that we hold a 32bpp version of [0...(max-1)]
|
/** The current frame that we hold a 32bpp version of [0...(max-1)]
|
||||||
*/
|
*/
|
||||||
unsigned int expanded_frame;
|
unsigned int expanded_frame;
|
||||||
@ -39,7 +39,7 @@ struct content_gif_data {
|
|||||||
/** Whether the GIF should loop
|
/** Whether the GIF should loop
|
||||||
*/
|
*/
|
||||||
bool loop_gif;
|
bool loop_gif;
|
||||||
|
|
||||||
/** The number of cs unprocessed as the next transition has
|
/** The number of cs unprocessed as the next transition has
|
||||||
not yet occurred.
|
not yet occurred.
|
||||||
*/
|
*/
|
||||||
@ -52,18 +52,16 @@ struct content_gif_data {
|
|||||||
/** An array of times (in cs) for the frame transitions between each frame
|
/** An array of times (in cs) for the frame transitions between each frame
|
||||||
*/
|
*/
|
||||||
unsigned int *frame_transitions;
|
unsigned int *frame_transitions;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void nsgif_init(void);
|
void nsgif_init(void);
|
||||||
void nsgif_create(struct content *c, const char *params[]);
|
void nsgif_create(struct content *c, const char *params[]);
|
||||||
int nsgif_convert(struct content *c, unsigned int width, unsigned int height);
|
int nsgif_convert(struct content *c, unsigned int width, unsigned int height);
|
||||||
void nsgif_destroy(struct content *c);
|
void nsgif_destroy(struct content *c);
|
||||||
int nsgif_animate(struct content *c, unsigned int advance_time);
|
|
||||||
void nsgif_redraw(struct content *c, long x, long y,
|
void nsgif_redraw(struct content *c, long x, long y,
|
||||||
unsigned long width, unsigned long height,
|
unsigned long width, unsigned long height,
|
||||||
long clip_x0, long clip_y0, long clip_x1, long clip_y1,
|
long clip_x0, long clip_y0, long clip_x1, long clip_y1,
|
||||||
float scale);
|
float scale);
|
||||||
osspriteop_header *nsgif_get_sprite_address(struct content *c, unsigned int frame);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user