Changeset 4146


Ignore:
Timestamp:
Dec 18, 2009, 10:50:37 PM (10 years ago)
Author:
Sam Hocevar
Message:

Fix an alignment issue in caca_get_canvas_chars() and caca_get_canvas_attrs().
Fixes #41.

Location:
libcaca/trunk/caca
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/caca/caca.h

    r4145 r4146  
    219219__extern int caca_get_canvas_width(caca_canvas_t const *);
    220220__extern int caca_get_canvas_height(caca_canvas_t const *);
    221 __extern uint8_t const * caca_get_canvas_chars(caca_canvas_t const *);
    222 __extern uint8_t const * caca_get_canvas_attrs(caca_canvas_t const *);
     221__extern uint32_t const * caca_get_canvas_chars(caca_canvas_t const *);
     222__extern uint32_t const * caca_get_canvas_attrs(caca_canvas_t const *);
    223223__extern int caca_free_canvas(caca_canvas_t *);
    224224__extern int caca_rand(int, int);
  • libcaca/trunk/caca/canvas.c

    r3584 r4146  
    264264 *  caca_get_char().
    265265 *
    266  *  This function is only useful for display drivers such as the \e libcaca
    267  *  library.
     266 *  This function is probably only useful for \e libcaca 's internal display
     267 *  drivers.
    268268 *
    269269 *  This function never fails.
     
    272272 *  \return The canvas character array.
    273273 */
    274 uint8_t const * caca_get_canvas_chars(caca_canvas_t const *cv)
    275 {
    276     return (uint8_t const *)cv->chars;
     274uint32_t const * caca_get_canvas_chars(caca_canvas_t const *cv)
     275{
     276    return (uint32_t const *)cv->chars;
    277277}
    278278
     
    283283 *  caca_get_attr().
    284284 *
    285  *  This function is only useful for display drivers such as the \e libcaca
    286  *  library.
     285 *  This function is probably only useful for \e libcaca 's internal display
     286 *  drivers.
    287287 *
    288288 *  This function never fails.
     
    291291 *  \return The canvas attribute array.
    292292 */
    293 uint8_t const * caca_get_canvas_attrs(caca_canvas_t const *cv)
    294 {
    295     return (uint8_t const *)cv->attrs;
     293uint32_t const * caca_get_canvas_attrs(caca_canvas_t const *cv)
     294{
     295    return (uint32_t const *)cv->attrs;
    296296}
    297297
     
    540540int cucul_get_canvas_height(cucul_canvas_t const *)
    541541    CACA_ALIAS(caca_get_canvas_height);
    542 uint8_t const * cucul_get_canvas_chars(cucul_canvas_t const *)
     542uint32_t const * cucul_get_canvas_chars(cucul_canvas_t const *)
    543543    CACA_ALIAS(caca_get_canvas_chars);
    544 uint8_t const * cucul_get_canvas_attrs(cucul_canvas_t const *)
     544uint32_t const * cucul_get_canvas_attrs(cucul_canvas_t const *)
    545545    CACA_ALIAS(caca_get_canvas_attrs);
    546546int cucul_free_canvas(cucul_canvas_t *) CACA_ALIAS(caca_free_canvas);
  • libcaca/trunk/caca/driver/conio.c

    r2962 r4146  
    11/*
    22 *  libcaca       Colour ASCII-Art library
    3  *  Copyright (c) 2002-2006 Sam Hocevar <sam@zoy.org>
     3 *  Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net>
    44 *                All Rights Reserved
    55 *
     
    9999{
    100100    char *screen = dp->drv.p->screen;
    101     uint32_t const *chars = (uint32_t const *)caca_get_canvas_chars(dp->cv);
    102     uint32_t const *attrs = (uint32_t const *)caca_get_canvas_attrs(dp->cv);
     101    uint32_t const *chars = caca_get_canvas_chars(dp->cv);
     102    uint32_t const *attrs = caca_get_canvas_attrs(dp->cv);
    103103    int width = caca_get_canvas_width(dp->cv);
    104104    int height = caca_get_canvas_height(dp->cv);
  • libcaca/trunk/caca/driver/gl.c

    r4096 r4146  
    11/*
    22 *  libcaca       Colour ASCII-Art library
    3  *  Copyright (c) 2002-2006 Sam Hocevar <sam@hocevar.net>
     3 *  Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net>
    44 *                2006 Jean-Yves Lamoureux <jylam@lnxscene.org>
    55 *                2007 Ben Wiley Sittler <bsittler@gmail.com>
     
    217217static void gl_display(caca_display_t *dp)
    218218{
    219     uint32_t const *cvchars = (uint32_t const *)caca_get_canvas_chars(dp->cv);
    220     uint32_t const *cvattrs = (uint32_t const *)caca_get_canvas_attrs(dp->cv);
     219    uint32_t const *cvchars = caca_get_canvas_chars(dp->cv);
     220    uint32_t const *cvattrs = caca_get_canvas_attrs(dp->cv);
    221221    int width = caca_get_canvas_width(dp->cv);
    222222    int x, y, line;
  • libcaca/trunk/caca/driver/ncurses.c

    r4130 r4146  
    356356        caca_get_dirty_rect(dp->cv, i, &dx, &dy, &dw, &dh);
    357357
    358         cvchars = (uint32_t const *)caca_get_canvas_chars(dp->cv)
    359                     + dx + dy * dp->cv->width;
    360         cvattrs = (uint32_t const *)caca_get_canvas_attrs(dp->cv)
    361                     + dx + dy * dp->cv->width;
     358        cvchars = caca_get_canvas_chars(dp->cv) + dx + dy * dp->cv->width;
     359        cvattrs = caca_get_canvas_attrs(dp->cv) + dx + dy * dp->cv->width;
    362360
    363361        for(y = dy; y < dy + dh; y++)
  • libcaca/trunk/caca/driver/slang.c

    r4082 r4146  
    245245        caca_get_dirty_rect(dp->cv, i, &dx, &dy, &dw, &dh);
    246246
    247         cvchars = (uint32_t const *)caca_get_canvas_chars(dp->cv)
    248                     + dx + dy * dp->cv->width;
    249         cvattrs = (uint32_t const *)caca_get_canvas_attrs(dp->cv)
    250                     + dx + dy * dp->cv->width;
     247        cvchars = caca_get_canvas_chars(dp->cv) + dx + dy * dp->cv->width;
     248        cvattrs = caca_get_canvas_attrs(dp->cv) + dx + dy * dp->cv->width;
    251249
    252250        for(y = dy; y < dy + dh; y++)
  • libcaca/trunk/caca/driver/vga.c

    r3624 r4146  
    125125        caca_get_dirty_rect(dp->cv, i, &dx, &dy, &dw, &dh);
    126126
    127         cvchars = (uint32_t const *)caca_get_canvas_chars(dp->cv)
    128                     + dx + dy * dp->cv->width;
    129         cvattrs = (uint32_t const *)caca_get_canvas_attrs(dp->cv)
    130                     + dx + dy * dp->cv->width;
     127        cvchars = caca_get_canvas_chars(dp->cv) + dx + dy * dp->cv->width;
     128        cvattrs = caca_get_canvas_attrs(dp->cv) + dx + dy * dp->cv->width;
    131129
    132130        screen += dy * dp->cv->width + dx;
  • libcaca/trunk/caca/driver/win32.c

    r3489 r4146  
    196196    SMALL_RECT rect;
    197197    CHAR_INFO *buffer = dp->drv.p->buffer;
    198     uint32_t const *cvchars = (uint32_t const *)caca_get_canvas_chars(dp->cv);
    199     uint32_t const *cvattrs = (uint32_t const *)caca_get_canvas_attrs(dp->cv);
     198    uint32_t const *cvchars = caca_get_canvas_chars(dp->cv);
     199    uint32_t const *cvattrs = caca_get_canvas_attrs(dp->cv);
    200200    int width = caca_get_canvas_width(dp->cv);
    201201    int height = caca_get_canvas_height(dp->cv);
  • libcaca/trunk/caca/driver/x11.c

    r4143 r4146  
    394394static void x11_display(caca_display_t *dp)
    395395{
    396     uint32_t const *cvchars = (uint32_t const *)caca_get_canvas_chars(dp->cv);
    397     uint32_t const *cvattrs = (uint32_t const *)caca_get_canvas_attrs(dp->cv);
     396    uint32_t const *cvchars = caca_get_canvas_chars(dp->cv);
     397    uint32_t const *cvattrs = caca_get_canvas_attrs(dp->cv);
    398398    int width = caca_get_canvas_width(dp->cv);
    399399    int height = caca_get_canvas_height(dp->cv);
Note: See TracChangeset for help on using the changeset viewer.