Ignore:
Timestamp:
Nov 25, 2007, 3:12:01 PM (12 years ago)
Author:
Sam Hocevar
Message:
  • Introduce cucul_get_canvas_chars() and cucul_get_canvas_attrs() to avoid direct cv->chars and cv->attrs access by display drivers.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/caca/driver_conio.c

    r2055 r2056  
    3030#include <stdlib.h>
    3131
     32#include "cucul.h"
    3233#include "caca.h"
    3334#include "caca_internals.h"
    34 #include "cucul.h"
    35 #include "cucul_internals.h"
    3635
    3736struct driver_private
     
    7271    textcolor((enum COLORS)WHITE);
    7372    textbackground((enum COLORS)BLACK);
    74     gotoxy(dp->cv->width, dp->cv->height);
     73    gotoxy(cucul_get_canvas_width(dp->cv), cucul_get_canvas_height(dp->cv));
    7574    cputs("\r\n");
    7675    _setcursortype(_NORMALCURSOR);
     
    9089{
    9190    /* Fallback to a 6x10 font */
    92     return dp->cv->width * 6;
     91    return cucul_get_canvas_width(dp->cv) * 6;
    9392}
    9493
     
    9695{
    9796    /* Fallback to a 6x10 font */
    98     return dp->cv->height * 10;
     97    return cucul_get_canvas_height(dp->cv) * 10;
    9998}
    10099
     
    102101{
    103102    char *screen = dp->drv.p->screen;
    104     uint32_t *attrs = dp->cv->attrs;
    105     uint32_t *chars = dp->cv->chars;
     103    uint32_t const *chars = (uint32_t const *)cucul_get_canvas_chars(dp->cv);
     104    uint32_t const *attrs = (uint32_t const *)cucul_get_canvas_attrs(dp->cv);
     105    unsigned int width = cucul_get_canvas_width(dp->cv);
     106    unsigned int height = cucul_get_canvas_height(dp->cv);
    106107    unsigned int n;
    107108
    108     for(n = dp->cv->height * dp->cv->width; n--; )
     109    for(n = height * width; n--; )
    109110    {
    110111        char ch = cucul_utf32_to_cp437(*chars++);
     
    130131{
    131132    /* We know nothing about our window */
    132     dp->resize.w = dp->cv->width;
    133     dp->resize.h = dp->cv->height;
     133    dp->resize.w = cucul_get_canvas_width(dp->cv);
     134    dp->resize.h = cucul_get_canvas_height(dp->cv);
    134135}
    135136
Note: See TracChangeset for help on using the changeset viewer.