2011-07-28 14:26:00 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright 2011 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
2011-06-16 20:49:55 +00:00
|
|
|
#include "SkView.h"
|
|
|
|
#include "SkColor.h"
|
|
|
|
#include "SkBitmap.h"
|
|
|
|
#include "SkCanvas.h"
|
|
|
|
#include "SkGPipe.h"
|
|
|
|
#include "SkPaint.h"
|
|
|
|
|
|
|
|
#include "SkDebugDumper.h"
|
|
|
|
|
2011-08-12 14:27:47 +00:00
|
|
|
#define SKDEBUGGER_COMMANDTYPE "SKDEBUGGER_COMMAND"
|
|
|
|
#define SKDEBUGGER_STATETYPE "SKDEBUGGER_STATE"
|
2011-06-16 20:49:55 +00:00
|
|
|
|
2011-08-12 14:27:47 +00:00
|
|
|
#define SKDEBUGGER_ATOM "SKDEBUGGER_ATOM"
|
|
|
|
#define SKDEBUGGER_MATRIX "SKDEBUGGER_MATRIX"
|
|
|
|
#define SKDEBUGGER_CLIP "SKDEBUGGER_CLIP"
|
|
|
|
#define SKDEBUGGER_PAINTINFO "SKDEBUGGER_PAINTINFO"
|
|
|
|
#define SKDEBUGGER_PAINT "SKDEBUGGER_PAINT"
|
2011-06-16 20:49:55 +00:00
|
|
|
|
2011-08-12 14:27:47 +00:00
|
|
|
#define SKDEBUGGER_TEXTSIZE 14
|
|
|
|
#define CMD_WIDTH 200
|
|
|
|
#define INFO_HEIGHT 150.0
|
|
|
|
#define SKDEBUGGER_HIGHLIGHTCOLOR 0xFF113399
|
|
|
|
#define SKDEBUGGER_TEXTCOLOR 0xFF000000
|
|
|
|
#define SKDEBUGGER_RESIZEBARCOLOR 0xFF333333
|
|
|
|
#define SKDEBUGGER_RESIZEBARSIZE 5
|
2011-06-16 20:49:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Debugger - Info Panel
|
|
|
|
*/
|
2011-08-12 14:27:47 +00:00
|
|
|
class DebuggerStateView : public SkView {
|
2011-06-16 20:49:55 +00:00
|
|
|
public:
|
2011-08-12 14:27:47 +00:00
|
|
|
DebuggerStateView();
|
2011-06-16 20:49:55 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual bool onEvent(const SkEvent& evt);
|
|
|
|
virtual void onDraw(SkCanvas* canvas);
|
|
|
|
private:
|
|
|
|
SkColor fBGColor;
|
|
|
|
SkPaint fPaint;
|
|
|
|
SkString fMatrix;
|
|
|
|
SkString fPaintInfo;
|
|
|
|
SkString fClip;
|
2011-08-12 14:27:47 +00:00
|
|
|
bool fResizing;
|
2011-06-16 20:49:55 +00:00
|
|
|
typedef SkView INHERITED;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Debugger - Commands List
|
|
|
|
*/
|
2011-08-12 14:27:47 +00:00
|
|
|
class DebuggerCommandsView : public SkView {
|
2011-06-16 20:49:55 +00:00
|
|
|
public:
|
2011-08-12 14:27:47 +00:00
|
|
|
DebuggerCommandsView();
|
|
|
|
~DebuggerCommandsView();
|
2011-06-16 20:49:55 +00:00
|
|
|
int nextItem();
|
|
|
|
int prevItem();
|
|
|
|
int scrollUp();
|
|
|
|
int scrollDown();
|
|
|
|
void highlight(int index);
|
|
|
|
int selectHighlight(int ypos);
|
|
|
|
void toggleCentered();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual bool onEvent(const SkEvent& evt);
|
|
|
|
virtual void onSizeChange();
|
|
|
|
virtual void onDraw(SkCanvas* canvas);
|
|
|
|
private:
|
2011-08-12 14:27:47 +00:00
|
|
|
void init();
|
|
|
|
void alignCenter();
|
2011-06-16 20:49:55 +00:00
|
|
|
SkColor fBGColor;
|
|
|
|
int fTopIndex;
|
|
|
|
int fHighlight;
|
|
|
|
SkScalar fSpacing;
|
|
|
|
int fRange;
|
2011-08-12 14:27:47 +00:00
|
|
|
bool fResizing;
|
2011-06-16 20:49:55 +00:00
|
|
|
bool fCentered;
|
2011-08-12 14:27:47 +00:00
|
|
|
SkTDArray<SkString*> fList;
|
2011-06-16 20:49:55 +00:00
|
|
|
typedef SkView INHERITED;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static void* PaintProc(void* ptr, bool doRef) {
|
|
|
|
SkPaint* p = (SkPaint*) ptr;
|
|
|
|
|
|
|
|
if (doRef) {
|
|
|
|
return new SkPaint(*p);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
delete p;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|