2012-08-07 16:12:23 +00: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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef SKDEBUGGER_H_
|
|
|
|
#define SKDEBUGGER_H_
|
|
|
|
|
|
|
|
#include "SkDebugCanvas.h"
|
|
|
|
#include "SkPicture.h"
|
2012-11-19 20:44:29 +00:00
|
|
|
#include "SkTArray.h"
|
2012-08-07 16:12:23 +00:00
|
|
|
|
2013-03-12 13:07:40 +00:00
|
|
|
class SkString;
|
|
|
|
|
2012-08-07 16:12:23 +00:00
|
|
|
class SkDebugger {
|
|
|
|
public:
|
|
|
|
SkDebugger();
|
|
|
|
|
|
|
|
~SkDebugger();
|
|
|
|
|
|
|
|
void setIndex(int index) {
|
|
|
|
fIndex = index;
|
|
|
|
}
|
|
|
|
void draw(SkCanvas* canvas) {
|
|
|
|
if (fIndex > 0) {
|
|
|
|
fDebugCanvas->drawTo(canvas, fIndex);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void step();
|
|
|
|
void stepBack();
|
|
|
|
void play();
|
|
|
|
void rewind();
|
|
|
|
|
|
|
|
bool isCommandVisible(int index) {
|
|
|
|
return fDebugCanvas->getDrawCommandVisibilityAt(index);
|
|
|
|
}
|
|
|
|
|
|
|
|
void setCommandVisible(int index, bool isVisible) {
|
|
|
|
fDebugCanvas->toggleCommand(index, isVisible);
|
|
|
|
}
|
|
|
|
|
2012-11-19 20:44:29 +00:00
|
|
|
SkTArray<SkString>* getDrawCommandsAsStrings() {
|
2012-08-07 16:12:23 +00:00
|
|
|
return fDebugCanvas->getDrawCommandsAsStrings();
|
|
|
|
}
|
|
|
|
|
2012-11-19 20:44:29 +00:00
|
|
|
const SkTDArray<SkDrawCommand*>& getDrawCommands() const {
|
|
|
|
return fDebugCanvas->getDrawCommands();
|
|
|
|
}
|
|
|
|
|
2012-08-07 16:12:23 +00:00
|
|
|
void highlightCurrentCommand(bool on) {
|
|
|
|
fDebugCanvas->toggleFilter(on);
|
|
|
|
}
|
|
|
|
|
|
|
|
void resize(int width, int height) {
|
|
|
|
fDebugCanvas->setBounds(width, height);
|
|
|
|
}
|
|
|
|
|
|
|
|
void loadPicture(SkPicture* picture);
|
|
|
|
|
2013-01-22 18:03:56 +00:00
|
|
|
SkPicture* copyPicture();
|
2012-08-07 16:12:23 +00:00
|
|
|
|
|
|
|
int getSize() {
|
|
|
|
return fDebugCanvas->getSize();
|
|
|
|
}
|
|
|
|
|
2013-01-17 16:30:56 +00:00
|
|
|
void setUserMatrix(SkMatrix userMatrix) {
|
2012-08-07 16:12:23 +00:00
|
|
|
// Should this live in debugger instead?
|
2013-01-17 16:30:56 +00:00
|
|
|
fDebugCanvas->setUserMatrix(userMatrix);
|
2012-08-07 16:12:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int getCommandAtPoint(int x, int y, int index) {
|
|
|
|
return fDebugCanvas->getCommandAtPoint(x, y, index);
|
|
|
|
}
|
|
|
|
|
2012-08-07 20:41:37 +00:00
|
|
|
SkTDArray<SkString*>* getCommandInfo(int index) {
|
2012-08-07 16:12:23 +00:00
|
|
|
return fDebugCanvas->getCommandInfo(index);
|
|
|
|
}
|
|
|
|
|
|
|
|
const SkMatrix& getCurrentMatrix() {
|
|
|
|
return fDebugCanvas->getCurrentMatrix();
|
|
|
|
}
|
|
|
|
|
|
|
|
const SkIRect& getCurrentClip() {
|
|
|
|
return fDebugCanvas->getCurrentClip();
|
|
|
|
}
|
|
|
|
|
|
|
|
int pictureHeight() {
|
|
|
|
return fPictureHeight;
|
|
|
|
}
|
|
|
|
|
|
|
|
int pictureWidth() {
|
|
|
|
return fPictureWidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
int index() {
|
|
|
|
return fIndex;
|
|
|
|
}
|
|
|
|
|
2013-02-06 20:13:54 +00:00
|
|
|
void setOverdrawViz(bool overDrawViz) {
|
|
|
|
if (NULL != fDebugCanvas) {
|
|
|
|
fDebugCanvas->setOverdrawViz(overDrawViz);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-17 17:56:10 +00:00
|
|
|
void setTexFilterOverride(bool texFilterOverride, SkPaint::FilterLevel level) {
|
|
|
|
if (NULL != fDebugCanvas) {
|
|
|
|
fDebugCanvas->overrideTexFiltering(texFilterOverride, level);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-13 07:01:04 +00:00
|
|
|
void getOverviewText(const SkTDArray<double>* typeTimes, double totTime,
|
2013-03-12 15:33:40 +00:00
|
|
|
SkString* overview, int numRuns);
|
2013-02-06 20:13:54 +00:00
|
|
|
|
2012-08-07 16:12:23 +00:00
|
|
|
private:
|
|
|
|
SkDebugCanvas* fDebugCanvas;
|
|
|
|
SkPicture* fPicture;
|
|
|
|
|
|
|
|
int fPictureWidth;
|
|
|
|
int fPictureHeight;
|
|
|
|
int fIndex;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* SKDEBUGGER_H_ */
|