blob: baef12613888530653919d3d58a57df68d9e97c9 [file] [log] [blame]
chudy@google.comea5488b2012-07-26 19:38:22 +00001
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.come8fe4bc2013-02-13 13:26:13 +000013#if SK_SUPPORT_GPU
14
chudy@google.comea5488b2012-07-26 19:38:22 +000015#include <QtOpenGL/QGLWidget>
16#include "SkDebugCanvas.h"
chudy@google.com607357f2012-08-07 16:12:23 +000017#include "SkDebugger.h"
chudy@google.comea5488b2012-07-26 19:38:22 +000018#include "SkDevice.h"
19#include "SkGpuDevice.h"
chudy@google.comea5488b2012-07-26 19:38:22 +000020#include "GrContext.h"
21#include "gl/GrGLInterface.h"
22#include "gl/GrGLUtil.h"
23#include "GrRenderTarget.h"
24
25class SkGLWidget : public QGLWidget {
chudy@google.coma9e937c2012-08-03 17:32:05 +000026Q_OBJECT
chudy@google.comea5488b2012-07-26 19:38:22 +000027
28public:
chudy@google.com607357f2012-08-07 16:12:23 +000029 SkGLWidget(SkDebugger* debugger);
chudy@google.comea5488b2012-07-26 19:38:22 +000030
31 ~SkGLWidget();
32
kkinnunencfdc0e32015-01-13 22:49:02 -080033 void updateImage() {
chudy@google.comea5488b2012-07-26 19:38:22 +000034 this->updateGL();
35 }
commit-bot@chromium.orgfde1e7c2013-08-02 13:59:50 +000036 void setSampleCount(int sampleCount);
chudy@google.comea5488b2012-07-26 19:38:22 +000037
chudy@google.coma9e937c2012-08-03 17:32:05 +000038signals:
39 void drawComplete();
40
chudy@google.comea5488b2012-07-26 19:38:22 +000041protected:
42 void initializeGL();
43 void resizeGL(int w, int h);
44 void paintGL();
45
46
47private:
kkinnunen4be02382014-12-22 06:06:41 -080048 void createRenderTarget();
49 SkAutoTUnref<const GrGLInterface> fCurIntf;
50 SkAutoTUnref<GrContext> fCurContext;
51 SkAutoTUnref<SkGpuDevice> fGpuDevice;
52 SkAutoTUnref<SkCanvas> fCanvas;
chudy@google.com607357f2012-08-07 16:12:23 +000053 SkDebugger* fDebugger;
bsalomon@google.com16e3dde2012-10-25 18:43:28 +000054 GrBackendRenderTargetDesc getDesc(int w, int h);
chudy@google.comea5488b2012-07-26 19:38:22 +000055};
56
robertphillips@google.come8fe4bc2013-02-13 13:26:13 +000057#endif /* SK_SUPPORT_GPU */
58
chudy@google.comea5488b2012-07-26 19:38:22 +000059#endif /* SKGLWIDGET_H_ */