1 2/* 3 * Copyright 2012 Google Inc. 4 * 5 * Use of this source code is governed by a BSD-style license that can be 6 * found in the LICENSE file. 7 */ 8 9 10#ifndef SKGLWIDGET_H_ 11#define SKGLWIDGET_H_ 12 13#if SK_SUPPORT_GPU 14 15#include <QtOpenGL/QGLWidget> 16#include "SkDebugCanvas.h" 17#include "SkDebugger.h" 18#include "SkDevice.h" 19#include "SkGpuDevice.h" 20#include "GrContext.h" 21#include "gl/GrGLInterface.h" 22#include "gl/GrGLUtil.h" 23#include "GrRenderTarget.h" 24 25class SkGLWidget : public QGLWidget { 26Q_OBJECT 27 28public: 29 SkGLWidget(SkDebugger* debugger); 30 31 ~SkGLWidget(); 32 33 void draw() { 34 this->updateGL(); 35 } 36 void setSampleCount(int sampleCount); 37 38signals: 39 void drawComplete(); 40 41protected: 42 void initializeGL(); 43 void resizeGL(int w, int h); 44 void paintGL(); 45 46 47private: 48 const GrGLInterface* fCurIntf; 49 GrContext* fCurContext; 50 SkGpuDevice* fGpuDevice; 51 SkCanvas* fCanvas; 52 SkDebugger* fDebugger; 53 GrBackendRenderTargetDesc getDesc(int w, int h); 54}; 55 56#endif /* SK_SUPPORT_GPU */ 57 58#endif /* SKGLWIDGET_H_ */ 59