SkGLWidget.h revision 16e3ddea6a80972aced04b21b1d66377fa95e7c7
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"
15#include "SkDebugger.h"
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
24class SkGLWidget : public QGLWidget {
25Q_OBJECT
26
27public:
28    SkGLWidget(SkDebugger* debugger);
29
30    ~SkGLWidget();
31
32    void draw() {
33        this->updateGL();
34    }
35
36signals:
37    void drawComplete();
38
39protected:
40    void initializeGL();
41    void resizeGL(int w, int h);
42    void paintGL();
43
44
45private:
46    const GrGLInterface* fCurIntf;
47    GrContext* fCurContext;
48    SkGpuDevice* fGpuDevice;
49    SkCanvas* fCanvas;
50    SkDebugger* fDebugger;
51    GrBackendRenderTargetDesc getDesc(int w, int h);
52};
53
54#endif /* SKGLWIDGET_H_ */
55