Remove unecessary includes from RISC OS bitmap header.

The RISC OS bitmap header was including several headers it simply did
not require. This removed those includes and also cleans up the
documentation comments to completely cover the exported interface.
This commit is contained in:
Vincent Sanders 2015-04-19 12:40:58 +01:00
parent 10f621441f
commit 8f41764268
2 changed files with 103 additions and 66 deletions

View File

@ -103,14 +103,7 @@ static bool bitmap_initialise(struct bitmap *bitmap)
} }
/** /* exported interface documented in riscos/bitmap.h */
* Create a bitmap.
*
* \param width width of image in pixels
* \param height width of image in pixels
* \param state the state to create the bitmap in.
* \return an opaque struct bitmap, or NULL on memory exhaustion
*/
void *riscos_bitmap_create(int width, int height, unsigned int state) void *riscos_bitmap_create(int width, int height, unsigned int state)
{ {
struct bitmap *bitmap; struct bitmap *bitmap;
@ -129,15 +122,7 @@ void *riscos_bitmap_create(int width, int height, unsigned int state)
} }
/** /* exported interface documented in riscos/bitmap.h */
* Return a pointer to the pixel data in a bitmap.
*
* The pixel data is packed as BITMAP_FORMAT, possibly with padding at the end
* of rows. The width of a row in bytes is given by bitmap_get_rowstride().
*
* \param vbitmap a bitmap, as returned by bitmap_create()
* \return pointer to the pixel buffer
*/
unsigned char *riscos_bitmap_get_buffer(void *vbitmap) unsigned char *riscos_bitmap_get_buffer(void *vbitmap)
{ {
struct bitmap *bitmap = (struct bitmap *) vbitmap; struct bitmap *bitmap = (struct bitmap *) vbitmap;
@ -175,12 +160,7 @@ static void bitmap_set_opaque(void *vbitmap, bool opaque)
} }
/** /* exported interface documented in riscos/bitmap.h */
* Find the width of a pixel row in bytes.
*
* \param vbitmap a bitmap, as returned by bitmap_create()
* \return width of a pixel row in the bitmap
*/
size_t riscos_bitmap_get_rowstride(void *vbitmap) size_t riscos_bitmap_get_rowstride(void *vbitmap)
{ {
struct bitmap *bitmap = (struct bitmap *) vbitmap; struct bitmap *bitmap = (struct bitmap *) vbitmap;
@ -237,11 +217,7 @@ static bool bitmap_test_opaque(void *vbitmap)
} }
/** /* exported interface documented in riscos/bitmap.h */
* Gets whether a bitmap should be plotted opaque
*
* \param vbitmap a bitmap, as returned by bitmap_create()
*/
bool riscos_bitmap_get_opaque(void *vbitmap) bool riscos_bitmap_get_opaque(void *vbitmap)
{ {
struct bitmap *bitmap = (struct bitmap *) vbitmap; struct bitmap *bitmap = (struct bitmap *) vbitmap;
@ -250,11 +226,7 @@ bool riscos_bitmap_get_opaque(void *vbitmap)
} }
/** /* exported interface documented in riscos/bitmap.h */
* Free a bitmap.
*
* \param vbitmap a bitmap, as returned by bitmap_create()
*/
void riscos_bitmap_destroy(void *vbitmap) void riscos_bitmap_destroy(void *vbitmap)
{ {
struct bitmap *bitmap = (struct bitmap *) vbitmap; struct bitmap *bitmap = (struct bitmap *) vbitmap;
@ -270,14 +242,7 @@ void riscos_bitmap_destroy(void *vbitmap)
} }
/** /* exported interface documented in riscos/bitmap.h */
* Save a bitmap in the platform's native format.
*
* \param vbitmap a bitmap, as returned by bitmap_create()
* \param path pathname for file
* \param flags modify the behaviour of the save
* \return true on success, false on error and error reported
*/
bool riscos_bitmap_save(void *vbitmap, const char *path, unsigned flags) bool riscos_bitmap_save(void *vbitmap, const char *path, unsigned flags)
{ {
struct bitmap *bitmap = (struct bitmap *) vbitmap; struct bitmap *bitmap = (struct bitmap *) vbitmap;
@ -443,11 +408,7 @@ bool riscos_bitmap_save(void *vbitmap, const char *path, unsigned flags)
} }
/** /* exported interface documented in riscos/bitmap.h */
* The bitmap image has changed, so flush any persistent cache.
*
* \param vbitmap a bitmap, as returned by bitmap_create()
*/
void riscos_bitmap_modified(void *vbitmap) void riscos_bitmap_modified(void *vbitmap)
{ {
struct bitmap *bitmap = (struct bitmap *) vbitmap; struct bitmap *bitmap = (struct bitmap *) vbitmap;
@ -455,6 +416,7 @@ void riscos_bitmap_modified(void *vbitmap)
} }
/* exported interface documented in riscos/bitmap.h */
int riscos_bitmap_get_width(void *vbitmap) int riscos_bitmap_get_width(void *vbitmap)
{ {
struct bitmap *bitmap = (struct bitmap *) vbitmap; struct bitmap *bitmap = (struct bitmap *) vbitmap;
@ -462,6 +424,7 @@ int riscos_bitmap_get_width(void *vbitmap)
} }
/* exported interface documented in riscos/bitmap.h */
int riscos_bitmap_get_height(void *vbitmap) int riscos_bitmap_get_height(void *vbitmap)
{ {
struct bitmap *bitmap = (struct bitmap *) vbitmap; struct bitmap *bitmap = (struct bitmap *) vbitmap;
@ -482,13 +445,10 @@ static size_t bitmap_get_bpp(void *vbitmap)
return 4; return 4;
} }
/**
* Overlay a sprite onto the given bitmap /* exported interface documented in riscos/bitmap.h */
* void riscos_bitmap_overlay_sprite(struct bitmap *bitmap,
* \param bitmap bitmap object const osspriteop_header *s)
* \param s 8bpp sprite to be overlayed onto bitmap
*/
void riscos_bitmap_overlay_sprite(struct bitmap *bitmap, const osspriteop_header *s)
{ {
const os_colour *palette; const os_colour *palette;
const byte *sp, *mp; const byte *sp, *mp;

View File

@ -19,36 +19,113 @@
#ifndef _NETSURF_RISCOS_BITMAP_H_ #ifndef _NETSURF_RISCOS_BITMAP_H_
#define _NETSURF_RISCOS_BITMAP_H_ #define _NETSURF_RISCOS_BITMAP_H_
struct osspriteop_area;
struct osspriteop_header;
/** bitmap operations table */ /** bitmap operations table */
struct gui_bitmap_table *riscos_bitmap_table; struct gui_bitmap_table *riscos_bitmap_table;
#include <stdbool.h>
#include "oslib/osspriteop.h"
#include "image/bitmap.h"
/** save with full alpha channel (if not opaque) */ /** save with full alpha channel (if not opaque) */
#define BITMAP_SAVE_FULL_ALPHA (1 << 0) #define BITMAP_SAVE_FULL_ALPHA (1 << 0)
struct osspriteop_area; /**
* RISC OS wimp toolkit bitmap.
*/
struct bitmap { struct bitmap {
int width; int width; /**< width of bitmap */
int height; int height; /**< height of bitmap */
unsigned int state; unsigned int state; /**< The bitmap attributes (opaque/dirty etc.) */
osspriteop_area *sprite_area; /** Uncompressed data, or NULL */ struct osspriteop_area *sprite_area; /**< Uncompressed data, or NULL */
}; };
void riscos_bitmap_overlay_sprite(struct bitmap *bitmap, const osspriteop_header *s);
void riscos_bitmap_destroy(void *vbitmap); /**
* Overlay a sprite onto the given bitmap
*
* \param bitmap bitmap object
* \param s 8bpp sprite to be overlayed onto bitmap
*/
void riscos_bitmap_overlay_sprite(struct bitmap *bitmap, const struct osspriteop_header *s);
/**
* Create a bitmap.
*
* \param width width of image in pixels
* \param height width of image in pixels
* \param state the state to create the bitmap in.
* \return an opaque struct bitmap, or NULL on memory exhaustion
*/
void *riscos_bitmap_create(int width, int height, unsigned int state); void *riscos_bitmap_create(int width, int height, unsigned int state);
/**
* Free a bitmap.
*
* \param vbitmap a bitmap, as returned by bitmap_create()
*/
void riscos_bitmap_destroy(void *vbitmap);
/**
* Return a pointer to the pixel data in a bitmap.
*
* The pixel data is packed as BITMAP_FORMAT, possibly with padding at
* the end of rows. The width of a row in bytes is given by
* riscos_bitmap_get_rowstride().
*
* \param vbitmap A bitmap as returned by riscos_bitmap_create()
* \return pointer to the pixel buffer
*/
unsigned char *riscos_bitmap_get_buffer(void *vbitmap); unsigned char *riscos_bitmap_get_buffer(void *vbitmap);
/**
* The bitmap image has changed, so flush any persistent cache.
*
* \param vbitmap a bitmap, as returned by bitmap_create()
*/
void riscos_bitmap_modified(void *vbitmap); void riscos_bitmap_modified(void *vbitmap);
/**
* Get the width of a bitmap.
*
* \param vbitmap A bitmap, as returned by bitmap_create()
* \return The bitmaps width in pixels.
*/
int riscos_bitmap_get_width(void *vbitmap); int riscos_bitmap_get_width(void *vbitmap);
/**
* Get the height of a bitmap.
*
* \param vbitmap A bitmap, as returned by bitmap_create()
* \return The bitmaps height in pixels.
*/
int riscos_bitmap_get_height(void *vbitmap); int riscos_bitmap_get_height(void *vbitmap);
/**
* Find the width of a pixel row in bytes.
*
* \param vbitmap A bitmap, as returned by riscos_bitmap_create()
* \return width of a pixel row in the bitmap
*/
size_t riscos_bitmap_get_rowstride(void *vbitmap); size_t riscos_bitmap_get_rowstride(void *vbitmap);
/**
* Gets whether a bitmap should be plotted opaque
*
* \param vbitmap A bitmap, as returned by riscos_bitmap_create()
*/
bool riscos_bitmap_get_opaque(void *vbitmap); bool riscos_bitmap_get_opaque(void *vbitmap);
/**
* Save a bitmap in the platform's native format.
*
* \param vbitmap a bitmap, as returned by bitmap_create()
* \param path pathname for file
* \param flags modify the behaviour of the save
* \return true on success, false on error and error reported
*/
bool riscos_bitmap_save(void *vbitmap, const char *path, unsigned flags); bool riscos_bitmap_save(void *vbitmap, const char *path, unsigned flags);
#endif #endif