/********* BitMap::Clear() *************************************/ VOID MNAME_BM(Clear)(OOP_Class *cl, OOP_Object *o, struct pHidd_BitMap_Clear *msg) { IPTR width, height; struct bitmap_data *data = OOP_INST_DATA(cl, o); struct Box box = {0, 0, 0, 0}; /* Get width & height from bitmap superclass */ OOP_GetAttr(o, aHidd_BitMap_Width, &width); OOP_GetAttr(o, aHidd_BitMap_Height, &height); box.x2 = width - 1; box.y2 = height - 1; memset(data->VideoData, GC_BG(msg->gc), width*height); #ifdef OnBitmap ObtainSemaphore(&XSD(cl)->HW_acc); vgaRefreshArea(data, 1, &box); draw_mouse(XSD(cl)); ReleaseSemaphore(&XSD(cl)->HW_acc); #endif /* OnBitmap */ return; }
BOOL MNAME_BM(SetColors)(OOP_Class *cl, OOP_Object *o, struct pHidd_BitMap_SetColors *msg) { struct bitmap_data *data = OOP_INST_DATA(cl, o); HIDDT_PixelFormat *pf; ULONG xc_i, col_i; HIDDT_Pixel red, green, blue; pf = BM_PIXFMT(o); if ( vHidd_ColorModel_StaticPalette == HIDD_PF_COLMODEL(pf) || vHidd_ColorModel_TrueColor == HIDD_PF_COLMODEL(pf) ) { /* Superclass takes care of this case */ return OOP_DoSuperMethod(cl, o, (OOP_Msg)msg); } /* We have a vHidd_GT_Palette bitmap */ if (!OOP_DoSuperMethod(cl, o, (OOP_Msg)msg)) return FALSE; if ((msg->firstColor + msg->numColors) > (1 << data->bpp)) return FALSE; for ( xc_i = msg->firstColor, col_i = 0; col_i < msg->numColors; xc_i ++, col_i ++ ) { red = msg->colors[col_i].red >> 8; green = msg->colors[col_i].green >> 8; blue = msg->colors[col_i].blue >> 8; /* Set given color as allocated */ data->cmap[xc_i] = 0x01000000 | red | (green << 8) | (blue << 16); /* Update DAC registers */ data->Regs->DAC[xc_i*3] = red >> 2; data->Regs->DAC[xc_i*3+1] = green >> 2; data->Regs->DAC[xc_i*3+2] = blue >> 2; msg->colors[col_i].pixval = xc_i; } /* Restore palette if OnBitmap */ #ifdef OnBitmap ObtainSemaphore(&XSD(cl)->HW_acc); vgaDACLoad(data->Regs, msg->firstColor, msg->numColors); ReleaseSemaphore(&XSD(cl)->HW_acc); #endif /* OnBitmap */ return TRUE; }
OOP_Object *PCVesa__Hidd_Gfx__NewBitMap(OOP_Class *cl, OOP_Object *o, struct pHidd_Gfx_NewBitMap *msg) { BOOL displayable; BOOL framebuffer; OOP_Class *classptr = NULL; struct TagItem tags[2]; struct pHidd_Gfx_NewBitMap yourmsg; EnterFunc(bug("VesaGfx::NewBitMap()\n")); displayable = GetTagData(aHidd_BitMap_Displayable, FALSE, msg->attrList); framebuffer = GetTagData(aHidd_BitMap_FrameBuffer, FALSE, msg->attrList); if (framebuffer) classptr = XSD(cl)->onbmclass; else if (displayable) classptr = XSD(cl)->offbmclass; else { HIDDT_ModeID modeid; modeid = (HIDDT_ModeID)GetTagData(aHidd_BitMap_ModeID, vHidd_ModeID_Invalid, msg->attrList); if (modeid != vHidd_ModeID_Invalid) classptr = XSD(cl)->offbmclass; else { HIDDT_StdPixFmt stdpf; stdpf = (HIDDT_StdPixFmt)GetTagData(aHidd_BitMap_StdPixFmt, vHidd_StdPixFmt_Unknown, msg->attrList); if (stdpf == vHidd_StdPixFmt_Unknown) { OOP_Object *friend; friend = (OOP_Object *)GetTagData(aHidd_BitMap_Friend, 0, msg->attrList); if (friend != NULL) { OOP_Object *gfxhidd; OOP_GetAttr(friend, aHidd_BitMap_GfxHidd, (APTR)&gfxhidd); if (gfxhidd == o) { classptr = XSD(cl)->offbmclass; } } } } }
VOID MNAME_BM(PutImageLUT)(OOP_Class *cl, OOP_Object *o, struct pHidd_BitMap_PutImageLUT *msg) { struct bitmap_data *data = OOP_INST_DATA(cl, o); struct Box box = {0, 0, 0, 0}; EnterFunc(bug("VGAGfx.BitMap::PutImageLUT(pa=%p, x=%d, y=%d, w=%d, h=%d)\n", msg->pixels, msg->x, msg->y, msg->width, msg->height)); HIDD_BM_CopyMemBox8(o, msg->pixels, 0, 0, data->VideoData, msg->x, msg->y, msg->width, msg->height, msg->modulo, data->width); if (data->disp) { box.x1 = msg->x; box.y1 = msg->y; box.x2 = box.x1 + msg->width - 1; box.y2 = box.y1 + msg->height - 1; ObtainSemaphore(&XSD(cl)->HW_acc); vgaRefreshArea(data, 1, &box); if ( ( (XSD(cl)->mouseX + XSD(cl)->mouseW - 1 >= box.x1) && (XSD(cl)->mouseX <= box.x2) ) || ( (XSD(cl)->mouseY + XSD(cl)->mouseH - 1 >= box.y1) && (XSD(cl)->mouseY <= box.y2) ) ) draw_mouse(XSD(cl)); ReleaseSemaphore(&XSD(cl)->HW_acc); } ReturnVoid("VGAGfx.BitMap::PutImageLUT"); }
VOID MNAME_BM(PutPixel)(OOP_Class *cl, OOP_Object *o, struct pHidd_BitMap_PutPixel *msg) { struct bitmap_data *data = OOP_INST_DATA(cl, o); HIDDT_Pixel fg; unsigned char *ptr; #ifdef OnBitmap int pix; int i; unsigned char *ptr2; #endif /* OnBitmap */ fg = msg->pixel; ptr = (char *)(data->VideoData + msg->x + (msg->y * data->width)); *ptr = (char) fg; #ifdef OnBitmap ptr2 = (char *)(0xa0000 + (msg->x + (msg->y * data->width)) / 8); pix = 0x8000 >> (msg->x % 8); ObtainSemaphore(&XSD(cl)->HW_acc); outw(0x3c4,0x0f02); outw(0x3ce,pix | 8); outw(0x3ce,0x0005); outw(0x3ce,0x0003); outw(0x3ce,(fg << 8)); outw(0x3ce,0x0f01); *ptr2 |= 1; // This or'ed value isn't important if (((msg->x >= XSD(cl)->mouseX) && (msg->x < (XSD(cl)->mouseX + XSD(cl)->mouseW))) || ((msg->y >= XSD(cl)->mouseY) && (msg->y < (XSD(cl)->mouseY + XSD(cl)->mouseH)))) draw_mouse(XSD(cl)); ReleaseSemaphore(&XSD(cl)->HW_acc); #endif /* OnBitmap */ return; }
OOP_Object *PCVesa__Root__New(OOP_Class *cl, OOP_Object *o, struct pRoot_New *msg) { struct TagItem pftags[] = { {aHidd_PixFmt_RedShift, 0}, /* 0 */ {aHidd_PixFmt_GreenShift, 0}, /* 1 */ {aHidd_PixFmt_BlueShift, 0}, /* 2 */ {aHidd_PixFmt_AlphaShift, 0}, /* 3 */ {aHidd_PixFmt_RedMask, 0}, /* 4 */ {aHidd_PixFmt_GreenMask, 0}, /* 5 */ {aHidd_PixFmt_BlueMask, 0}, /* 6 */ {aHidd_PixFmt_AlphaMask, 0}, /* 7 */ {aHidd_PixFmt_ColorModel, 0}, /* 8 */ {aHidd_PixFmt_Depth, 0}, /* 9 */ {aHidd_PixFmt_BytesPerPixel,0}, /* 10 */ {aHidd_PixFmt_BitsPerPixel, 0}, /* 11 */ {aHidd_PixFmt_StdPixFmt, 0}, /* 12 */ {aHidd_PixFmt_CLUTShift, 0}, /* 13 */ {aHidd_PixFmt_CLUTMask, 0}, /* 14 */ {aHidd_PixFmt_BitMapType, 0}, /* 15 */ {TAG_DONE, 0UL } }; struct TagItem sync_mode[] = { {aHidd_Sync_PixelClock, 0}, {aHidd_Sync_HDisp, 0}, {aHidd_Sync_VDisp, 0}, {aHidd_Sync_Description,0}, {aHidd_Sync_HSyncStart, 0}, {aHidd_Sync_HSyncEnd, 0}, {aHidd_Sync_HTotal, 0}, {aHidd_Sync_VSyncStart, 0}, {aHidd_Sync_VSyncEnd, 0}, {aHidd_Sync_VTotal, 0}, {TAG_DONE, 0UL} }; struct TagItem modetags[] = { {aHidd_Gfx_PixFmtTags, (IPTR)pftags}, {aHidd_Gfx_SyncTags, (IPTR)sync_mode}, {TAG_DONE, 0UL} }; struct TagItem yourtags[] = { {aHidd_Gfx_ModeTags, (IPTR)modetags}, {TAG_MORE, 0UL} }; struct pRoot_New yourmsg; pftags[0].ti_Data = XSD(cl)->data.redshift; pftags[1].ti_Data = XSD(cl)->data.greenshift; pftags[2].ti_Data = XSD(cl)->data.blueshift; pftags[3].ti_Data = 0; pftags[4].ti_Data = XSD(cl)->data.redmask; pftags[5].ti_Data = XSD(cl)->data.greenmask; pftags[6].ti_Data = XSD(cl)->data.bluemask; pftags[7].ti_Data = 0; pftags[8].ti_Data = (XSD(cl)->data.depth > 8) ? vHidd_ColorModel_TrueColor : vHidd_ColorModel_Palette; pftags[9].ti_Data = (XSD(cl)->data.depth > 24) ? 24 : XSD(cl)->data.depth; pftags[10].ti_Data = XSD(cl)->data.bytesperpixel; pftags[11].ti_Data = (XSD(cl)->data.bitsperpixel > 24) ? 24 : XSD(cl)->data.bitsperpixel; pftags[12].ti_Data = vHidd_StdPixFmt_Native; pftags[14].ti_Data = (1 << XSD(cl)->data.depth) - 1; pftags[15].ti_Data = vHidd_BitMapType_Chunky; sync_mode[1].ti_Data = XSD(cl)->data.width; sync_mode[2].ti_Data = XSD(cl)->data.height; __sprintf(syncdescription, "VESA:%ldx%ld", XSD(cl)->data.width, XSD(cl)->data.height); sync_mode[3].ti_Data = (IPTR)syncdescription; yourtags[1].ti_Data = (IPTR)msg->attrList; yourmsg.mID = msg->mID; yourmsg.attrList = yourtags; msg = &yourmsg; EnterFunc(bug("VesaGfx::New()\n")); o = (OOP_Object *)OOP_DoSuperMethod(cl, o, (OOP_Msg)msg); if (o) { D(bug("Got object from super\n")); XSD(cl)->vesagfxhidd = o; XSD(cl)->mouse.shape = NULL; ReturnPtr("VesaGfx::New", OOP_Object *, o); } ReturnPtr("VesaGfx::New", OOP_Object *, NULL); }
VOID PCVesa__Root__Dispose(OOP_Class *cl, OOP_Object *o, OOP_Msg msg) { if (XSD(cl)->mouse.shape != NULL) FreeVec(XSD(cl)->mouse.shape); OOP_DoSuperMethod(cl, o, (OOP_Msg)msg); }
/*********** BitMap::New() *************************************/ OOP_Object *MNAME_ROOT(New)(OOP_Class *cl, OOP_Object *o, struct pRoot_New *msg) { EnterFunc(bug("VesaGfx.BitMap::New()\n")); o = (OOP_Object *)OOP_DoSuperMethod(cl, o, (OOP_Msg) msg); if (o) { struct BitmapData *data; IPTR width, height, depth, multi; OOP_Object *friend, *pf; data = OOP_INST_DATA(cl, o); /* clear all data */ memset(data, 0, sizeof(struct BitmapData)); /* Get attr values */ OOP_GetAttr(o, aHidd_BitMap_Width, &width); OOP_GetAttr(o, aHidd_BitMap_Height, &height); OOP_GetAttr(o, aHidd_BitMap_GfxHidd, (IPTR *)&data->gfxhidd); OOP_GetAttr(o, aHidd_BitMap_PixFmt, (IPTR *)&pf); data->pixfmtobj = pf; OOP_GetAttr(pf, aHidd_PixFmt_Depth, &depth); OOP_GetAttr(pf, aHidd_PixFmt_BytesPerPixel, &multi); /* Get the friend bitmap. This should be a displayable bitmap */ OOP_GetAttr(o, aHidd_BitMap_Friend, (IPTR *)&friend); /* If you got a friend bitmap, copy its colormap */ if (friend) { struct BitmapData *src = OOP_INST_DATA(cl, friend); CopyMem(&src->cmap, &data->cmap, 4*16); } ASSERT (width != 0 && height != 0 && depth != 0); width=(width+15) & ~15; data->width = width; data->height = height; data->bpp = depth; data->disp = 0; data->bytesperpix = multi; data->bytesperline = width * multi; data->VideoData = AllocVec(width*height*multi, MEMF_PUBLIC | MEMF_CLEAR); if (data->VideoData) { data->data = &XSD(cl)->data; if (XSD(cl)->activecallback) XSD(cl)->activecallback(XSD(cl)->callbackdata, o, TRUE); ReturnPtr("VesaGfx.BitMap::New()", OOP_Object *, o); } /* if got data->VideoData */ { OOP_MethodID disp_mid = OOP_GetMethodID(IID_Root, moRoot_Dispose); OOP_CoerceMethod(cl, o, (OOP_Msg) &disp_mid); } o = NULL; } /* if created object */
/*** BitMap::BlitColorExpansion() **********************************************/ VOID MNAME_BM(BlitColorExpansion)(OOP_Class *cl, OOP_Object *o, struct pHidd_BitMap_BlitColorExpansion *msg) { ULONG cemd; struct bitmap_data *data = OOP_INST_DATA(cl, o); struct Box box; HIDDT_Pixel fg, bg; LONG x, y; EnterFunc(bug("VGAGfx.BitMap::BlitColorExpansion(%p, %d, %d, %d, %d, %d, %d)\n" , msg->srcBitMap, msg->srcX, msg->srcY, msg->destX, msg->destY, msg->width, msg->height)); fg = GC_FG(msg->gc); bg = GC_BG(msg->gc); cemd = GC_COLEXP(msg->gc); if (cemd & vHidd_GC_ColExp_Opaque) { for (y = 0; y < msg->height; y ++) { for (x = 0; x < msg->width; x ++) { ULONG is_set; is_set = HIDD_BM_GetPixel(msg->srcBitMap, x + msg->srcX, y + msg->srcY); *(data->VideoData + x + msg->destX + ((y + msg->destY) * data->width)) = is_set ? fg : bg; } /* for (each x) */ } /* for (each y) */ } else { for (y = 0; y < msg->height; y ++) { for (x = 0; x < msg->width; x ++) { ULONG is_set; is_set = HIDD_BM_GetPixel(msg->srcBitMap, x + msg->srcX, y + msg->srcY); if (is_set) *(data->VideoData + x + msg->destX + ((y + msg->destY) * data->width)) = fg; } /* for (each x) */ } /* for (each y) */ } if (data->disp) { box.x1 = msg->destX; box.y1 = msg->destY; box.x2 = box.x1 + msg->width - 1; box.y2 = box.y1 + msg->height - 1; ObtainSemaphore(&XSD(cl)->HW_acc); vgaRefreshArea(data, 1, &box); if ( ( (XSD(cl)->mouseX + XSD(cl)->mouseW - 1 >= box.x1) && (XSD(cl)->mouseX <= box.x2) ) || ( (XSD(cl)->mouseY + XSD(cl)->mouseH - 1 >= box.y1) && (XSD(cl)->mouseY <= box.y2) ) ) draw_mouse(XSD(cl)); ReleaseSemaphore(&XSD(cl)->HW_acc); } ReturnVoid("VGAGfx.BitMap::BlitColorExpansion"); }
VOID MNAME_BM(FillRect)(OOP_Class *cl, OOP_Object *o, struct pHidd_BitMap_DrawRect *msg) { struct bitmap_data *data =OOP_INST_DATA(cl, o); struct Box box = {0, 0, 0, 0}; HIDDT_Pixel fg = GC_FG(msg->gc); HIDDT_DrawMode mode = GC_DRMD(msg->gc); EnterFunc(bug("VGAGfx.BitMap::FillRect(%d,%d,%d,%d)\n", msg->minX, msg->minY, msg->maxX, msg->maxY)); switch(mode) { case vHidd_GC_DrawMode_Copy: HIDD_BM_FillMemRect8(o, data->VideoData, msg->minX, msg->minY, msg->maxX, msg->maxY, data->width, fg); break; case vHidd_GC_DrawMode_Invert: HIDD_BM_InvertMemRect(o, data->VideoData, msg->minX, msg->minY, msg->maxX, msg->maxY, data->width); break; default: OOP_DoSuperMethod(cl, o, (OOP_Msg)msg); break; } /* switch(mode) */ if (data->disp) { box.x1 = msg->minX; box.y1 = msg->minY; box.x2 = msg->maxX; box.y2 = msg->maxY; ObtainSemaphore(&XSD(cl)->HW_acc); vgaRefreshArea(data, 1, &box); if ( ( (XSD(cl)->mouseX + XSD(cl)->mouseW - 1 >= box.x1) && (XSD(cl)->mouseX <= box.x2) ) || ( (XSD(cl)->mouseY + XSD(cl)->mouseH - 1 >= box.y1) && (XSD(cl)->mouseY <= box.y2) ) ) draw_mouse(XSD(cl)); ReleaseSemaphore(&XSD(cl)->HW_acc); } ReturnVoid("VGAGfx.BitMap::FillRect"); }
VOID MNAME_BM(PutImage)(OOP_Class *cl, OOP_Object *o, struct pHidd_BitMap_PutImage *msg) { struct bitmap_data *data = OOP_INST_DATA(cl, o); struct Box box = {0, 0, 0, 0}; BOOL done_by_superclass = FALSE; int i; EnterFunc(bug("VGAGfx.BitMap::PutImage(pa=%p, x=%d, y=%d, w=%d, h=%d)\n", msg->pixels, msg->x, msg->y, msg->width, msg->height)); switch(msg->pixFmt) { case vHidd_StdPixFmt_Native: HIDD_BM_CopyMemBox8(o, msg->pixels, 0, 0, data->VideoData, msg->x, msg->y, msg->width, msg->height, msg->modulo, data->width); break; case vHidd_StdPixFmt_Native32: HIDD_BM_PutMem32Image8(o, msg->pixels, data->VideoData, msg->x, msg->y, msg->width, msg->height, msg->modulo, data->width); break; default: OOP_DoSuperMethod(cl, o, (OOP_Msg)msg); done_by_superclass = TRUE; break; } if (data->disp && !done_by_superclass) { box.x1 = msg->x; box.y1 = msg->y; box.x2 = box.x1 + msg->width - 1; box.y2 = box.y1 + msg->height - 1; ObtainSemaphore(&XSD(cl)->HW_acc); vgaRefreshArea(data, 1, &box); if ( ( (XSD(cl)->mouseX + XSD(cl)->mouseW - 1 >= box.x1) && (XSD(cl)->mouseX <= box.x2) ) || ( (XSD(cl)->mouseY + XSD(cl)->mouseH - 1 >= box.y1) && (XSD(cl)->mouseY <= box.y2) ) ) draw_mouse(XSD(cl)); ReleaseSemaphore(&XSD(cl)->HW_acc); } ReturnVoid("VGAGfx.BitMap::PutImage"); }
OOP_Object *PCVGAOnBM__Root__New(OOP_Class *cl, OOP_Object *o, struct pRoot_New *msg) { EnterFunc(bug("VGAGfx.BitMap::New()\n")); o = (OOP_Object *)OOP_DoSuperMethod(cl, o, (OOP_Msg) msg); if (o) { struct bitmap_data *data; OOP_Object *pf; IPTR width, height, depth; data = OOP_INST_DATA(cl, o); /* clear all data */ memset(data, 0, sizeof(struct bitmap_data)); /* Get attr values */ OOP_GetAttr(o, aHidd_BitMap_Width, &width); OOP_GetAttr(o, aHidd_BitMap_Height, &height); OOP_GetAttr(o, aHidd_BitMap_PixFmt, &pf); OOP_GetAttr(pf, aHidd_PixFmt_Depth, &depth); ASSERT (width != 0 && height != 0 && depth != 0); /* We must only create depths that are supported by the friend drawable Currently we only support the default depth */ data->width = width; data->height = height; data->bpp = depth; data->Regs = AllocVec(sizeof(struct vgaHWRec),MEMF_PUBLIC|MEMF_CLEAR); data->disp = -1; width=(width+15) & ~15; /* Here there is brand new method of getting pixelclock data. It was introduced here to make the code more portable. Besides it may now be used as a base for creating other low level video drivers */ if (data->Regs) { data->VideoData = AllocVec(width*height,MEMF_PUBLIC|MEMF_CLEAR); if (data->VideoData) { struct vgaModeDesc mode; HIDDT_ModeID modeid; OOP_Object *sync; OOP_Object *pf; ULONG pixelc; /* We should be able to get modeID from the bitmap */ OOP_GetAttr(o, aHidd_BitMap_ModeID, &modeid); if (modeid != vHidd_ModeID_Invalid) { struct Box box = {0, 0, width-1, height-1}; /* Get Sync and PixelFormat properties */ HIDD_Gfx_GetMode(XSD(cl)->vgahidd, modeid, &sync, &pf); mode.Width = width; mode.Height = height; mode.Depth = depth; OOP_GetAttr(sync, aHidd_Sync_PixelClock, &pixelc); mode.clock = (pixelc > 26000000) ? 1 : 0; mode.Flags = 0; mode.HSkew = 0; OOP_GetAttr(sync, aHidd_Sync_HDisp, &mode.HDisplay); OOP_GetAttr(sync, aHidd_Sync_VDisp, &mode.VDisplay); OOP_GetAttr(sync, aHidd_Sync_HSyncStart, &mode.HSyncStart); OOP_GetAttr(sync, aHidd_Sync_VSyncStart, &mode.VSyncStart); OOP_GetAttr(sync, aHidd_Sync_HSyncEnd, &mode.HSyncEnd); OOP_GetAttr(sync, aHidd_Sync_VSyncEnd, &mode.VSyncEnd); OOP_GetAttr(sync, aHidd_Sync_HTotal, &mode.HTotal); OOP_GetAttr(sync, aHidd_Sync_VTotal, &mode.VTotal); ObtainSemaphore(&XSD(cl)->HW_acc); /* Now, when the best display mode is chosen, we can build it */ vgaInitMode(&mode, data->Regs); vgaLoadPalette(data->Regs,(unsigned char *)NULL); /* Because of not defined BitMap_Show method show bitmap immediately */ vgaRestore(data->Regs, FALSE); vgaRefreshArea(data, 1, &box); ReleaseSemaphore(&XSD(cl)->HW_acc); XSD(cl)->visible = data; /* Set created object as visible */ ReturnPtr("VGAGfx.BitMap::New()", OOP_Object *, o); } } /* if got data->VideoData */ FreeVec(data->Regs); } /* if got data->Regs */ { OOP_MethodID disp_mid = OOP_GetMethodID(IID_Root, moRoot_Dispose); OOP_CoerceMethod(cl, o, (OOP_Msg) &disp_mid); } o = NULL; } /* if created object */
OOP_Object *GDICl__Root__New(OOP_Class *cl, OOP_Object *o, struct pRoot_New *msg) { struct TagItem pftags[] = { /* Shifts are non-obviously calculated from the MSB, not from the LSB. I. e. color value is placed in the most significant byte of the ULONG before shifting (cc000000, not 000000cc) */ { aHidd_PixFmt_RedShift , 24 }, { aHidd_PixFmt_GreenShift , 16 }, { aHidd_PixFmt_BlueShift , 8 }, { aHidd_PixFmt_AlphaShift , 0 }, { aHidd_PixFmt_RedMask , 0x000000FF }, { aHidd_PixFmt_GreenMask , 0x0000FF00 }, { aHidd_PixFmt_BlueMask , 0x00FF0000 }, { aHidd_PixFmt_AlphaMask , 0x00000000 }, /* Windows effectively hides from us all details of color management and everything looks like if the display mode is always truecolor */ { aHidd_PixFmt_ColorModel , vHidd_ColorModel_TrueColor }, { aHidd_PixFmt_Depth , 24 }, { aHidd_PixFmt_BytesPerPixel, 4 }, { aHidd_PixFmt_BitsPerPixel , 24 }, { aHidd_PixFmt_StdPixFmt , vHidd_StdPixFmt_Native }, { aHidd_PixFmt_BitMapType , vHidd_BitMapType_Chunky }, { TAG_DONE , 0UL } }; struct TagItem tags_160_160[] = { { aHidd_Sync_HDisp , 160 }, { aHidd_Sync_VDisp , 160 }, { TAG_DONE , 0UL } }; struct TagItem tags_240_320[] = { { aHidd_Sync_HDisp , 240 }, { aHidd_Sync_VDisp , 320 }, { TAG_DONE , 0UL } }; struct TagItem tags_320_240[] = { { aHidd_Sync_HDisp , 320 }, { aHidd_Sync_VDisp , 240 }, { TAG_DONE , 0UL } }; struct TagItem tags_512_384[] = { { aHidd_Sync_HDisp , 512 }, { aHidd_Sync_VDisp , 384 }, { TAG_DONE , 0UL } }; struct TagItem tags_640_480[] = { { aHidd_Sync_HDisp , 640 }, { aHidd_Sync_VDisp , 480 }, { TAG_DONE , 0UL } }; struct TagItem tags_800_600[] = { { aHidd_Sync_HDisp , 800 }, { aHidd_Sync_VDisp , 600 }, { TAG_DONE , 0UL } }; struct TagItem tags_1024_768[] = { { aHidd_Sync_HDisp , 1024 }, { aHidd_Sync_VDisp , 768 }, { TAG_DONE , 0UL } }; struct TagItem tags_1152_864[] = { { aHidd_Sync_HDisp , 1152 }, { aHidd_Sync_VDisp , 864 }, { TAG_DONE , 0UL } }; struct TagItem tags_1280_800[] = { { aHidd_Sync_HDisp , 1280 }, { aHidd_Sync_VDisp , 800 }, { TAG_DONE , 0UL } }; struct TagItem tags_1280_960[] = { { aHidd_Sync_HDisp , 1280 }, { aHidd_Sync_VDisp , 960 }, { TAG_DONE , 0UL } }; struct TagItem tags_1280_1024[] = { { aHidd_Sync_HDisp , 1280 }, { aHidd_Sync_VDisp , 1024 }, { TAG_DONE , 0UL } }; struct TagItem tags_1600_1200[] = { { aHidd_Sync_HDisp , 1600 }, { aHidd_Sync_VDisp , 1200 }, { TAG_DONE , 0UL } }; struct TagItem mode_tags[] = { { aHidd_Gfx_PixFmtTags , (IPTR)pftags }, /* Default values for the sync attributes */ { aHidd_Sync_PixelClock , 0 }, { aHidd_Sync_HTotal , 0 }, { aHidd_Sync_VTotal , 0 }, { aHidd_Sync_HMin , 112 }, /* In fact these can be even smaller, and */ { aHidd_Sync_VMin , 112 }, /* maximum can be even bigger... */ { aHidd_Sync_HMax , 16384 }, { aHidd_Sync_VMax , 16384 }, /* Formatting stands for: %b - board number %h - HDisp %v - VDisp */ { aHidd_Sync_Description, (IPTR)"Windows %b: %hx%v"}, { aHidd_Sync_BoardNumber, XSD(cl)->displaynum }, /* The different syncmodes. The default attribute values above will be applied to each of these. Note that you can alter the defaults between the tags below */ { aHidd_Gfx_SyncTags , (IPTR)tags_160_160 }, { aHidd_Gfx_SyncTags , (IPTR)tags_240_320 }, { aHidd_Gfx_SyncTags , (IPTR)tags_320_240 }, { aHidd_Gfx_SyncTags , (IPTR)tags_512_384 }, { aHidd_Gfx_SyncTags , (IPTR)tags_640_480 }, { aHidd_Gfx_SyncTags , (IPTR)tags_800_600 }, { aHidd_Gfx_SyncTags , (IPTR)tags_1024_768 }, { aHidd_Gfx_SyncTags , (IPTR)tags_1152_864 }, { aHidd_Gfx_SyncTags , (IPTR)tags_1280_800 }, { aHidd_Gfx_SyncTags , (IPTR)tags_1280_960 }, { aHidd_Gfx_SyncTags , (IPTR)tags_1280_1024 }, { aHidd_Gfx_SyncTags , (IPTR)tags_1600_1200 }, { TAG_DONE , 0UL } }; STRPTR name[32]; struct TagItem mytags[] = { { aHidd_Gfx_ModeTags , (IPTR)mode_tags }, { aHidd_Name , (IPTR)name }, { aHidd_HardwareName , (IPTR)"Windows GDI Gfx Host" }, { aHidd_ProducerName , (IPTR)"Microsoft corporation"}, { TAG_MORE , (IPTR)msg->attrList } }; struct pRoot_New mymsg = { msg->mID, mytags }; APTR display; ULONG vfreq, htotal, vtotal; EnterFunc(bug("GDIGfx::New()\n")); Forbid(); /* TODO: If we replace "DISPLAY" with something else here, we get a possibility to select on which monitor to work. Perhaps we should have some kind of preferences for this. */ display = GDICALL(CreateDC, "DISPLAY", NULL, NULL, NULL); if (!display) { Permit(); ReturnPtr("GDIGfx::New()", OOP_Object *, NULL); }