blob: ccbb1eef217c59585317ca0d8dd98e1ae2c5c878 [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
chudy@google.com607357f2012-08-07 16:12:23 +000033 void draw() {
chudy@google.comea5488b2012-07-26 19:38:22 +000034 this->updateGL();
35 }
36
chudy@google.coma9e937c2012-08-03 17:32:05 +000037signals:
38 void drawComplete();
39
chudy@google.comea5488b2012-07-26 19:38:22 +000040protected:
41 void initializeGL();
42 void resizeGL(int w, int h);
43 void paintGL();
44
45
46private:
47 const GrGLInterface* fCurIntf;
48 GrContext* fCurContext;
49 SkGpuDevice* fGpuDevice;
50 SkCanvas* fCanvas;
chudy@google.com607357f2012-08-07 16:12:23 +000051 SkDebugger* fDebugger;
bsalomon@google.com16e3dde2012-10-25 18:43:28 +000052 GrBackendRenderTargetDesc getDesc(int w, int h);
chudy@google.comea5488b2012-07-26 19:38:22 +000053};
54
robertphillips@google.come8fe4bc2013-02-13 13:26:13 +000055#endif /* SK_SUPPORT_GPU */
56
chudy@google.comea5488b2012-07-26 19:38:22 +000057#endif /* SKGLWIDGET_H_ */