os: Add const qualifiers to blit library
This commit is contained in:
parent
690fc51fad
commit
664aff2a56
|
@ -28,8 +28,7 @@
|
||||||
* If the source and destination overlap, the result
|
* If the source and destination overlap, the result
|
||||||
* of the copy operation is not defined.
|
* of the copy operation is not defined.
|
||||||
*/
|
*/
|
||||||
extern "C" void blit(void *src, unsigned src_w,
|
extern "C" void blit(void const *src, unsigned src_w,
|
||||||
void *dst, unsigned dst_w,
|
void *dst, unsigned dst_w, int w, int h);
|
||||||
int w, int h);
|
|
||||||
|
|
||||||
#endif /* _INCLUDE__BLIT__BLIT_H_ */
|
#endif /* _INCLUDE__BLIT__BLIT_H_ */
|
||||||
|
|
|
@ -19,11 +19,11 @@
|
||||||
/**
|
/**
|
||||||
* Copy single 16bit column
|
* 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)
|
char *dst, int dst_w, int h)
|
||||||
{
|
{
|
||||||
for (; h-- > 0; src += src_w, dst += dst_w)
|
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 src_w width of source buffer in bytes
|
||||||
* \param dst_w width of destination 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,
|
char *dst, int dst_w,
|
||||||
int w, int h)
|
int w, int h)
|
||||||
{
|
{
|
||||||
|
@ -45,7 +45,7 @@ static void copy_block_32bit(char *src, int src_w,
|
||||||
dst_w -= w*4;
|
dst_w -= w*4;
|
||||||
for (; h--; src += src_w, dst += dst_w) {
|
for (; h--; src += src_w, dst += dst_w) {
|
||||||
for (int i = w; i--; src += 4, dst += 4)
|
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 w width in 32 byte chunks to copy per line
|
||||||
* \param h number of lines of copy
|
* \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,
|
char *dst, int dst_w,
|
||||||
int w, int h)
|
int w, int h)
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,11 +15,12 @@
|
||||||
#include <blit_helper.h>
|
#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,
|
void *d, unsigned dst_w,
|
||||||
int w, int h)
|
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;
|
if (w <= 0 || h <= 0) return;
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
/**
|
/**
|
||||||
* Copy single 16bit column
|
* 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)
|
char *dst, int dst_w, int h)
|
||||||
{
|
{
|
||||||
for (; h-- > 0; src += src_w, dst += dst_w)
|
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 src_w width of source buffer in bytes
|
||||||
* \param dst_w width of destination 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,
|
char *dst, int dst_w,
|
||||||
int w, int h)
|
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
|
* Copy block with a size of multiple of 32 bytes
|
||||||
*
|
*
|
||||||
* \param w width in 32 byte chunks to copy per line
|
* \param w width in 32 byte chunks to copy per line
|
||||||
* \param h number of lines of copy
|
* \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,
|
char *dst, int dst_w,
|
||||||
int w, int h)
|
int w, int h)
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,11 +20,11 @@
|
||||||
/**
|
/**
|
||||||
* Copy single 16bit column
|
* 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)
|
char *dst, int dst_w, int h)
|
||||||
{
|
{
|
||||||
for (; h-- > 0; src += src_w, dst += dst_w)
|
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 src_w width of source buffer in bytes
|
||||||
* \param dst_w width of destination 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,
|
char *dst, int dst_w,
|
||||||
int w, int h)
|
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 w width in 32 byte chunks to copy per line
|
||||||
* \param h number of lines of copy
|
* \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,
|
char *dst, int dst_w,
|
||||||
int w, int h)
|
int w, int h)
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
/**
|
/**
|
||||||
* Copy 32byte chunks via MMX
|
* 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 (
|
asm volatile (
|
||||||
"emms \n\t"
|
"emms \n\t"
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
/**
|
/**
|
||||||
* Copy 32byte chunks via MMX
|
* 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 (
|
asm volatile (
|
||||||
"emms \n\t"
|
"emms \n\t"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user