summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharlie Brej <cbrej@cs.man.ac.uk>2010-04-18 15:51:17 +0100
committerCharlie Brej <cbrej@cs.man.ac.uk>2010-04-18 15:51:17 +0100
commit8c455e23833010db57b41838df5ab95e5c6f1b62 (patch)
tree262c91c6a6cef8e5e9e7827d4029af8628963b63
parent28ca40f6d5091179623ea9336f85f97a69bf8dd3 (diff)
[throbber] Move frames from image to pixel-buffers
The frames are now stored as pixel-buffers which will be cleaner to draw from in the future.
-rw-r--r--src/libply-splash-graphics/ply-throbber.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/libply-splash-graphics/ply-throbber.c b/src/libply-splash-graphics/ply-throbber.c
index 6ed9a259..a4bf27ef 100644
--- a/src/libply-splash-graphics/ply-throbber.c
+++ b/src/libply-splash-graphics/ply-throbber.c
@@ -104,11 +104,11 @@ static void
ply_throbber_remove_frames (ply_throbber_t *throbber)
{
int i;
- ply_image_t **frames;
+ ply_pixel_buffer_t **frames;
- frames = (ply_image_t **) ply_array_steal_elements (throbber->frames);
+ frames = (ply_pixel_buffer_t **) ply_array_steal_elements (throbber->frames);
for (i = 0; frames[i] != NULL; i++)
- ply_image_free (frames[i]);
+ ply_pixel_buffer_free (frames[i]);
free (frames);
}
@@ -131,7 +131,7 @@ animate_at_time (ply_throbber_t *throbber,
double time)
{
int number_of_frames;
- ply_image_t * const * frames;
+ ply_pixel_buffer_t * const * frames;
bool should_continue;
number_of_frames = ply_array_get_size (throbber->frames);
@@ -149,12 +149,10 @@ animate_at_time (ply_throbber_t *throbber,
should_continue = false;
}
- frames = (ply_image_t * const *) ply_array_get_elements (throbber->frames);
-
+ frames = (ply_pixel_buffer_t * const *) ply_array_get_elements (throbber->frames);
+ ply_pixel_buffer_get_size (frames[throbber->frame_number], &throbber->frame_area);
throbber->frame_area.x = throbber->x;
throbber->frame_area.y = throbber->y;
- throbber->frame_area.width = ply_image_get_width (frames[throbber->frame_number]);
- throbber->frame_area.height = ply_image_get_height (frames[throbber->frame_number]);
ply_pixel_display_draw_area (throbber->display,
throbber->x, throbber->y,
throbber->frame_area.width,
@@ -202,9 +200,10 @@ on_timeout (ply_throbber_t *throbber)
static bool
ply_throbber_add_frame (ply_throbber_t *throbber,
- const char *filename)
+ const char *filename)
{
ply_image_t *image;
+ ply_pixel_buffer_t *frame;
image = ply_image_new (filename);
@@ -214,10 +213,12 @@ ply_throbber_add_frame (ply_throbber_t *throbber,
return false;
}
- ply_array_add_element (throbber->frames, image);
+ frame = ply_image_convert_to_pixel_buffer (image);
+
+ ply_array_add_element (throbber->frames, frame);
- throbber->width = MAX (throbber->width, ply_image_get_width (image));
- throbber->height = MAX (throbber->height, ply_image_get_height (image));
+ throbber->width = MAX (throbber->width, ply_pixel_buffer_get_width (frame));
+ throbber->height = MAX (throbber->height, ply_pixel_buffer_get_height (frame));
return true;
}
@@ -365,14 +366,14 @@ ply_throbber_draw_area (ply_throbber_t *throbber,
unsigned long width,
unsigned long height)
{
- ply_image_t * const * frames;
+ ply_pixel_buffer_t * const * frames;
uint32_t *frame_data;
if (throbber->is_stopped)
return;
frames = (ply_image_t * const *) ply_array_get_elements (throbber->frames);
- frame_data = ply_image_get_data (frames[throbber->frame_number]);
+ frame_data = ply_pixel_buffer_get_argb32_data (frames[throbber->frame_number]);
ply_pixel_buffer_fill_with_argb32_data (buffer,
&throbber->frame_area,