skia2/debugger/QT/SkInspectorWidget.h
commit-bot@chromium.org 2a67e123a3 This adds a checkbox to the debugger to allow seeing the effect pathops has on the clip. A new tab shows the C code that the pathops generate.
Once in place, this CL found a bug in the pathops code where it was not handling empty clip stack elements correctly. The Cl also has the change to SkCanvas to fix this bug.

R=robertphillips@google.com, reed@google.com

Author: caryclark@google.com

Review URL: https://codereview.chromium.org/282283002

git-svn-id: http://skia.googlecode.com/svn/trunk@14774 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-05-19 13:53:10 +00:00

108 lines
2.4 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 SKINSPECTORWIDGET_H_
#define SKINSPECTORWIDGET_H_
#include "SkMatrix.h"
#include <QWidget>
#include <QTabWidget>
#include <QTextEdit>
#include <QHBoxLayout>
#include <QLabel>
#include <QLineEdit>
/** \class SkInspectorWidget
The InspectorWidget contains the overview and details tab. These contain
information about the whole picture and details about each draw command.
*/
class SkInspectorWidget : public QWidget {
Q_OBJECT
public:
enum TabType {
kOverview_TabType,
kDetail_TabType,
kClipStack_TabType,
kTotalTabCount,
};
/**
Constructs a widget with the specified parent for layout purposes.
@param parent The parent container of this widget
*/
SkInspectorWidget();
void setDisabled(bool isDisabled) {
fMatrixAndClipWidget.setDisabled(isDisabled);
}
/**
Sets the text in tab at the specified index.
@param text
*/
void setText(QString text, TabType type);
/**
Sets the text in the current matrix.
@param matrixValues
*/
void setMatrix(const SkMatrix& matrix);
/**
Sets the text in the current clip.
@param clipValues
*/
void setClip(const SkIRect& clip);
class Tab : public QWidget {
QWidget fTab;
QHBoxLayout fTabLayout;
QTextEdit fTabText;
QString fName;
Tab(const char* name) {
fTabText.setReadOnly(true);
fTabLayout.setSpacing(6);
fTabLayout.setContentsMargins(11, 11, 11, 11);
fTabLayout.addWidget(&fTabText);
fTab.setLayout(&fTabLayout);
fName = QString(name);
}
};
private:
QHBoxLayout fHorizontalLayout;
QTabWidget fTabWidget;
QWidget fTabs[kTotalTabCount];
QHBoxLayout fTabLayouts[kTotalTabCount];
QTextEdit fTabTexts[kTotalTabCount];
QWidget fMatrixAndClipWidget;
QVBoxLayout fVerticalLayout;
QLabel fMatrixLabel;
QVBoxLayout fMatrixLayout;
QHBoxLayout fMatrixRow[3];
QLineEdit fMatrixEntry[9];
QLabel fClipLabel;
QVBoxLayout fClipLayout;
QHBoxLayout fClipRow[2];
QLineEdit fClipEntry[4];
QVBoxLayout* setupMatrix();
QVBoxLayout* setupClip();
};
#endif