os: Add const qualifiers to blit library

This commit is contained in:
Norman Feske 2013-09-07 02:01:03 +02:00
parent 690fc51fad
commit 664aff2a56
7 changed files with 19 additions and 21 deletions

View File

@ -28,8 +28,7 @@
* If the source and destination overlap, the result
* of the copy operation is not defined.
*/
extern "C" void blit(void *src, unsigned src_w,
void *dst, unsigned dst_w,
int w, int h);
extern "C" void blit(void const *src, unsigned src_w,
void *dst, unsigned dst_w, int w, int h);
#endif /* _INCLUDE__BLIT__BLIT_H_ */

View File

@ -19,11 +19,11 @@
/**
* Copy single 16bit column
*/
static inline void copy_16bit_column(char *src, int src_w,
static inline void copy_16bit_column(char const *src, int src_w,
char *dst, int dst_w, int h)
{
for (; h-- > 0; src += src_w, dst += dst_w)
*(short *)dst = *(short *)src;
*(short *)dst = *(short const *)src;
}
@ -37,7 +37,7 @@ static inline void copy_16bit_column(char *src, int src_w,
* \param src_w width of source buffer in bytes
* \param dst_w width of destination buffer in bytes
*/
static void copy_block_32bit(char *src, int src_w,
static void copy_block_32bit(char const *src, int src_w,
char *dst, int dst_w,
int w, int h)
{
@ -45,7 +45,7 @@ static void copy_block_32bit(char *src, int src_w,
dst_w -= w*4;
for (; h--; src += src_w, dst += dst_w) {
for (int i = w; i--; src += 4, dst += 4)
*((int *)dst) = *((int *)src);
*((int *)dst) = *((int const *)src);
}
}
@ -56,7 +56,7 @@ static void copy_block_32bit(char *src, int src_w,
* \param w width in 32 byte chunks to copy per line
* \param h number of lines of copy
*/
static inline void copy_block_32byte(char *src, int src_w,
static inline void copy_block_32byte(char const *src, int src_w,
char *dst, int dst_w,
int w, int h)
{

View File

@ -15,11 +15,12 @@
#include <blit_helper.h>
extern "C" void blit(void *s, unsigned src_w,
extern "C" void blit(void const *s, unsigned src_w,
void *d, unsigned dst_w,
int w, int h)
{
char *src = (char *)s, *dst = (char *)d;
char const *src = (char const *)s;
char *dst = (char *)d;
if (w <= 0 || h <= 0) return;

View File

@ -19,7 +19,7 @@
/**
* Copy single 16bit column
*/
static inline void copy_16bit_column(char *src, int src_w,
static inline void copy_16bit_column(char const *src, int src_w,
char *dst, int dst_w, int h)
{
for (; h-- > 0; src += src_w, dst += dst_w)
@ -37,7 +37,7 @@ static inline void copy_16bit_column(char *src, int src_w,
* \param src_w width of source buffer in bytes
* \param dst_w width of destination buffer in bytes
*/
static void copy_block_32bit(char *src, int src_w,
static void copy_block_32bit(char const *src, int src_w,
char *dst, int dst_w,
int w, int h)
{
@ -46,15 +46,13 @@ static void copy_block_32bit(char *src, int src_w,
}
/**
* Copy block with a size of multiple of 32 bytes
*
* \param w width in 32 byte chunks to copy per line
* \param h number of lines of copy
*/
static inline void copy_block_32byte(char *src, int src_w,
static inline void copy_block_32byte(char const *src, int src_w,
char *dst, int dst_w,
int w, int h)
{

View File

@ -20,11 +20,11 @@
/**
* Copy single 16bit column
*/
static inline void copy_16bit_column(char *src, int src_w,
static inline void copy_16bit_column(char const *src, int src_w,
char *dst, int dst_w, int h)
{
for (; h-- > 0; src += src_w, dst += dst_w)
*(short *)dst = *(short *)src;
*(short *)dst = *(short const *)src;
}
@ -38,7 +38,7 @@ static inline void copy_16bit_column(char *src, int src_w,
* \param src_w width of source buffer in bytes
* \param dst_w width of destination buffer in bytes
*/
static inline void copy_block_32bit(char *src, int src_w,
static inline void copy_block_32bit(char const *src, int src_w,
char *dst, int dst_w,
int w, int h)
{
@ -58,7 +58,7 @@ static inline void copy_block_32bit(char *src, int src_w,
* \param w width in 32 byte chunks to copy per line
* \param h number of lines of copy
*/
static inline void copy_block_32byte(char *src, int src_w,
static inline void copy_block_32byte(char const *src, int src_w,
char *dst, int dst_w,
int w, int h)
{

View File

@ -18,7 +18,7 @@
/**
* Copy 32byte chunks via MMX
*/
static inline void copy_32byte_chunks(void *src, void *dst, int size)
static inline void copy_32byte_chunks(void const *src, void *dst, int size)
{
asm volatile (
"emms \n\t"

View File

@ -17,7 +17,7 @@
/**
* Copy 32byte chunks via MMX
*/
static inline void copy_32byte_chunks(void *src, void *dst, int size)
static inline void copy_32byte_chunks(void const *src, void *dst, int size)
{
asm volatile (
"emms \n\t"