本文整理汇总了C++中setSurfaceFlags函数的典型用法代码示例。如果您正苦于以下问题:C++ setSurfaceFlags函数的具体用法?C++ setSurfaceFlags怎么用?C++ setSurfaceFlags使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setSurfaceFlags函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: qDebug
void QWSHtml5CanvasSurface::setPermanentState(const QByteArray &data)
{
#ifdef QT_DEBUG_SURFACE
qDebug() << "QWSHtml5CanvasSurface::setPermanentState()"<< "(" << (void*)this << ")";
#endif
int width;
int height;
QImage::Format format;
SurfaceFlags flags;
const char *ptr = data.constData();
m_backingCanvasHandle = reinterpret_cast<const CanvasHandle*>(ptr)[0];
ptr += sizeof(CanvasHandle);
width = reinterpret_cast<const int*>(ptr)[0];
height = reinterpret_cast<const int*>(ptr)[1];
ptr += 2 * sizeof(int);
format = QImage::Format(*reinterpret_cast<const int*>(ptr));
ptr += sizeof(int);
flags = *reinterpret_cast<const SurfaceFlags*>(ptr);
setSurfaceFlags(flags);
//pixmap = QPixmap(pixmapData);
//qDebug() << "pixmapWidth: " << pixmap.width();
//qDebug() << "pixmapHeight: " << pixmap.height();
//qDebug() << "pixmap null?: " << pixmap.isNull();
m_isServerSide = true;
}
示例2: sizeof
void QWSLocalMemSurface::setPermanentState(const QByteArray &data)
{
if (memsize) {
delete[] mem;
memsize = 0;
}
int width;
int height;
QImage::Format format;
SurfaceFlags flags;
const char *ptr = data.constData();
mem = *reinterpret_cast<uchar* const*>(ptr);
ptr += sizeof(uchar*);
width = reinterpret_cast<const int*>(ptr)[0];
height = reinterpret_cast<const int*>(ptr)[1];
ptr += 2 * sizeof(int);
format = QImage::Format(*reinterpret_cast<const int*>(ptr));
ptr += sizeof(int);
flags = *reinterpret_cast<const SurfaceFlags*>(ptr);
const int bpl = nextMulOf4(bytesPerPixel(format) * width);
QWSMemorySurface::img = QImage(mem, width, height, bpl, format);
setSurfaceFlags(flags);
}
示例3: QWSWindowSurface
QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirectFBScreen *scr, QWidget *widget)
: QWSWindowSurface(widget), QDirectFBPaintDevice(scr)
#ifndef QT_NO_DIRECTFB_WM
, dfbWindow(0)
#endif
, flipFlags(flip)
, boundingRectFlip(scr->directFBFlags() & QDirectFBScreen::BoundingRectFlip)
, flushPending(false)
{
SurfaceFlags flags = 0;
if (!widget || widget->window()->windowOpacity() == 0xff)
flags |= Opaque;
#ifdef QT_NO_DIRECTFB_WM
if (widget && widget->testAttribute(Qt::WA_PaintOnScreen)) {
flags = RegionReserved;
mode = Primary;
} else {
mode = Offscreen;
flags = Buffered;
}
#endif
setSurfaceFlags(flags);
#ifdef QT_DIRECTFB_TIMING
frames = 0;
timer.start();
#endif
}
示例4: QWSGLWindowSurface
EGLNullWSWindowSurface::EGLNullWSWindowSurface(QWidget *w)
:
QWSGLWindowSurface(w),
widget(w)
{
setSurfaceFlags(Flags);
}
示例5: QWSGLWindowSurface
PvrEglWindowSurface::PvrEglWindowSurface
(QWidget *widget, PvrEglScreen *screen, int screenNum)
: QWSGLWindowSurface(widget)
{
setSurfaceFlags(QWSWindowSurface::Opaque);
this->widget = widget;
this->screen = screen;
this->pdevice = 0;
QPoint pos = offset(widget);
QSize size = widget->size();
PvrQwsRect pvrRect;
pvrRect.x = pos.x();
pvrRect.y = pos.y();
pvrRect.width = size.width();
pvrRect.height = size.height();
transformRects(&pvrRect, 1);
// Try to recover a previous PvrQwsDrawable object for the widget
// if there is one. This can happen when a PvrEglWindowSurface
// is created for a widget, bound to a EGLSurface, and then destroyed.
// When a new PvrEglWindowSurface is created for the widget, it will
// pick up the previous PvrQwsDrawable if the EGLSurface has not been
// destroyed in the meantime.
drawable = pvrQwsFetchWindow((long)widget);
if (drawable)
pvrQwsSetGeometry(drawable, &pvrRect);
else
drawable = pvrQwsCreateWindow(screenNum, (long)widget, &pvrRect);
pvrQwsSetRotation(drawable, screen->transformation());
}
示例6: SurfaceFlags
void QWSSharedMemSurface::setPermanentState(const QByteArray &data)
{
int memId;
int width;
int height;
int lockId;
QImage::Format format;
SurfaceFlags flags;
const int *ptr = reinterpret_cast<const int*>(data.constData());
memId = ptr[0];
width = ptr[1];
height = ptr[2];
lockId = ptr[3];
format = QImage::Format(ptr[4]);
flags = SurfaceFlags(ptr[5]);
setSurfaceFlags(flags);
setMemory(memId);
setLock(lockId);
#ifdef QT_QWS_CLIENTBLIT
uchar *base = static_cast<uchar*>(mem.address()) + sizeof(uint);
#else
uchar *base = static_cast<uchar*>(mem.address());
#endif
const int bpl = nextMulOf4(bytesPerPixel(format) * width);
QWSMemorySurface::img = QImage(base, width, height, bpl, format);
}
示例7: QWSWindowSurface
QWSHtml5CanvasSurface::QWSHtml5CanvasSurface()
: QWSWindowSurface(), m_isServerSide(false), m_backingCanvasHandle(-1)
{
#ifdef QT_DEBUG_SURFACE
qDebug() << "QWSHtml5CanvasSurface::QWSHtml5CanvasSurface()" << "(" << (void*)this << ")";
#endif
setSurfaceFlags(Buffered);
}
示例8: QWSWindowSurface
QWSMemorySurface::QWSMemorySurface()
: QWSWindowSurface()
#ifndef QT_NO_QWS_MULTIPROCESS
, memlock(0)
#endif
{
setSurfaceFlags(Buffered);
}
示例9: QWSGLWindowSurface
HybridSurface::HybridSurface(QWidget *w, EGLDisplay disp)
: QWSGLWindowSurface(w), memlock(0), display(disp), config(0),
surface(EGL_NO_SURFACE), context(EGL_NO_CONTEXT),
pdevice(new QWSGLPaintDevice(w))
{
setSurfaceFlags(Buffered | Opaque);
EGLint configAttribs[] = {
EGL_RED_SIZE, 0,
EGL_GREEN_SIZE, 0,
EGL_BLUE_SIZE, 0,
EGL_ALPHA_SIZE, 0,
EGL_DEPTH_SIZE, 0,
EGL_STENCIL_SIZE, EGL_DONT_CARE,
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_NONE, EGL_NONE
};
EGLBoolean status;
EGLint numConfigs;
status = eglChooseConfig(display, configAttribs, 0, 0, &numConfigs);
if (!status) {
error("chooseConfig");
return;
}
//If there isn't any configuration good enough
if (numConfigs < 1) {
error("chooseConfig, no matching configurations found");
return;
}
QVarLengthArray<EGLConfig> configs(numConfigs);
status = eglChooseConfig(display, configAttribs, configs.data(),
numConfigs, &numConfigs);
if (!status) {
error("chooseConfig");
return;
}
// hw: if used on an image buffer we need to check whether the resulting
// configuration matches our requirements exactly!
config = configs[0];
context = eglCreateContext(display, config, 0, 0);
//(shareContext ? shareContext->d_func()->cx : 0),
//configAttribs);
if (context == EGL_NO_CONTEXT)
error("eglCreateContext");
}
示例10: surfaceFlags
void QDirectFBWindowSurface::setOpaque(bool opaque)
{
SurfaceFlags flags = surfaceFlags();
if (opaque != (flags & Opaque)) {
if (opaque) {
flags |= Opaque;
} else {
flags &= ~Opaque;
}
setSurfaceFlags(flags);
}
}
示例11: QWSGLWindowSurface
PvrEglWindowSurface::PvrEglWindowSurface(PvrEglSurfaceHolder *holder)
: QWSGLWindowSurface()
{
setSurfaceFlags(QWSWindowSurface::Opaque);
drawable = 0;
widget = 0;
screen = 0;
pdevice = 0;
this->holder = holder;
holder->addSurface();
}
示例12: sizeof
void HybridSurface::setPermanentState(const QByteArray &data)
{
int memId;
int width;
int height;
int lockId;
QImage::Format format;
SurfaceFlags flags;
const char *ptr = data.constData();
memId = reinterpret_cast<const int*>(ptr)[0];
width = reinterpret_cast<const int*>(ptr)[1];
height = reinterpret_cast<const int*>(ptr)[2];
lockId = reinterpret_cast<const int*>(ptr)[3];
ptr += 4 * sizeof(int);
format = *reinterpret_cast<const QImage::Format*>(ptr);
ptr += sizeof(QImage::Format);
flags = *reinterpret_cast<const SurfaceFlags*>(ptr);
setSurfaceFlags(flags);
// setMemory(memId);
if (mem.id() != memId) {
mem.detach();
if (!mem.attach(memId)) {
perror("QWSSharedMemSurface: attaching to shared memory");
qCritical("QWSSharedMemSurface: Error attaching to"
" shared memory 0x%x", memId);
}
}
// setLock(lockId);
if (!memlock || memlock->id() == lockId) {
delete memlock;
memlock = (lockId == -1 ? 0 : new QWSLock(lockId));
}
uchar *base = static_cast<uchar*>(mem.address());
img = QImage(base, width, height, format);
}
示例13: QDirectFBPaintDevice
QT_BEGIN_NAMESPACE
QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirectFBScreen *scr)
: QDirectFBPaintDevice(scr)
#ifndef QT_NO_DIRECTFB_WM
, dfbWindow(0)
#endif
, flipFlags(flip)
, boundingRectFlip(scr->directFBFlags() & QDirectFBScreen::BoundingRectFlip)
, flushPending(false)
{
#ifdef QT_NO_DIRECTFB_WM
mode = Offscreen;
#endif
setSurfaceFlags(Opaque | Buffered);
#ifdef QT_DIRECTFB_TIMING
frames = 0;
timer.start();
#endif
}
示例14: memcpy
void QDirectFBWindowSurface::setPermanentState(const QByteArray &state)
{
const char *ptr = state.constData();
IDirectFBDisplayLayer *layer = screen->dfbDisplayLayer();
SurfaceFlags flags;
memcpy(&flags, ptr, sizeof(SurfaceFlags));
setSurfaceFlags(flags);
ptr += sizeof(SurfaceFlags);
DFBWindowID id;
memcpy(&id, ptr, sizeof(DFBWindowID));
if (dfbSurface)
dfbSurface->Release(dfbSurface);
if (id != (DFBWindowID)-1) {
IDirectFBWindow *dw;
layer->GetWindow(layer, id, &dw);
if (dw->GetSurface(dw, &dfbSurface) != DFB_OK)
dfbSurface = 0;
dw->Release(dw);
}
else {
dfbSurface = 0;
}
}
示例15: QWSMemorySurface
QWSOnScreenSurface::QWSOnScreenSurface()
: QWSMemorySurface()
{
setSurfaceFlags(Opaque);
}