0b5bbb0f82
Review URL: https://codereview.appspot.com/6443068 git-svn-id: http://skia.googlecode.com/svn/trunk@4867 2bbb7eff-a529-9590-31e7-b0007b416f81
81 lines
1.4 KiB
C++
81 lines
1.4 KiB
C++
/*
|
|
* SkRasterWidget.h
|
|
*
|
|
* Created on: Jul 28, 2012
|
|
* Author: chudy
|
|
*/
|
|
|
|
|
|
#ifndef SKRASTERWIDGET_H_
|
|
#define SKRASTERWIDGET_H_
|
|
|
|
#include "SkGpuDevice.h"
|
|
#include "SkDevice.h"
|
|
#include "SkDebugCanvas.h"
|
|
|
|
#include <QApplication>
|
|
#include <QtGui>
|
|
#include <QWidget>
|
|
|
|
class SkRasterWidget : public QWidget {
|
|
|
|
public:
|
|
SkRasterWidget(QWidget* parent = NULL);
|
|
|
|
~SkRasterWidget();
|
|
|
|
void drawTo(int index) {
|
|
fIndex = index;
|
|
this->update();
|
|
}
|
|
|
|
void setDebugCanvas(SkDebugCanvas* debugCanvas) {
|
|
fDebugCanvas = debugCanvas;
|
|
fIndex = debugCanvas->getSize() - 1;
|
|
this->update();
|
|
}
|
|
|
|
int getBitmapHeight() {
|
|
return fBitmap.height();
|
|
}
|
|
|
|
int getBitmapWidth() {
|
|
return fBitmap.width();
|
|
}
|
|
|
|
const SkMatrix& getCurrentMatrix() {
|
|
return fMatrix;
|
|
}
|
|
|
|
const SkIRect& getCurrentClip() {
|
|
return fClip;
|
|
}
|
|
|
|
void setTranslate(SkIPoint transform) {
|
|
fTransform = transform;
|
|
}
|
|
|
|
void setScale(float scale) {
|
|
fScaleFactor = scale;
|
|
}
|
|
|
|
protected:
|
|
void paintEvent(QPaintEvent* event);
|
|
|
|
void resizeEvent(QResizeEvent* event);
|
|
|
|
private:
|
|
SkBitmap fBitmap;
|
|
SkDebugCanvas* fDebugCanvas;
|
|
SkDevice* fDevice;
|
|
|
|
SkMatrix fMatrix;
|
|
SkIRect fClip;
|
|
|
|
int fIndex;
|
|
SkIPoint fTransform;
|
|
float fScaleFactor;
|
|
};
|
|
|
|
#endif /* SKRASTERWIDGET_H_ */
|