summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/phonon/ds9/videorenderer_vmr9.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/phonon/ds9/videorenderer_vmr9.cpp')
-rw-r--r--src/3rdparty/phonon/ds9/videorenderer_vmr9.cpp36
1 files changed, 31 insertions, 5 deletions
diff --git a/src/3rdparty/phonon/ds9/videorenderer_vmr9.cpp b/src/3rdparty/phonon/ds9/videorenderer_vmr9.cpp
index 545b31e..cf4937b 100644
--- a/src/3rdparty/phonon/ds9/videorenderer_vmr9.cpp
+++ b/src/3rdparty/phonon/ds9/videorenderer_vmr9.cpp
@@ -20,8 +20,11 @@ along with this library. If not, see <http://www.gnu.org/licenses/>.
#ifndef QT_NO_PHONON_VIDEO
-#include <QtGui/QWidget>
+#include <QtWidgets/QWidget>
#include <QtGui/QPainter>
+#include <QtGui/QGuiApplication>
+#include <QtGui/QBackingStore>
+#include <QtGui/QPlatformNativeInterface>
#include <d3d9.h>
#include <vmr9.h>
@@ -31,6 +34,26 @@ QT_BEGIN_NAMESPACE
namespace Phonon
{
+ static inline HWND hwndForWidget(QWidget *widget)
+ {
+ QWindow *window = widget->windowHandle();
+ return static_cast<HWND> (QGuiApplication::platformNativeInterface()->nativeResourceForWindow("handle", window));
+ }
+
+ static inline HDC getDC(const QWidget *widget)
+ {
+ QBackingStore *backingStore = widget->backingStore();
+ QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface();
+ return static_cast<HDC>(nativeInterface->nativeResourceForBackingStore("getDC", backingStore));
+ }
+
+ static inline void releaseDC(const QWidget *widget)
+ {
+ QBackingStore *backingStore = widget->backingStore();
+ QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface();
+ nativeInterface->nativeResourceForBackingStore("releaseDC", backingStore);
+ }
+
namespace DS9
{
VideoRendererVMR9::~VideoRendererVMR9()
@@ -106,11 +129,15 @@ namespace Phonon
void VideoRendererVMR9::repaintCurrentFrame(QWidget *target, const QRect &rect)
{
- HDC hDC = target->getDC();
+ const HDC hDC = getDC(target);
// repaint the video
ComPointer<IVMRWindowlessControl9> windowlessControl(m_filter, IID_IVMRWindowlessControl9);
- HRESULT hr = windowlessControl ? windowlessControl->RepaintVideo(target->winId(), hDC) : E_POINTER;
+ HRESULT hr = E_POINTER;
+ if (windowlessControl) {
+ const HWND hwnd = hwndForWidget(target);
+ hr = windowlessControl->RepaintVideo(hwnd, hDC);
+ }
if (FAILED(hr) || m_dstY > 0 || m_dstX > 0) {
const QColor c = target->palette().color(target->backgroundRole());
COLORREF color = RGB(c.red(), c.green(), c.blue());
@@ -135,8 +162,7 @@ namespace Phonon
::DeleteObject(hPen);
::DeleteObject(hBrush);
}
- target->releaseDC(hDC);
-
+ releaseDC(target);
}
void VideoRendererVMR9::notifyResize(const QSize &size, Phonon::VideoWidget::AspectRatio aspectRatio,