File indexing completed on 2024-11-10 04:56:33

0001 /*
0002     KWin - the KDE window manager
0003     This file is part of the KDE project.
0004 
0005     SPDX-FileCopyrightText: 2018 Roman Gilg <subdiff@gmail.com>
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 #pragma once
0010 
0011 #include "core/output.h"
0012 
0013 #include <QObject>
0014 #include <QRect>
0015 
0016 namespace KWin
0017 {
0018 
0019 class SoftwareVsyncMonitor;
0020 class VirtualBackend;
0021 class OutputFrame;
0022 
0023 class VirtualOutput : public Output
0024 {
0025     Q_OBJECT
0026 
0027 public:
0028     VirtualOutput(VirtualBackend *parent, bool internal);
0029     ~VirtualOutput() override;
0030 
0031     RenderLoop *renderLoop() const override;
0032     void present(const std::shared_ptr<OutputFrame> &frame);
0033 
0034     void init(const QPoint &logicalPosition, const QSize &pixelSize, qreal scale);
0035     void updateEnabled(bool enabled);
0036 
0037 private:
0038     void vblank(std::chrono::nanoseconds timestamp);
0039 
0040     Q_DISABLE_COPY(VirtualOutput);
0041     friend class VirtualBackend;
0042 
0043     VirtualBackend *m_backend;
0044     std::unique_ptr<RenderLoop> m_renderLoop;
0045     std::unique_ptr<SoftwareVsyncMonitor> m_vsyncMonitor;
0046     int m_gammaSize = 200;
0047     bool m_gammaResult = true;
0048     int m_identifier;
0049     std::shared_ptr<OutputFrame> m_frame;
0050 };
0051 
0052 } // namespace KWin