Exemplo n.º 1
0
Arquivo: genblit.c Projeto: ev3dev/grx
void _GrFrDrvGenericBitBlt(GrxFrame *dst,int dx,int dy,GrxFrame *src,int x,int y,int w,int h,GrxColor op)
{
        GrxFrame csave;
        GrxColor (*readpix)(GrxFrame *,int,int);
        void (*drawpix)(int,int,GrxColor);
        GrxColor skipc;
        int  step;
        GRX_ENTER();
        readpix = src->driver->readpixel;
        drawpix = dst->driver->drawpixel;
        skipc = op ^ GRX_COLOR_MODE_IMAGE;
        step  = 1;
        op &= GRX_COLOR_MODE_MASK;
        sttcopy(&csave,&CURC->frame);
        sttcopy(&CURC->frame,dst);
        if((dy > y) || ((dy == y) && (dx > x))) {
            x += (w - 1); dx += (w - 1);
            y += (h - 1); dy += (h - 1);
            step = (-1);
        }
        do {
            int dxx = dx,xx = x,ww = w;
            do {
                GrxColor c = (*readpix)(src,xx,y);
                if(c != skipc) (*drawpix)(dxx,dy,(c | op));
                dxx += step; xx += step;
            } while(--ww > 0);
            dy += step; y += step;
        } while(--h > 0);
        sttcopy(&CURC->frame,&csave);
        GRX_LEAVE();
}
Exemplo n.º 2
0
void GrPatternDrawString(void *text,int length,int x,int y,
			 const GrTextOption *opt,GrPattern *p)
{
    GRX_ENTER();
    _GrDrawString(text,length,x,y,opt,p,PatternFilledBmp);
    GRX_LEAVE();
}
Exemplo n.º 3
0
Arquivo: ram3x8.c Projeto: ev3dev/grx
static INLINE
void drawpixel(int x,int y,GrxColor color)
{
        GR_int32u offs;
        char *p0,*p1,*p2;
        GRX_ENTER();
        offs = FOFS(x,y,CURC->gc_line_offset);
        p0 = &CURC->gc_base_address.plane0[offs];
        p1 = &CURC->gc_base_address.plane1[offs];
        p2 = &CURC->gc_base_address.plane2[offs];
        switch(C_OPER(color)) {
          case C_XOR: poke_b_xor(p0,RD24BYTE(color,0));
                      poke_b_xor(p1,RD24BYTE(color,1));
                      poke_b_xor(p2,RD24BYTE(color,2));
                      break;
          case C_OR:  poke_b_or(p0,RD24BYTE(color,0));
                      poke_b_or(p1,RD24BYTE(color,1));
                      poke_b_or(p2,RD24BYTE(color,2));
                      break;
          case C_AND: poke_b_and(p0,RD24BYTE(color,0));
                      poke_b_and(p1,RD24BYTE(color,1));
                      poke_b_and(p2,RD24BYTE(color,2));
                      break;
          default:    poke_b(p0,RD24BYTE(color,0));
                      poke_b(p1,RD24BYTE(color,1));
                      poke_b(p2,RD24BYTE(color,2));
                      break;
        }
        GRX_LEAVE();
}
Exemplo n.º 4
0
Arquivo: hline.c Projeto: ev3dev/grx
void drawhline(int x,int y,int w,GrxColor c)
{
        GRX_ENTER();
        w += x;
        do { drawpixel(x,y,c); } while(++x != w);
        GRX_LEAVE();
}
Exemplo n.º 5
0
Arquivo: ordswap.c Projeto: ev3dev/grx
static void swapbytes(GR_int8 *b1, GR_int8 *b2) {
  GR_int8 b;
  GRX_ENTER();
  b = peek_b(b1);
  poke_b(b1, peek_b(b2));
  poke_b(b2, b);
  GRX_LEAVE();
}
Exemplo n.º 6
0
Arquivo: ordswap.c Projeto: ev3dev/grx
void _GR_swap64(GR_int64 *h) {
  GRX_ENTER();
  swapbytes(((GR_int8 *)h)  , ((GR_int8 *)h)+7);
  swapbytes(((GR_int8 *)h)+1, ((GR_int8 *)h)+6); 
  swapbytes(((GR_int8 *)h)+2, ((GR_int8 *)h)+5);
  swapbytes(((GR_int8 *)h)+3, ((GR_int8 *)h)+4); 
  GRX_LEAVE();
}
Exemplo n.º 7
0
static void PatternFilledBmp(int x,int y,int w,int h,int ox, int oy,
				char *bmp,int pitch,int start,
				GrColor fg,GrColor bg,GrPattern *p)
{
    GRX_ENTER();
    _GrFillBitmapPattern(x,y,w,h,bmp,pitch,start,p,bg);
    GRX_LEAVE();
}
Exemplo n.º 8
0
Arquivo: ordswap.c Projeto: ev3dev/grx
void _GR_swap16(GR_int16 *w) {
  GR_int16 res;
  GRX_ENTER();
  res  = SWAPBYTE(GR_int16,*w,1,0);
  res |= SWAPBYTE(GR_int16,*w,0,1);
  *w = res;
  GRX_LEAVE();
}
Exemplo n.º 9
0
Arquivo: ordswap.c Projeto: ev3dev/grx
void _GR_swap32(GR_int32 *l) {
  GR_int32 res;
  GRX_ENTER();
  res  = SWAPBYTE(GR_int32,*l,3,0);
  res |= SWAPBYTE(GR_int16,*l,0,3);
  res |= SWAPBYTE(GR_int16,*l,2,1);
  res |= SWAPBYTE(GR_int16,*l,1,2);
  *l = res;
  GRX_LEAVE();
}
Exemplo n.º 10
0
void drawpattern(int x,int y,int w,char patt,GrColor fg,GrColor bg)
{
	GR_int8u mask;
	GRX_ENTER();
	mask = 0x80;
	w += x;
	do {
	    drawpixel(x,y,(patt & mask) ? fg : bg);
	    if((mask >>= 1) == 0) mask = 0x80;
	} while(++x != w);
	GRX_LEAVE();
}
Exemplo n.º 11
0
static void w32_drawblock(int x, int y, int w, int h, GrxColor color)
{
    RECT Rect;

    GRX_ENTER();
    drawblock(x, y, w, h, color);
    Rect.left = x;
    Rect.top = y;
    Rect.right = x + w;
    Rect.bottom = y + h;
    InvalidateRect(hGRXWnd, &Rect, FALSE);
    GRX_LEAVE();
}
Exemplo n.º 12
0
Arquivo: ram3x8.c Projeto: ev3dev/grx
static void bitblit(GrxFrame *dst,int dx,int dy,
                    GrxFrame *src,int sx,int sy,
                    int w,int h,GrxColor op)
{
    int pl;
    GRX_ENTER();
    if(grx_color_get_mode(op) == GRX_COLOR_MODE_IMAGE)
        bitblt(dst,dx,dy,src,sx,sy,w,h,op);
    else
        for (pl=0; pl < 3; ++pl)
            _GrFrDrvPackedBitBltR2Rpl(dst,dx,dy,src,sx,sy,w,h,op,pl);
    GRX_LEAVE();
}
Exemplo n.º 13
0
static void w32_bitblt(GrxFrame *dst, int dx, int dy, GrxFrame *src,
                       int sx, int sy, int w, int h, GrxColor op)
{
    RECT Rect;

    GRX_ENTER();
    bitblt(dst, dx, dy, src, sx, sy, w, h, op);
    Rect.left = dx;
    Rect.top = dy;
    Rect.right = dx + w;
    Rect.bottom = dy + h;
    InvalidateRect(hGRXWnd, &Rect, FALSE);
    GRX_LEAVE();
}
Exemplo n.º 14
0
static void w32_drawpattern(int x, int y, int w, unsigned char patt,
                            GrxColor fg, GrxColor bg)
{
    RECT Rect;

    GRX_ENTER();
    drawpattern(x, y, w, patt, fg, bg);
    Rect.left = x;
    Rect.top = y;
    Rect.right = x + w;
    Rect.bottom = y + 1;
    InvalidateRect(hGRXWnd, &Rect, FALSE);
    GRX_LEAVE();
}
Exemplo n.º 15
0
static void w32_drawbitmap(int x, int y, int w, int h, unsigned char *bmp,
                           int pitch, int start, GrxColor fg, GrxColor bg)
{
    RECT Rect;

    GRX_ENTER();
    drawbitmap(x, y, w, h, bmp, pitch, start, fg, bg);
    Rect.left = x;
    Rect.top = y;
    Rect.right = x + w;
    Rect.bottom = y + h;
    InvalidateRect(hGRXWnd, &Rect, FALSE);
    GRX_LEAVE();
}
Exemplo n.º 16
0
Arquivo: vd_sdl.c Projeto: ev3dev/grx
static void reset(void)
{
        GRX_ENTER();
#if defined(__WIN32__)
        _SGrActive = TRUE;
        if(_SGrBackup != NULL) free(_SGrBackup);
        _SGrBackup = NULL;
#endif
        if(_SGrScreen != NULL)
            if(SDL_MUSTLOCK(_SGrScreen)) SDL_UnlockSurface(_SGrScreen);
        if(SDL_WasInit(SDL_INIT_VIDEO)) SDL_Quit();
        _SGrScreen = NULL;
        GRX_LEAVE();
}
Exemplo n.º 17
0
Arquivo: ordswap.c Projeto: ev3dev/grx
void _GR_swap64(GR_int64 *h) {
  GR_int64 res;
  GRX_ENTER();
  res  = SWAPBYTE(GR_int64,*h,7,0);
  res |= SWAPBYTE(GR_int64,*h,0,7);
  res |= SWAPBYTE(GR_int64,*h,6,1);
  res |= SWAPBYTE(GR_int64,*h,1,6);
  res |= SWAPBYTE(GR_int64,*h,5,2);
  res |= SWAPBYTE(GR_int64,*h,2,5);
  res |= SWAPBYTE(GR_int64,*h,4,3);
  res |= SWAPBYTE(GR_int64,*h,3,4);
  *h = res;
  GRX_LEAVE();
}
Exemplo n.º 18
0
static void w32_drawpixel(int x, int y, GrxColor color)
{
    HDC hDC;
    COLORREF c;

    GRX_ENTER();
    drawpixel(x, y, color);

    c = GetPixel ( hDCMem, x, y );
    hDC = GetDC ( hGRXWnd );
    SetPixelV ( hDC, x, y, c );
    ReleaseDC ( hGRXWnd, hDC );

    GRX_LEAVE();
}
Exemplo n.º 19
0
static INLINE
void drawpixel(int x,int y,GrColor color)
{
    char *ptr;
    GRX_ENTER();
    ptr = &CURC->gc_baseaddr[0][FOFS(x,y,SCRN->gc_lineoffset)];
    setup_far_selector(CURC->gc_selector);
    if(lastcolor != color) {
        outport_w(VGA_GR_CTRL_PORT,writeops[C_OPER(color) & 3]);
        outport_w(VGA_GR_CTRL_PORT,((((int)color & 0x0f) << 8) | VGA_SET_RESET_REG));
        lastcolor = color;
    }
    outport_w(VGA_GR_CTRL_PORT,((0x8000U >> (x & 7)) | VGA_BIT_MASK_REG));
    poke_b_f_or(ptr,0);
    GRX_LEAVE();
}
Exemplo n.º 20
0
void GrPatternDrawChar(long chr,int x,int y,const GrTextOption *opt,GrPattern *p)
{
    char  cbuff[2];
    short sbuff[2];

    GRX_ENTER();
    switch(opt->txo_chrtype) {
      case GR_UTF8_TEXT:
	GrPatternDrawString((void *)&chr,1,x,y,opt,p);
	break;
      case GR_WORD_TEXT:
      case GR_ATTR_TEXT:
	sbuff[0] = chr;
	GrPatternDrawString(sbuff,1,x,y,opt,p);
	break;
      default:
	cbuff[0] = chr;
	GrPatternDrawString(cbuff,1,x,y,opt,p);
	break;
    }
    GRX_LEAVE();
}
Exemplo n.º 21
0
Arquivo: ram3x8.c Projeto: ev3dev/grx
static void drawhline(int x,int y,int w,GrxColor color) {
    int copr, pl;
    GR_int32u offs;
    GRX_ENTER();
    copr = C_OPER(color);
    offs = FOFS(x,y,CURC->gc_line_offset);
    for (pl=0; pl < 3; ++pl) {
      if(DOCOLOR8(color,copr)) {
        GR_repl cval = freplicate_b(color);
        char *pp = &GRX_FRAME_MEMORY_PLANE(&CURC->gc_base_address,pl)[offs];
        int ww = w;
        switch(copr) {
            case C_XOR: repfill_b_xor(pp,cval,ww); break;
            case C_OR:  repfill_b_or( pp,cval,ww); break;
            case C_AND: repfill_b_and(pp,cval,ww); break;
            default:    repfill_b(    pp,cval,ww); break;
        }
      }
      color >>= 8;
    }
    GRX_LEAVE();
}
Exemplo n.º 22
0
void w32_putscanline(int x, int y, int w,
                     const GrxColor *scl, GrxColor op )
{
    GrxColor skipc;
    RECT Rect;

    GRX_ENTER();
    Rect.left = x;
    Rect.top = y;
    Rect.right = x + w;
    Rect.bottom = y + 1;

    skipc = op ^ GRX_COLOR_MODE_IMAGE;
    op &= GRX_COLOR_MODE_MASK;
    for ( w += x; x < w; ++x) {
        GrxColor c = *(scl++);
        if (c != skipc) drawpixel(x, y, (c|op));
    }

    InvalidateRect(hGRXWnd, &Rect, FALSE);
    GRX_LEAVE();
}
Exemplo n.º 23
0
static void w32_drawline(int x, int y, int dx, int dy, GrxColor color)
{
    RECT Rect;

    GRX_ENTER();
    drawline(x, y, dx, dy, color);
    if (dx > 0 ) {
        Rect.left = x;
        Rect.right = x + dx + 1;
    } else {
        Rect.left = x + dx;
        Rect.right = x + 1;
    }
    if (dy > 0 ) {
        Rect.top = y;
        Rect.bottom = y + dy + 1;
    } else {
        Rect.top = y + dy;
        Rect.bottom = y + 1;
    }
    InvalidateRect(hGRXWnd, &Rect, FALSE);
    GRX_LEAVE();
}
Exemplo n.º 24
0
Arquivo: ram3x8.c Projeto: ev3dev/grx
static void drawvline(int x,int y,int h,GrxColor color)
{
    int copr, pl;
    GR_int32u offs;
    unsigned lwdt;
    GRX_ENTER();
    copr = C_OPER(color);
    lwdt = CURC->gc_line_offset;
    offs = FOFS(x,y,lwdt);
    for (pl=0; pl < 3; ++pl) {
      if(DOCOLOR8(color,copr)) {
        char *pp = &GRX_FRAME_MEMORY_PLANE(&CURC->gc_base_address,pl)[offs];
        int hh = h;
        switch(copr) {
            case C_XOR: colfill_b_xor(pp,lwdt,(GR_int8u)color,hh); break;
            case C_OR:  colfill_b_or( pp,lwdt,(GR_int8u)color,hh); break;
            case C_AND: colfill_b_and(pp,lwdt,(GR_int8u)color,hh); break;
            default:    colfill_b(    pp,lwdt,(GR_int8u)color,hh); break;
        }
      }
      color >>= 8;
    }
    GRX_LEAVE();
}
Exemplo n.º 25
0
Arquivo: ordswap.c Projeto: ev3dev/grx
void _GR_swap32(GR_int32 *l) {
  GRX_ENTER();
  swapbytes(((GR_int8 *)l)  , ((GR_int8 *)l)+3);
  swapbytes(((GR_int8 *)l)+1, ((GR_int8 *)l)+2); 
  GRX_LEAVE();
}
Exemplo n.º 26
0
Arquivo: ordswap.c Projeto: ev3dev/grx
void _GR_swap16(GR_int16 *w) {
  GRX_ENTER();
  swapbytes((GR_int8 *)w, ((GR_int8 *)w)+1);
  GRX_LEAVE();
}