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

Unified Diff: debugger/QT/SkGLWidget.cpp

Issue 18275002: Basic error checking for debugger GL widget. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 6 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
===================================================================
--- debugger/QT/SkGLWidget.cpp (revision 9826)
+++ debugger/QT/SkGLWidget.cpp (working copy)
@@ -29,6 +29,9 @@
void SkGLWidget::initializeGL() {
fCurIntf = GrGLCreateNativeInterface();
+ if (!fCurIntf) {
+ return;
+ }
fCurContext = GrContext::Create(kOpenGL_GrBackend, (GrBackendContext) fCurIntf);
GrBackendRenderTargetDesc desc = this->getDesc(this->width(), this->height());
desc.fOrigin = kBottomLeft_GrSurfaceOrigin;
@@ -43,19 +46,21 @@
}
void SkGLWidget::resizeGL(int w, int h) {
- GrBackendRenderTargetDesc desc = this->getDesc(w, h);
- desc.fOrigin = kBottomLeft_GrSurfaceOrigin;
- GrRenderTarget* curRenderTarget = fCurContext->wrapBackendRenderTarget(desc);
- SkSafeUnref(fGpuDevice);
- SkSafeUnref(fCanvas);
- fGpuDevice = new SkGpuDevice(fCurContext, curRenderTarget);
- fCanvas = new SkCanvas(fGpuDevice);
+ if (fCurContext) {
+ GrBackendRenderTargetDesc desc = this->getDesc(w, h);
+ desc.fOrigin = kBottomLeft_GrSurfaceOrigin;
+ GrRenderTarget* curRenderTarget = fCurContext->wrapBackendRenderTarget(desc);
+ SkSafeUnref(fGpuDevice);
+ SkSafeUnref(fCanvas);
+ fGpuDevice = new SkGpuDevice(fCurContext, curRenderTarget);
+ fCanvas = new SkCanvas(fGpuDevice);
+ }
fDebugger->resize(w, h);
draw();
}
void SkGLWidget::paintGL() {
- if (!this->isHidden()) {
+ if (!this->isHidden() && fCanvas) {
fDebugger->draw(fCanvas);
// 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