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