Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1140)

Unified Diff: debugger/QT/SkGLWidget.cpp

Issue 915573002: debugger: Abandon context when Qt changes it without notice (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: debugger/QT/SkGLWidget.cpp
diff --git a/debugger/QT/SkGLWidget.cpp b/debugger/QT/SkGLWidget.cpp
index 1fbedf17a77f14aa8b0f50d802cea94ce009a3b5..67202390247d99874dd02424c4f565b36fdc3309 100644
--- a/debugger/QT/SkGLWidget.cpp
+++ b/debugger/QT/SkGLWidget.cpp
@@ -32,19 +32,16 @@ void SkGLWidget::initializeGL() {
if (!fCurIntf) {
return;
}
- if (!fCurContext) {
- fCurContext.reset(GrContext::Create(kOpenGL_GrBackend, (GrBackendContext) fCurIntf.get()));
- }
- if (!fCurContext) {
- return;
- }
-
// The call may come multiple times, for example after setSampleCount(). The QGLContext will be
// different, but we do not have a mechanism to catch the destroying of QGLContext, so that
- // proper resource cleanup could be made. Instead, we assume that the underlying GL context
- // never actually changes. If it would, we could not destroy the resources.
+ // proper resource cleanup could be made.
+ if (fCurContext) {
+ fCurContext->abandonContext();
+ }
fGpuDevice.reset(NULL);
fCanvas.reset(NULL);
+
+ fCurContext.reset(GrContext::Create(kOpenGL_GrBackend, (GrBackendContext) fCurIntf.get()));
}
void SkGLWidget::createRenderTarget() {
@@ -76,6 +73,7 @@ void SkGLWidget::resizeGL(int w, int h) {
void SkGLWidget::paintGL() {
if (!this->isHidden() && fCanvas) {
+ fCurContext->resetContext();
fDebugger->draw(fCanvas.get());
// TODO(chudy): Implement an optional flush button in Gui.
fCanvas->flush();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698