static int l_GetSubSurface (lua_State* L) { // [ sfc | t_rect ] IDirectFBSurface* sfc = * (IDirectFBSurface**) luaL_checkudata(L, 1, "ldirectfb.IDirectFBSurface"); IDirectFBSurface* sub; DFBRectangle rect; table2DFBRectangle(L, &rect); DFBCHECK( sfc->GetSubSurface(sfc, &rect, &sub) ); lua_pushlightuserdata(L, sub); // [ sfc | t_rect | sub ] l_IDirectFBSurface_toudata(L); // [ sfc | t_rect | _sub ] return 1; }
void QDirectFBWindowSurface::setGeometry(const QRect &rect) { const QRect oldRect = geometry(); if (oldRect == rect) return; IDirectFBSurface *oldSurface = dfbSurface; const bool sizeChanged = oldRect.size() != rect.size(); if (sizeChanged) { delete engine; engine = 0; releaseSurface(); Q_ASSERT(!dfbSurface); } if (rect.isNull()) { #ifndef QT_NO_DIRECTFB_WM if (dfbWindow) { if (window()) window()->setProperty("_q_DirectFBWindowID", QVariant()); dfbWindow->Release(dfbWindow); dfbWindow = 0; } #endif Q_ASSERT(!dfbSurface); #ifdef QT_DIRECTFB_SUBSURFACE Q_ASSERT(!subSurface); #endif } else { #ifdef QT_DIRECTFB_WM if (!dfbWindow) { createWindow(rect); } else { setWindowGeometry(dfbWindow, oldRect, rect); Q_ASSERT(!sizeChanged || !dfbSurface); if (sizeChanged) dfbWindow->GetSurface(dfbWindow, &dfbSurface); } #else IDirectFBSurface *primarySurface = screen->primarySurface(); DFBResult result = DFB_OK; if (mode == Primary) { Q_ASSERT(primarySurface); if (rect == screen->region().boundingRect()) { dfbSurface = primarySurface; } else { const DFBRectangle r = { rect.x(), rect.y(), rect.width(), rect.height() }; result = primarySurface->GetSubSurface(primarySurface, &r, &dfbSurface); } } else { // mode == Offscreen if (!dfbSurface) { dfbSurface = screen->createDFBSurface(rect.size(), surfaceFlags() & Opaque ? screen->pixelFormat() : screen->alphaPixmapFormat(), QDirectFBScreen::DontTrackSurface); } } if (result != DFB_OK) DirectFBErrorFatal("QDirectFBWindowSurface::setGeometry()", result); #endif } if (oldSurface != dfbSurface) { imageFormat = dfbSurface ? QDirectFBScreen::getImageFormat(dfbSurface) : QImage::Format_Invalid; } if (oldRect.size() != rect.size()) { QWSWindowSurface::setGeometry(rect); } else { QWindowSurface::setGeometry(rect); } }