Parcourir la source

Fix an alignment issue in caca_get_canvas_chars() and caca_get_canvas_attrs().

Fixes #41.
tags/v0.99.beta17
Sam Hocevar sam il y a 15 ans
Parent
révision
231c33acce
9 fichiers modifiés avec 28 ajouts et 34 suppressions
  1. +2
    -2
      caca/caca.h
  2. +10
    -10
      caca/canvas.c
  3. +3
    -3
      caca/driver/conio.c
  4. +3
    -3
      caca/driver/gl.c
  5. +2
    -4
      caca/driver/ncurses.c
  6. +2
    -4
      caca/driver/slang.c
  7. +2
    -4
      caca/driver/vga.c
  8. +2
    -2
      caca/driver/win32.c
  9. +2
    -2
      caca/driver/x11.c

+ 2
- 2
caca/caca.h Voir le fichier

@@ -218,8 +218,8 @@ __extern int caca_unmanage_canvas(caca_canvas_t *, int (*)(void *), void *);
__extern int caca_set_canvas_size(caca_canvas_t *, int, int);
__extern int caca_get_canvas_width(caca_canvas_t const *);
__extern int caca_get_canvas_height(caca_canvas_t const *);
__extern uint8_t const * caca_get_canvas_chars(caca_canvas_t const *);
__extern uint8_t const * caca_get_canvas_attrs(caca_canvas_t const *);
__extern uint32_t const * caca_get_canvas_chars(caca_canvas_t const *);
__extern uint32_t const * caca_get_canvas_attrs(caca_canvas_t const *);
__extern int caca_free_canvas(caca_canvas_t *);
__extern int caca_rand(int, int);
__extern char const * caca_get_version(void);


+ 10
- 10
caca/canvas.c Voir le fichier

@@ -263,17 +263,17 @@ int caca_get_canvas_height(caca_canvas_t const *cv)
* consist in native endian 32-bit Unicode values as returned by
* caca_get_char().
*
* This function is only useful for display drivers such as the \e libcaca
* library.
* This function is probably only useful for \e libcaca 's internal display
* drivers.
*
* This function never fails.
*
* \param cv A libcaca canvas.
* \return The canvas character array.
*/
uint8_t const * caca_get_canvas_chars(caca_canvas_t const *cv)
uint32_t const * caca_get_canvas_chars(caca_canvas_t const *cv)
{
return (uint8_t const *)cv->chars;
return (uint32_t const *)cv->chars;
}

/** \brief Get the canvas attribute array.
@@ -282,17 +282,17 @@ uint8_t const * caca_get_canvas_chars(caca_canvas_t const *cv)
* consist in native endian 32-bit attribute values as returned by
* caca_get_attr().
*
* This function is only useful for display drivers such as the \e libcaca
* library.
* This function is probably only useful for \e libcaca 's internal display
* drivers.
*
* This function never fails.
*
* \param cv A libcaca canvas.
* \return The canvas attribute array.
*/
uint8_t const * caca_get_canvas_attrs(caca_canvas_t const *cv)
uint32_t const * caca_get_canvas_attrs(caca_canvas_t const *cv)
{
return (uint8_t const *)cv->attrs;
return (uint32_t const *)cv->attrs;
}

/** \brief Free a \e libcaca canvas.
@@ -539,9 +539,9 @@ int cucul_get_canvas_width(cucul_canvas_t const *)
CACA_ALIAS(caca_get_canvas_width);
int cucul_get_canvas_height(cucul_canvas_t const *)
CACA_ALIAS(caca_get_canvas_height);
uint8_t const * cucul_get_canvas_chars(cucul_canvas_t const *)
uint32_t const * cucul_get_canvas_chars(cucul_canvas_t const *)
CACA_ALIAS(caca_get_canvas_chars);
uint8_t const * cucul_get_canvas_attrs(cucul_canvas_t const *)
uint32_t const * cucul_get_canvas_attrs(cucul_canvas_t const *)
CACA_ALIAS(caca_get_canvas_attrs);
int cucul_free_canvas(cucul_canvas_t *) CACA_ALIAS(caca_free_canvas);
int cucul_rand(int, int) CACA_ALIAS(caca_rand);


+ 3
- 3
caca/driver/conio.c Voir le fichier

@@ -1,6 +1,6 @@
/*
* libcaca Colour ASCII-Art library
* Copyright (c) 2002-2006 Sam Hocevar <sam@zoy.org>
* Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net>
* All Rights Reserved
*
* $Id$
@@ -98,8 +98,8 @@ static int conio_get_display_height(caca_display_t const *dp)
static void conio_display(caca_display_t *dp)
{
char *screen = dp->drv.p->screen;
uint32_t const *chars = (uint32_t const *)caca_get_canvas_chars(dp->cv);
uint32_t const *attrs = (uint32_t const *)caca_get_canvas_attrs(dp->cv);
uint32_t const *chars = caca_get_canvas_chars(dp->cv);
uint32_t const *attrs = caca_get_canvas_attrs(dp->cv);
int width = caca_get_canvas_width(dp->cv);
int height = caca_get_canvas_height(dp->cv);
int n;


+ 3
- 3
caca/driver/gl.c Voir le fichier

@@ -1,6 +1,6 @@
/*
* libcaca Colour ASCII-Art library
* Copyright (c) 2002-2006 Sam Hocevar <sam@hocevar.net>
* Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net>
* 2006 Jean-Yves Lamoureux <jylam@lnxscene.org>
* 2007 Ben Wiley Sittler <bsittler@gmail.com>
* All Rights Reserved
@@ -216,8 +216,8 @@ static int gl_get_display_height(caca_display_t const *dp)

static void gl_display(caca_display_t *dp)
{
uint32_t const *cvchars = (uint32_t const *)caca_get_canvas_chars(dp->cv);
uint32_t const *cvattrs = (uint32_t const *)caca_get_canvas_attrs(dp->cv);
uint32_t const *cvchars = caca_get_canvas_chars(dp->cv);
uint32_t const *cvattrs = caca_get_canvas_attrs(dp->cv);
int width = caca_get_canvas_width(dp->cv);
int x, y, line;



+ 2
- 4
caca/driver/ncurses.c Voir le fichier

@@ -355,10 +355,8 @@ static void ncurses_display(caca_display_t *dp)

caca_get_dirty_rect(dp->cv, i, &dx, &dy, &dw, &dh);

cvchars = (uint32_t const *)caca_get_canvas_chars(dp->cv)
+ dx + dy * dp->cv->width;
cvattrs = (uint32_t const *)caca_get_canvas_attrs(dp->cv)
+ dx + dy * dp->cv->width;
cvchars = caca_get_canvas_chars(dp->cv) + dx + dy * dp->cv->width;
cvattrs = caca_get_canvas_attrs(dp->cv) + dx + dy * dp->cv->width;

for(y = dy; y < dy + dh; y++)
{


+ 2
- 4
caca/driver/slang.c Voir le fichier

@@ -244,10 +244,8 @@ static void slang_display(caca_display_t *dp)

caca_get_dirty_rect(dp->cv, i, &dx, &dy, &dw, &dh);

cvchars = (uint32_t const *)caca_get_canvas_chars(dp->cv)
+ dx + dy * dp->cv->width;
cvattrs = (uint32_t const *)caca_get_canvas_attrs(dp->cv)
+ dx + dy * dp->cv->width;
cvchars = caca_get_canvas_chars(dp->cv) + dx + dy * dp->cv->width;
cvattrs = caca_get_canvas_attrs(dp->cv) + dx + dy * dp->cv->width;

for(y = dy; y < dy + dh; y++)
{


+ 2
- 4
caca/driver/vga.c Voir le fichier

@@ -124,10 +124,8 @@ static void vga_display(caca_display_t *dp)

caca_get_dirty_rect(dp->cv, i, &dx, &dy, &dw, &dh);

cvchars = (uint32_t const *)caca_get_canvas_chars(dp->cv)
+ dx + dy * dp->cv->width;
cvattrs = (uint32_t const *)caca_get_canvas_attrs(dp->cv)
+ dx + dy * dp->cv->width;
cvchars = caca_get_canvas_chars(dp->cv) + dx + dy * dp->cv->width;
cvattrs = caca_get_canvas_attrs(dp->cv) + dx + dy * dp->cv->width;

screen += dy * dp->cv->width + dx;



+ 2
- 2
caca/driver/win32.c Voir le fichier

@@ -195,8 +195,8 @@ static void win32_display(caca_display_t *dp)
COORD size, pos;
SMALL_RECT rect;
CHAR_INFO *buffer = dp->drv.p->buffer;
uint32_t const *cvchars = (uint32_t const *)caca_get_canvas_chars(dp->cv);
uint32_t const *cvattrs = (uint32_t const *)caca_get_canvas_attrs(dp->cv);
uint32_t const *cvchars = caca_get_canvas_chars(dp->cv);
uint32_t const *cvattrs = caca_get_canvas_attrs(dp->cv);
int width = caca_get_canvas_width(dp->cv);
int height = caca_get_canvas_height(dp->cv);
int n;


+ 2
- 2
caca/driver/x11.c Voir le fichier

@@ -393,8 +393,8 @@ static int x11_get_display_height(caca_display_t const *dp)

static void x11_display(caca_display_t *dp)
{
uint32_t const *cvchars = (uint32_t const *)caca_get_canvas_chars(dp->cv);
uint32_t const *cvattrs = (uint32_t const *)caca_get_canvas_attrs(dp->cv);
uint32_t const *cvchars = caca_get_canvas_chars(dp->cv);
uint32_t const *cvattrs = caca_get_canvas_attrs(dp->cv);
int width = caca_get_canvas_width(dp->cv);
int height = caca_get_canvas_height(dp->cv);
int x, y, i, len;


Chargement…
Annuler
Enregistrer