2012-07-26 19:38:22 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright 2012 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef SKGLWIDGET_H_
|
|
|
|
#define SKGLWIDGET_H_
|
|
|
|
|
2013-02-13 13:26:13 +00:00
|
|
|
#if SK_SUPPORT_GPU
|
|
|
|
|
2012-07-26 19:38:22 +00:00
|
|
|
#include <QtOpenGL/QGLWidget>
|
|
|
|
#include "SkDebugCanvas.h"
|
2012-08-07 16:12:23 +00:00
|
|
|
#include "SkDebugger.h"
|
2012-07-26 19:38:22 +00:00
|
|
|
#include "SkGpuDevice.h"
|
|
|
|
#include "GrContext.h"
|
|
|
|
#include "gl/GrGLInterface.h"
|
|
|
|
#include "gl/GrGLUtil.h"
|
|
|
|
|
|
|
|
class SkGLWidget : public QGLWidget {
|
2012-08-03 17:32:05 +00:00
|
|
|
Q_OBJECT
|
2012-07-26 19:38:22 +00:00
|
|
|
|
|
|
|
public:
|
2012-08-07 16:12:23 +00:00
|
|
|
SkGLWidget(SkDebugger* debugger);
|
2012-07-26 19:38:22 +00:00
|
|
|
|
|
|
|
~SkGLWidget();
|
|
|
|
|
2015-01-14 06:49:02 +00:00
|
|
|
void updateImage() {
|
2012-07-26 19:38:22 +00:00
|
|
|
this->updateGL();
|
|
|
|
}
|
2013-08-02 13:59:50 +00:00
|
|
|
void setSampleCount(int sampleCount);
|
2012-07-26 19:38:22 +00:00
|
|
|
|
2016-03-01 17:34:38 +00:00
|
|
|
Q_SIGNALS:
|
2012-08-03 17:32:05 +00:00
|
|
|
void drawComplete();
|
|
|
|
|
2012-07-26 19:38:22 +00:00
|
|
|
protected:
|
|
|
|
void initializeGL();
|
|
|
|
void resizeGL(int w, int h);
|
|
|
|
void paintGL();
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
2014-12-22 14:06:41 +00:00
|
|
|
void createRenderTarget();
|
2016-11-04 17:02:54 +00:00
|
|
|
sk_sp<const GrGLInterface> fCurIntf;
|
|
|
|
sk_sp<GrContext> fCurContext;
|
2016-08-01 12:53:23 +00:00
|
|
|
|
|
|
|
sk_sp<SkSurface> fGpuSurface;
|
|
|
|
SkCanvas* fCanvas;
|
|
|
|
|
2012-08-07 16:12:23 +00:00
|
|
|
SkDebugger* fDebugger;
|
2012-10-25 18:43:28 +00:00
|
|
|
GrBackendRenderTargetDesc getDesc(int w, int h);
|
2012-07-26 19:38:22 +00:00
|
|
|
};
|
|
|
|
|
2013-02-13 13:26:13 +00:00
|
|
|
#endif /* SK_SUPPORT_GPU */
|
|
|
|
|
2012-07-26 19:38:22 +00:00
|
|
|
#endif /* SKGLWIDGET_H_ */
|