Krita Source Code Documentation
Loading...
Searching...
No Matches
KisScreenInformationAdapter Class Reference

#include <KisScreenInformationAdapter.h>

Classes

struct  Private
 
struct  ScreenInfo
 

Public Member Functions

QString errorString () const
 
ScreenInfo infoForScreen (QScreen *screen) const
 
bool isValid () const
 
 KisScreenInformationAdapter (QOpenGLContext *context)
 
 ~KisScreenInformationAdapter ()
 

Private Attributes

const QScopedPointer< Privatem_d
 

Detailed Description

Definition at line 17 of file KisScreenInformationAdapter.h.

Constructor & Destructor Documentation

◆ KisScreenInformationAdapter()

KisScreenInformationAdapter::KisScreenInformationAdapter ( QOpenGLContext * context)

Definition at line 68 of file KisScreenInformationAdapter.cpp.

69 : m_d(new Private)
70{
71 if (context) {
72 m_d->initialize(context);
73 }
74}
const QScopedPointer< Private > m_d

References m_d.

◆ ~KisScreenInformationAdapter()

KisScreenInformationAdapter::~KisScreenInformationAdapter ( )

Definition at line 76 of file KisScreenInformationAdapter.cpp.

77{
78}

Member Function Documentation

◆ errorString()

QString KisScreenInformationAdapter::errorString ( ) const

Definition at line 185 of file KisScreenInformationAdapter.cpp.

186{
187 return m_d->errorString;
188}

References m_d.

◆ infoForScreen()

KisScreenInformationAdapter::ScreenInfo KisScreenInformationAdapter::infoForScreen ( QScreen * screen) const

Definition at line 190 of file KisScreenInformationAdapter.cpp.

191{
192 ScreenInfo info;
193
194#if defined Q_OS_WIN
195
196 QPlatformNativeInterface *nativeInterface = qGuiApp->platformNativeInterface();
197 HMONITOR monitor = reinterpret_cast<HMONITOR>(nativeInterface->nativeResourceForScreen("handle", screen));
198
199 UINT i = 0;
200 Microsoft::WRL::ComPtr<IDXGIOutput> currentOutput;
201
202 while (m_d->dxgiAdapter->EnumOutputs(i, &currentOutput) != DXGI_ERROR_NOT_FOUND)
203 {
204
205 HRESULT result = 0;
206 Microsoft::WRL::ComPtr<IDXGIOutput6> output6;
207 result = currentOutput.As(&output6);
208
209 if (output6) {
210 DXGI_OUTPUT_DESC1 desc;
211 result = output6->GetDesc1(&desc);
212
213 if (desc.Monitor == monitor) {
214 info.screen = screen;
215 info.bitsPerColor = desc.BitsPerColor;
216 info.redPrimary[0] = desc.RedPrimary[0];
217 info.redPrimary[1] = desc.RedPrimary[1];
218 info.greenPrimary[0] = desc.GreenPrimary[0];
219 info.greenPrimary[1] = desc.GreenPrimary[1];
220 info.bluePrimary[0] = desc.BluePrimary[0];
221 info.bluePrimary[1] = desc.BluePrimary[1];
222 info.whitePoint[0] = desc.WhitePoint[0];
223 info.whitePoint[1] = desc.WhitePoint[1];
224 info.minLuminance = desc.MinLuminance;
225 info.maxLuminance = desc.MaxLuminance;
226 info.maxFullFrameLuminance = desc.MaxFullFrameLuminance;
227
229
230 if (desc.ColorSpace == DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709) {
232 } else if (desc.ColorSpace == DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709) {
233#ifdef HAVE_HDR
235#else
236 qWarning("WARNING: scRGB display color space is not supported by Qt's build");
237#endif
238 } else if (desc.ColorSpace == DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020) {
239#ifdef HAVE_HDR
241#else
242 qWarning("WARNING: bt2020-pq display color space is not supported by Qt's build");
243#endif
244 } else {
245 qWarning("WARNING: unknown display color space! 0x%X", desc.ColorSpace);
246 }
247
248 break;
249 }
250 }
251
252 Q_UNUSED(result);
253
254 i++;
255 }
256
257#endif
258 Q_UNUSED(screen);
259 return info;
260}

References KisScreenInformationAdapter::ScreenInfo::bitsPerColor, KisScreenInformationAdapter::ScreenInfo::bluePrimary, KisSurfaceColorSpaceWrapper::bt2020PQColorSpace, KisScreenInformationAdapter::ScreenInfo::colorSpace, KisSurfaceColorSpaceWrapper::DefaultColorSpace, KisScreenInformationAdapter::ScreenInfo::greenPrimary, m_d, KisScreenInformationAdapter::ScreenInfo::maxFullFrameLuminance, KisScreenInformationAdapter::ScreenInfo::maxLuminance, KisScreenInformationAdapter::ScreenInfo::minLuminance, KisScreenInformationAdapter::ScreenInfo::redPrimary, KisScreenInformationAdapter::ScreenInfo::screen, KisSurfaceColorSpaceWrapper::scRGBColorSpace, KisSurfaceColorSpaceWrapper::sRGBColorSpace, and KisScreenInformationAdapter::ScreenInfo::whitePoint.

◆ isValid()

bool KisScreenInformationAdapter::isValid ( ) const

Definition at line 176 of file KisScreenInformationAdapter.cpp.

177{
178#ifdef Q_OS_WIN
179 return m_d->context && m_d->dxgiAdapter;
180#else
181 return false;
182#endif
183}

References m_d.

Member Data Documentation

◆ m_d

const QScopedPointer<Private> KisScreenInformationAdapter::m_d
private

Definition at line 49 of file KisScreenInformationAdapter.h.


The documentation for this class was generated from the following files: