From a425b5f19c20f357acf92950dda7b395c1ee4c72 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 18 Feb 2016 20:20:09 +0100 Subject: QWindowsGLContext: replace homebrew Array with std::vector std::vector is all that the Array original author dreamed about, and more: never shrinks capacity, non CoWed, ... Appart from append(), the Array API was modeled after std::vector (size_t size_type, etc) already, so the port to std::vector is minimal. The only change besides append() -> push_back() was not assuming const_iterator being const T*. Remove now-unused Array. Change-Id: I02bc71441d01e554e320746d82dbc00f74c5466d Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowsglcontext.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src/plugins/platforms/windows/qwindowsglcontext.cpp') diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp index 71b2387c7c..1adce2a874 100644 --- a/src/plugins/platforms/windows/qwindowsglcontext.cpp +++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp @@ -1270,10 +1270,9 @@ bool QWindowsGLContext::updateObtainedParams(HDC hdc, int *obtainedSwapInterval) void QWindowsGLContext::releaseDCs() { - const QOpenGLContextData *end = m_windowContexts.end(); - for (const QOpenGLContextData *p = m_windowContexts.begin(); p < end; ++p) - ReleaseDC(p->hwnd, p->hdc); - m_windowContexts.resize(0); + for (const auto &e : m_windowContexts) + ReleaseDC(e.hwnd, e.hdc); + m_windowContexts.clear(); } static inline QWindowsWindow *glWindowOf(QPlatformSurface *s) @@ -1288,12 +1287,12 @@ static inline HWND handleOf(QPlatformSurface *s) // Find a window in a context list. static inline const QOpenGLContextData * - findByHWND(const Array &data, HWND hwnd) + findByHWND(const std::vector &data, HWND hwnd) { - const QOpenGLContextData *end = data.end(); - for (const QOpenGLContextData *p = data.begin(); p < end; ++p) - if (p->hwnd == hwnd) - return p; + for (const auto &e : data) { + if (e.hwnd == hwnd) + return &e; + } return 0; } @@ -1347,7 +1346,7 @@ bool QWindowsGLContext::makeCurrent(QPlatformSurface *surface) if (m_obtainedFormat.swapBehavior() == QSurfaceFormat::DoubleBuffer) window->setFlag(QWindowsWindow::OpenGLDoubleBuffered); } - m_windowContexts.append(newContext); + m_windowContexts.push_back(newContext); m_lost = false; bool success = QOpenGLStaticContext::opengl32.wglMakeCurrent(newContext.hdc, newContext.renderingContext); -- cgit v1.2.3