2d537a18f4
Review URL: https://codereview.appspot.com/6441070 git-svn-id: http://skia.googlecode.com/svn/trunk@4849 2bbb7eff-a529-9590-31e7-b0007b416f81
68 lines
1.3 KiB
C++
68 lines
1.3 KiB
C++
|
|
/*
|
|
* 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_
|
|
|
|
#include <QtOpenGL/QGLWidget>
|
|
#include "SkDebugCanvas.h"
|
|
#include "SkDevice.h"
|
|
#include "SkGpuDevice.h"
|
|
|
|
#include "GrContext.h"
|
|
#include "gl/GrGLInterface.h"
|
|
#include "gl/GrGLUtil.h"
|
|
#include "GrRenderTarget.h"
|
|
|
|
class SkGLWidget : public QGLWidget {
|
|
|
|
public:
|
|
SkGLWidget();
|
|
|
|
~SkGLWidget();
|
|
|
|
void setDebugCanvas(SkDebugCanvas* debugCanvas) {
|
|
fDebugCanvas = debugCanvas;
|
|
fIndex = debugCanvas->getSize();
|
|
this->updateGL();
|
|
}
|
|
|
|
void drawTo(int index) {
|
|
fIndex = index;
|
|
this->updateGL();
|
|
}
|
|
|
|
void setTranslate(SkIPoint translate) {
|
|
fTransform = translate;
|
|
}
|
|
|
|
void setScale(float scale) {
|
|
fScaleFactor = scale;
|
|
}
|
|
|
|
protected:
|
|
void initializeGL();
|
|
void resizeGL(int w, int h);
|
|
void paintGL();
|
|
|
|
|
|
private:
|
|
const GrGLInterface* fCurIntf;
|
|
GrContext* fCurContext;
|
|
SkGpuDevice* fGpuDevice;
|
|
SkCanvas* fCanvas;
|
|
SkDebugCanvas* fDebugCanvas;
|
|
int fIndex;
|
|
SkIPoint fTransform;
|
|
float fScaleFactor;
|
|
GrPlatformRenderTargetDesc getDesc(int w, int h);
|
|
};
|
|
|
|
#endif /* SKGLWIDGET_H_ */
|