Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1695617
  • 博文数量: 584
  • 博客积分: 13857
  • 博客等级: 上将
  • 技术积分: 11883
  • 用 户 组: 普通用户
  • 注册时间: 2009-12-16 09:34

分类: LINUX

2010-10-25 22:50:02

浅析minigui下向HDC_SCREEN对应的PDC发送的数据是如何直接显示到lcd上的

pdc = dc_HDC2PDC (hdc);
static inline PDC dc_HDC2PDC (HDC hdc)
{
    if (hdc == HDC_SCREEN) return &__mg_screen_dc;
    return (PDC) hdc;
}

GAL_Surface* __gal_screen;
DC __mg_screen_dc;

InitGAL
==>(__gal_screen = GAL_SetVideoMode (w, h, depth, GAL_HWPALETTE))
==>FB_SetVideoMode
__gal_screen->flags = (GAL_FULLSCREEN|GAL_HWSURFACE);
__gal_screen->w = vinfo.xres; // framebuffer宽
__gal_screen->h = vinfo.yres; // framebuffer高
__gal_screen->pitch = finfo.line_length; // framebuffer一行字节数
__gal_screen->pixels 等于 framebuffer显示区首地址

应为__mg_screen_dc->cur_dst直接对应 __gal_screen->pixels即framebuffer的显示内存地址,
所以向__mg_screen_dc的cur_dst 赋值将直接显示到lcd屏幕上[luther.gliethttp]
InitGUI
==>InitScreenDC (__gal_screen)
libminigui-1.6.10/src/newgdi/gdi.c|178| dc_InitScreenDC (&__mg_screen_dc, (GAL_Surface *)surface);
BOOL InitScreenDC (void* surface)
{
    InitFreeClipRectList (&__mg_FreeClipRectList, SIZE_CLIPRECTHEAP);
   
    INIT_LOCK (&__mg_gdilock, NULL);
    INIT_LOCK (&dcslot, NULL);

    dc_InitClipRgnInfo ();
    dc_InitScreenDC (&__mg_screen_dc, (GAL_Surface *)surface);
    return TRUE;
}

static void dc_InitScreenDC (PDC pdc, GAL_Surface *surface)
{
    pdc->DataType = TYPE_HDC; // hdc内存数据类型
    pdc->DCType   = TYPE_SCRDC; // 类型
    pdc->hwnd = 0;
    pdc->surface = surface; // 该hdc管理的surface区块,这里就是__gal_screen,整个lcd屏幕对应的framebuffer. [luther.gliethttp]
    ......
    pdc->DevRC.left = 0; // 左上角
    pdc->DevRC.top  = 0;
    pdc->DevRC.right = surface->w;
// 右下角,这样该pdc对应矩形surface,即__gal_screen的w和h,就是整个lcd屏幕的framebuffer内存区 [luther.gliethttp]
    pdc->DevRC.bottom = surface->h;
    ......
    /* context info and raster operations. */
    pdc->rop = ROP_SET;
    pdc->step = 1;
    pdc->set_pixel = set_pixel_ops [pdc->rop] // 画点函数设置
            [pdc->surface->format->BytesPerPixel - 1];
    pdc->draw_hline = draw_hline_ops [pdc->rop]
            [pdc->surface->format->BytesPerPixel - 1];
    pdc->put_hline = put_hline_ops [pdc->rop]
            [pdc->surface->format->BytesPerPixel - 1];

    pdc->cur_dst = pdc->surface->pixels; // 对该pdc的操作将直接反应到该pdc对应的surface矩形管理区块中,
    // __mg_screen_dc对应的__gal_screen,就直接表示framebuffer的显示内存地址
    // 所以对__mg_screen_dc的cur_dst赋值将直接显示到lcd屏幕上[luther.gliethttp]
    ......
}
阅读(1560) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~