| chudy@google.com | ea5488b | 2012-07-26 19:38:22 +0000 | [diff] [blame] | 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 | #include <QtOpenGL/QGLWidget> |
| 14 | #include "SkDebugCanvas.h" |
| chudy@google.com | 607357f | 2012-08-07 16:12:23 +0000 | [diff] [blame] | 15 | #include "SkDebugger.h" |
| chudy@google.com | ea5488b | 2012-07-26 19:38:22 +0000 | [diff] [blame] | 16 | #include "SkDevice.h" |
| 17 | #include "SkGpuDevice.h" |
| 18 | |
| 19 | #include "GrContext.h" |
| 20 | #include "gl/GrGLInterface.h" |
| 21 | #include "gl/GrGLUtil.h" |
| 22 | #include "GrRenderTarget.h" |
| 23 | |
| 24 | class SkGLWidget : public QGLWidget { |
| chudy@google.com | a9e937c | 2012-08-03 17:32:05 +0000 | [diff] [blame] | 25 | Q_OBJECT |
| chudy@google.com | ea5488b | 2012-07-26 19:38:22 +0000 | [diff] [blame] | 26 | |
| 27 | public: |
| chudy@google.com | 607357f | 2012-08-07 16:12:23 +0000 | [diff] [blame] | 28 | SkGLWidget(SkDebugger* debugger); |
| chudy@google.com | ea5488b | 2012-07-26 19:38:22 +0000 | [diff] [blame] | 29 | |
| 30 | ~SkGLWidget(); |
| 31 | |
| chudy@google.com | 607357f | 2012-08-07 16:12:23 +0000 | [diff] [blame] | 32 | void draw() { |
| chudy@google.com | ea5488b | 2012-07-26 19:38:22 +0000 | [diff] [blame] | 33 | this->updateGL(); |
| 34 | } |
| 35 | |
| chudy@google.com | a9e937c | 2012-08-03 17:32:05 +0000 | [diff] [blame] | 36 | signals: |
| 37 | void drawComplete(); |
| 38 | |
| chudy@google.com | ea5488b | 2012-07-26 19:38:22 +0000 | [diff] [blame] | 39 | protected: |
| 40 | void initializeGL(); |
| 41 | void resizeGL(int w, int h); |
| 42 | void paintGL(); |
| 43 | |
| 44 | |
| 45 | private: |
| 46 | const GrGLInterface* fCurIntf; |
| 47 | GrContext* fCurContext; |
| 48 | SkGpuDevice* fGpuDevice; |
| 49 | SkCanvas* fCanvas; |
| chudy@google.com | 607357f | 2012-08-07 16:12:23 +0000 | [diff] [blame] | 50 | SkDebugger* fDebugger; |
| bsalomon@google.com | 16e3dde | 2012-10-25 18:43:28 +0000 | [diff] [blame^] | 51 | GrBackendRenderTargetDesc getDesc(int w, int h); |
| chudy@google.com | ea5488b | 2012-07-26 19:38:22 +0000 | [diff] [blame] | 52 | }; |
| 53 | |
| 54 | #endif /* SKGLWIDGET_H_ */ |