Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qwindowsdirect2ddevicecontext.h
Go to the documentation of this file.
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#ifndef QWINDOWSDIRECT2DDEVICECONTEXT_H
5#define QWINDOWSDIRECT2DDEVICECONTEXT_H
6
7#include <QtCore/qscopedpointer.h>
8
10
11/*
12 * Convenience class for handling device contexts. We have to call BeginDraw
13 * before anything can happen, and EndDraw once we're done, for every frame and
14 * pretty much any kind of operation.
15 *
16 * Unfortunately, these calls cannot be interleaved, and there is no way to check
17 * what state a device context is in.
18 *
19 * The end result is that the following throws an error if we don't track it:
20 * QPixmap pmap;
21 * QPainter painter(&pmap);
22 * pmap.clear();
23 *
24 * Here BeginDraw would first be called through the paint device, then when we clear
25 * the pixmap we would have to call it again. There is no way to know what state
26 * the device context is in when performing the clear, and activating the dc is an
27 * error. Bummer.
28 *
29 * Hence we keep a reference count here and only activate/deactivate the device
30 * if the refcount is zero.
31 *
32 * In a nutshell: Do not call BeginDraw/EndDraw yourself on the device pointer, do
33 * so through the begin/end members below.
34 */
35
38{
39 Q_DECLARE_PRIVATE(QWindowsDirect2DDeviceContext)
41public:
42 QWindowsDirect2DDeviceContext(ID2D1DeviceContext *dc);
44
45 ID2D1DeviceContext *get() const;
46
47 void begin();
48 bool end();
49
51 void suspend();
52 void resume();
53
55};
56
67
69
70#endif // QWINDOWSDIRECT2DDEVICECONTEXT_H
\inmodule QtCore
Combined button and popup list for selecting options.
GLuint GLuint end
future resume()