int cdactivate(cdCtxCanvas *ctxcanvas) { if (ctxcanvas->hWnd) { RECT rect; GetClientRect(ctxcanvas->hWnd, &rect); ctxcanvas->canvas->w = rect.right - rect.left; ctxcanvas->canvas->h = rect.bottom - rect.top; ctxcanvas->canvas->bpp = cdGetScreenColorPlanes(); } /* Se nao e' ownwer, tem que restaurar o contexto */ if (!ctxcanvas->isOwnedDC) { cairo_surface_t *surface; if (ctxcanvas->hDC) /* deactivate not called */ { cairo_destroy(ctxcanvas->cr); ReleaseDC(ctxcanvas->hWnd, ctxcanvas->hDC); } ctxcanvas->hDC = GetDC(ctxcanvas->hWnd); surface = cairo_win32_surface_create(ctxcanvas->hDC); ctxcanvas->cr = cairo_create(surface); cairo_surface_destroy(surface); } ctxcanvas->canvas->w_mm = ((double)ctxcanvas->canvas->w) / ctxcanvas->canvas->xres; ctxcanvas->canvas->h_mm = ((double)ctxcanvas->canvas->h) / ctxcanvas->canvas->yres; if (ctxcanvas->canvas->use_matrix) ctxcanvas->canvas->cxTransform(ctxcanvas, ctxcanvas->canvas->matrix); return CD_OK; }
static void cdlua_getscreencolorplanes(void) { int L_result = cdGetScreenColorPlanes(); lua_pushnumber(L_result); }