blob: b0ded020f8b089a2500819790bb72b6c3d38d289 [file] [log] [blame]
chudy@google.com38b08ce2012-07-28 23:26:10 +00001/*
2 * SkRasterWidget.h
3 *
4 * Created on: Jul 28, 2012
5 * Author: chudy
6 */
7
8
9#ifndef SKRASTERWIDGET_H_
10#define SKRASTERWIDGET_H_
11
12#include "SkGpuDevice.h"
13#include "SkDevice.h"
14#include "SkDebugCanvas.h"
15
16#include <QApplication>
17#include <QtGui>
18#include <QWidget>
19
20class SkRasterWidget : public QWidget {
chudy@google.coma9e937c2012-08-03 17:32:05 +000021 Q_OBJECT
chudy@google.com38b08ce2012-07-28 23:26:10 +000022
23public:
chudy@google.com830b8792012-08-01 15:57:52 +000024 SkRasterWidget();
chudy@google.com38b08ce2012-07-28 23:26:10 +000025
26 ~SkRasterWidget();
27
28 void drawTo(int index) {
29 fIndex = index;
30 this->update();
31 }
32
33 void setDebugCanvas(SkDebugCanvas* debugCanvas) {
34 fDebugCanvas = debugCanvas;
chudy@google.com0b5bbb02012-07-31 19:55:32 +000035 fIndex = debugCanvas->getSize() - 1;
chudy@google.com38b08ce2012-07-28 23:26:10 +000036 this->update();
37 }
38
39 int getBitmapHeight() {
40 return fBitmap.height();
41 }
42
43 int getBitmapWidth() {
44 return fBitmap.width();
45 }
46
chudy@google.com38b08ce2012-07-28 23:26:10 +000047 void setTranslate(SkIPoint transform) {
48 fTransform = transform;
49 }
50
51 void setScale(float scale) {
52 fScaleFactor = scale;
53 }
54
chudy@google.coma9e937c2012-08-03 17:32:05 +000055signals:
56 void drawComplete();
57
chudy@google.com38b08ce2012-07-28 23:26:10 +000058protected:
59 void paintEvent(QPaintEvent* event);
60
61 void resizeEvent(QResizeEvent* event);
62
63private:
64 SkBitmap fBitmap;
65 SkDebugCanvas* fDebugCanvas;
chudy@google.com830b8792012-08-01 15:57:52 +000066 SkCanvas* fCanvas;
chudy@google.com38b08ce2012-07-28 23:26:10 +000067 SkDevice* fDevice;
68
chudy@google.com38b08ce2012-07-28 23:26:10 +000069 int fIndex;
70 SkIPoint fTransform;
71 float fScaleFactor;
72};
73
74#endif /* SKRASTERWIDGET_H_ */