diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2016-02-18 20:20:09 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2016-02-20 13:36:19 +0000 |
commit | a425b5f19c20f357acf92950dda7b395c1ee4c72 (patch) | |
tree | 4db0ed2aab2a884466c7033989cc5fe85932cf90 /src/plugins/platforms/windows/qwindowsglcontext.cpp | |
parent | 611942f2d737cc75c7492dffc183174e432aa155 (diff) |
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 <Friedemann.Kleint@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowsglcontext.cpp')
-rw-r--r-- | src/plugins/platforms/windows/qwindowsglcontext.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
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<QOpenGLContextData> &data, HWND hwnd) + findByHWND(const std::vector<QOpenGLContextData> &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); |