2012-06-29 18:21:22 +04: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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2012-07-26 23:38:22 +04:00
|
|
|
#ifndef SKCANVASWIDGET_H_
|
|
|
|
#define SKCANVASWIDGET_H_
|
2012-06-29 18:21:22 +04:00
|
|
|
|
2012-07-26 23:38:22 +04:00
|
|
|
#include <QWidget>
|
|
|
|
#include <QHBoxLayout>
|
|
|
|
#include "SkStream.h"
|
|
|
|
#include "SkRasterWidget.h"
|
|
|
|
#include "SkGLWidget.h"
|
2012-08-07 20:12:23 +04:00
|
|
|
#include "SkDebugger.h"
|
2012-06-29 18:21:22 +04:00
|
|
|
|
|
|
|
class SkCanvasWidget : public QWidget {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2012-08-07 20:12:23 +04:00
|
|
|
SkCanvasWidget(QWidget* parent, SkDebugger* debugger);
|
2012-06-29 18:21:22 +04:00
|
|
|
|
2012-07-31 16:49:52 +04:00
|
|
|
~SkCanvasWidget();
|
2012-06-29 18:21:22 +04:00
|
|
|
|
2012-07-26 23:38:22 +04:00
|
|
|
enum WidgetType {
|
|
|
|
kRaster_8888_WidgetType = 1 << 0,
|
|
|
|
kGPU_WidgetType = 1 << 1,
|
|
|
|
};
|
2012-06-29 18:21:22 +04:00
|
|
|
|
2012-07-26 23:38:22 +04:00
|
|
|
void drawTo(int index);
|
|
|
|
|
|
|
|
void setWidgetVisibility(WidgetType type, bool isHidden);
|
|
|
|
|
2012-07-27 00:26:44 +04:00
|
|
|
void zoom(float zoomIncrement);
|
2012-06-29 18:21:22 +04:00
|
|
|
|
2012-08-14 20:00:32 +04:00
|
|
|
void resetWidgetTransform();
|
|
|
|
|
2012-07-10 00:26:53 +04:00
|
|
|
signals:
|
|
|
|
void scaleFactorChanged(float newScaleFactor);
|
|
|
|
void commandChanged(int newCommand);
|
2012-07-12 18:31:25 +04:00
|
|
|
void hitChanged(int hit);
|
2012-07-10 00:26:53 +04:00
|
|
|
|
2012-07-27 00:26:44 +04:00
|
|
|
private slots:
|
|
|
|
void keyZoom(int zoomIncrement) {
|
|
|
|
zoom(zoomIncrement);
|
|
|
|
}
|
|
|
|
|
2012-06-29 18:21:22 +04:00
|
|
|
private:
|
2012-07-26 23:38:22 +04:00
|
|
|
QHBoxLayout fHorizontalLayout;
|
|
|
|
SkRasterWidget fRasterWidget;
|
|
|
|
SkGLWidget fGLWidget;
|
2012-08-07 20:12:23 +04:00
|
|
|
SkDebugger* fDebugger;
|
2012-07-03 20:05:59 +04:00
|
|
|
SkIPoint fPreviousPoint;
|
2012-08-01 19:57:52 +04:00
|
|
|
SkIPoint fUserOffset;
|
|
|
|
float fUserScaleFactor;
|
2012-07-26 23:38:22 +04:00
|
|
|
|
|
|
|
void mouseMoveEvent(QMouseEvent* event);
|
|
|
|
|
|
|
|
void mousePressEvent(QMouseEvent* event);
|
|
|
|
|
|
|
|
void mouseDoubleClickEvent(QMouseEvent* event);
|
|
|
|
|
2012-07-27 00:26:44 +04:00
|
|
|
void wheelEvent(QWheelEvent* event) {
|
|
|
|
zoom(event->delta()/120);
|
|
|
|
}
|
2012-06-29 18:21:22 +04:00
|
|
|
};
|
|
|
|
|
2012-07-26 23:38:22 +04:00
|
|
|
|
|
|
|
#endif /* SKCANVASWIDGET_H_ */
|