| 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 "SkGpuDevice.h" | 
| chudy@google.com | ea5488b | 2012-07-26 19:38:22 +0000 | [diff] [blame] | 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 |  | 
| kkinnunen | cfdc0e3 | 2015-01-13 22:49:02 -0800 | [diff] [blame] | 32 | void updateImage() { | 
| chudy@google.com | ea5488b | 2012-07-26 19:38:22 +0000 | [diff] [blame] | 33 | this->updateGL(); | 
|  | 34 | } | 
| commit-bot@chromium.org | fde1e7c | 2013-08-02 13:59:50 +0000 | [diff] [blame] | 35 | void setSampleCount(int sampleCount); | 
| chudy@google.com | ea5488b | 2012-07-26 19:38:22 +0000 | [diff] [blame] | 36 |  | 
| robertphillips | 9ea8acd | 2016-03-01 09:34:38 -0800 | [diff] [blame] | 37 | Q_SIGNALS: | 
| chudy@google.com | a9e937c | 2012-08-03 17:32:05 +0000 | [diff] [blame] | 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: | 
| kkinnunen | 4be0238 | 2014-12-22 06:06:41 -0800 | [diff] [blame] | 47 | void createRenderTarget(); | 
| Hal Canary | 2db8361 | 2016-11-04 13:02:54 -0400 | [diff] [blame^] | 48 | sk_sp<const GrGLInterface> fCurIntf; | 
|  | 49 | sk_sp<GrContext> fCurContext; | 
| robertphillips | 12e9662 | 2016-08-01 05:53:23 -0700 | [diff] [blame] | 50 |  | 
|  | 51 | sk_sp<SkSurface> fGpuSurface; | 
|  | 52 | SkCanvas*        fCanvas; | 
|  | 53 |  | 
| chudy@google.com | 607357f | 2012-08-07 16:12:23 +0000 | [diff] [blame] | 54 | SkDebugger* fDebugger; | 
| bsalomon@google.com | 16e3dde | 2012-10-25 18:43:28 +0000 | [diff] [blame] | 55 | GrBackendRenderTargetDesc getDesc(int w, int h); | 
| chudy@google.com | ea5488b | 2012-07-26 19:38:22 +0000 | [diff] [blame] | 56 | }; | 
|  | 57 |  | 
| robertphillips@google.com | e8fe4bc | 2013-02-13 13:26:13 +0000 | [diff] [blame] | 58 | #endif /* SK_SUPPORT_GPU */ | 
|  | 59 |  | 
| chudy@google.com | ea5488b | 2012-07-26 19:38:22 +0000 | [diff] [blame] | 60 | #endif /* SKGLWIDGET_H_ */ |