| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #include "qplatformsurface.h" |
| 5 | #ifndef QT_NO_DEBUG_STREAM |
| 6 | #include <QtCore/qdebug.h> |
| 7 | #include <QtGui/qwindow.h> |
| 8 | #endif |
| 9 | |
| 10 | QT_BEGIN_NAMESPACE |
| 11 | |
| 12 | /*! |
| 13 | \class QPlatformSurface |
| 14 | \since 5.0 |
| 15 | \internal |
| 16 | \preliminary |
| 17 | \ingroup qpa |
| 18 | |
| 19 | \brief The QPlatformSurface class provides an abstraction for a surface. |
| 20 | */ |
| 21 | QPlatformSurface::~QPlatformSurface() |
| 22 | { |
| 23 | |
| 24 | } |
| 25 | |
| 26 | QSurface *QPlatformSurface::surface() const |
| 27 | { |
| 28 | return m_surface; |
| 29 | } |
| 30 | |
| 31 | QPlatformSurface::QPlatformSurface(QSurface *surface) : m_surface(surface) |
| 32 | { |
| 33 | } |
| 34 | |
| 35 | bool QPlatformSurface::isRasterSurface(QSurface *surface) |
| 36 | { |
| 37 | switch (surface->surfaceType()) { |
| 38 | case QSurface::RasterSurface: |
| 39 | case QSurface::RasterGLSurface: |
| 40 | return true; |
| 41 | default: |
| 42 | return false; |
| 43 | }; |
| 44 | } |
| 45 | |
| 46 | #ifndef QT_NO_DEBUG_STREAM |
| 47 | Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QPlatformSurface *surface) |
| 48 | { |
| 49 | QDebugStateSaver saver(debug); |
| 50 | debug.nospace(); |
| 51 | debug << "QPlatformSurface("<< (const void *)surface; |
| 52 | if (surface) { |
| 53 | QSurface *s = surface->surface(); |
| 54 | auto surfaceClass = s->surfaceClass(); |
| 55 | debug << ", class="<< surfaceClass; |
| 56 | debug << ", type="<< s->surfaceType(); |
| 57 | if (surfaceClass == QSurface::Window) |
| 58 | debug << ", window="<< static_cast<QWindow *>(s); |
| 59 | else |
| 60 | debug << ", surface="<< s; |
| 61 | } |
| 62 | debug << ')'; |
| 63 | return debug; |
| 64 | } |
| 65 | #endif // !QT_NO_DEBUG_STREAM |
| 66 | |
| 67 | QT_END_NAMESPACE |
| 68 | |
| 69 |
