summaryrefslogtreecommitdiff
path: root/beos/beos_throbber.cpp
diff options
context:
space:
mode:
authorFran├žois Revel <mmu_man@netsurf-browser.org>2008-08-13 19:35:41 +0000
committerFran├žois Revel <mmu_man@netsurf-browser.org>2008-08-13 19:35:41 +0000
commit44856d86d4efb12e08c8ef7560f39233107dfa8a (patch)
tree63b13b49ea54c5b2d505f1c77c1cd61c48c57766 /beos/beos_throbber.cpp
parent80c98b869433eb28e31da014b84c6839bc5908e6 (diff)
downloadnetsurf-44856d86d4efb12e08c8ef7560f39233107dfa8a.tar.gz
netsurf-44856d86d4efb12e08c8ef7560f39233107dfa8a.tar.bz2
Fix the BeOS build:
- hack to work around stdbool.h issue with R5 devkit - fix prototypes - fix bitmap code - fix copy-paste on forward button - remove unused gif throbber loading code - R5 rgb_color doesn't have != operator, use memcmp() - switch back to file based [beos]default.css for the time being - realpath() hack for R5 Regressions: - asserts on haiku-os.org - no libns* yet, so less image support - text field input doesn't work anymore. svn path=/trunk/netsurf/; revision=5109
Diffstat (limited to 'beos/beos_throbber.cpp')
-rw-r--r--beos/beos_throbber.cpp113
1 files changed, 1 insertions, 112 deletions
diff --git a/beos/beos_throbber.cpp b/beos/beos_throbber.cpp
index 55fce870c..8ed3663fb 100644
--- a/beos/beos_throbber.cpp
+++ b/beos/beos_throbber.cpp
@@ -17,12 +17,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#define __STDBOOL_H__ 1
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
extern "C" {
#include "utils/log.h"
-#include "image/gifread.h"
}
#include "beos/beos_throbber.h"
#include "beos/beos_bitmap.h"
@@ -106,117 +106,6 @@ bool nsbeos_throbber_initialise_from_png(const int frames, ...)
return true;
}
-/**
- * Creates the throbber using a single GIF, using the first frame as the
- * inactive throbber, and the others for the active animation. The GIF must
- * therefor have at least two frames.
- *
- * \param fn Filename of GIF to use. It must have at least two frames.
- * \return true on success.
- */
-bool nsbeos_throbber_initialise_from_gif(const char *fn)
-{
- /* disect the GIF provided by filename in *fn into a series of
- * BBitmap for use later.
- */
- struct gif_animation *gif; /**< structure for gifread.c */
- struct nsbeos_throbber *throb; /**< structure we generate */
- int i;
-
- FILE *fh = fopen(fn, "rb");
-
- if (fh == NULL) {
- LOG(("Unable to open throbber image '%s' for reading!", fn));
- return false;
- }
-
- gif = (struct gif_animation *)malloc(sizeof(struct gif_animation));
- throb = (struct nsbeos_throbber *)malloc(sizeof(struct nsbeos_throbber));
-
- /* discover the size of the data file. */
- fseek(fh, 0, SEEK_END);
- gif->buffer_size = ftell(fh);
- fseek(fh, 0, SEEK_SET);
-
- /* allocate a block of sufficient size, and load the data in. */
- gif->gif_data = (unsigned char *)malloc(gif->buffer_size);
- fread(gif->gif_data, gif->buffer_size, 1, fh);
- fclose(fh);
-
- /* set current position within GIF file to beginning, in order to
- * signal to gifread that we're brand new.
- */
- gif->buffer_position = 0;
-
- /* initialise the gif_animation structure. */
- switch (gif_initialise(gif))
- {
- case GIF_INSUFFICIENT_FRAME_DATA:
- case GIF_FRAME_DATA_ERROR:
- case GIF_INSUFFICIENT_DATA:
- case GIF_DATA_ERROR:
- LOG(("GIF image '%s' appears invalid!", fn));
- free(gif->gif_data);
- free(gif);
- free(throb);
- return false;
- break;
- case GIF_INSUFFICIENT_MEMORY:
- LOG(("Ran out of memory decoding GIF image '%s'!", fn));
- free(gif->gif_data);
- free(gif);
- free(throb);
- return false;
- break;
- }
-
- throb->nframes = gif->frame_count;
-
- if (throb->nframes < 2)
- {
- /* we need at least two frames - one for idle, one for active */
- LOG(("Insufficent number of frames in throbber image '%s'!",
- fn));
- LOG(("(GIF contains %d frames, where 2 is a minimum.)",
- throb->nframes));
- free(gif->gif_data);
- free(gif);
- free(throb);
- return false;
- }
-
- throb->framedata = (BBitmap **)malloc(sizeof(BBitmap *)
- * throb->nframes);
-
- /* decode each frame in turn, extracting the struct bitmap * for each,
- * and put that in our array of frames.
- */
- for (i = 0; i < throb->nframes; i++)
- {
- gif_decode_frame(gif, i);
- throb->framedata[i] = new BBitmap(
- nsbeos_bitmap_get_primary(gif->frame_image));
- }
-
- gif_finalise(gif);
- free(gif->gif_data);
- free(gif);
-
- /* debug code: save out each frame as a PNG to make sure decoding is
- * working correctly.
-
- for (i = 0; i < throb->nframes; i++) {
- char fname[20];
- sprintf(fname, "frame%d.png", i);
- gdk_pixbuf_save(throb->framedata[i], fname, "png", NULL, NULL);
- }
- */
-
- nsbeos_throbber = throb;
-
- return true;
-}
-
void nsbeos_throbber_finalise(void)
{
int i;