diff --git a/experimental/Debugger/DebuggerCommandsView.cpp b/experimental/Debugger/DebuggerCommandsView.cpp deleted file mode 100644 index 735c808a59..0000000000 --- a/experimental/Debugger/DebuggerCommandsView.cpp +++ /dev/null @@ -1,145 +0,0 @@ - -/* - * Copyright 2011 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ -#include "DebuggerViews.h" - -DebuggerCommandsView::DebuggerCommandsView() { - fBGColor = 0xFFBBBBBB; - fTopIndex = 0; - fHighlight = 0; - fResizing = false; - - SkPaint p; - p.setTextSize(SkIntToScalar(SKDEBUGGER_TEXTSIZE)); - fSpacing = p.getFontSpacing(); - fCentered = false; - fRange = (int)(this->height()/fSpacing) - 1; -} - -DebuggerCommandsView::~DebuggerCommandsView() { - fList.deleteAll(); -} - -bool DebuggerCommandsView::onEvent(const SkEvent& evt) { - if (evt.isType(SKDEBUGGER_COMMANDTYPE)) { - *fList.append() = new SkString(evt.findString(SKDEBUGGER_ATOM)); - this->inval(NULL); - return true; - } - return this->INHERITED::onEvent(evt); -} - -void DebuggerCommandsView::onSizeChange() { - fRange = (int)(this->height()/fSpacing); - this->INHERITED::onSizeChange(); -} - -void DebuggerCommandsView::alignCenter() { - if (!fCentered || fHighlight < fRange/2 || fHighlight > (fList.count() - fRange/2)) { - return; - } else { - if (fHighlight > (fTopIndex + fRange/2)) - fTopIndex += fHighlight - (fTopIndex + fRange/2); - if (fHighlight < (fTopIndex + fRange/2)) - fTopIndex -= (fTopIndex + fRange/2) - fHighlight; - } -} - -int DebuggerCommandsView::nextItem() { - if (fHighlight < fList.count() - 1) - ++fHighlight; - if (fHighlight < fTopIndex || fHighlight > (fTopIndex + fRange)) - fTopIndex = fHighlight; - if (fHighlight == (fTopIndex + fRange)) - ++fTopIndex; - this->alignCenter(); - this->inval(NULL); - return fHighlight; -} - -int DebuggerCommandsView::prevItem() { - if (fHighlight > 0) - --fHighlight; - if (fHighlight < fTopIndex || fHighlight > (fTopIndex + fRange)) - fTopIndex = fHighlight; - this->alignCenter(); - this->inval(NULL); - return fHighlight; -} - -int DebuggerCommandsView::scrollUp() { - if (fTopIndex > 0) - --fTopIndex; - this->inval(NULL); - return fHighlight; -} - -int DebuggerCommandsView::scrollDown() { - if (fTopIndex < (fList.count() - 1)) - ++fTopIndex; - this->inval(NULL); - return fHighlight; -} - -void DebuggerCommandsView::highlight(int index) { - SkASSERT(index >= 0 && index < fList.count()); - if (fHighlight != index) { - fHighlight = index; - this->alignCenter(); - this->inval(NULL); - } -} - -int DebuggerCommandsView::selectHighlight(int ypos) { - int i = (int)(ypos/fSpacing) + fTopIndex; - if (i >= fList.count()) { - i = fList.count() - 1; - } - if (fHighlight != i) { - fHighlight = i; - this->alignCenter(); - this->inval(NULL); - } - return fHighlight; -} - -void DebuggerCommandsView::toggleCentered() { - fCentered = !fCentered; - this->alignCenter(); - this->inval(NULL); -} - -void DebuggerCommandsView::onDraw(SkCanvas* canvas) { - canvas->drawColor(fBGColor); - - SkPaint p; - p.setTextSize(SkIntToScalar(SKDEBUGGER_TEXTSIZE)); - p.setAntiAlias(true); - - //draw highlight - int selected = fHighlight - fTopIndex; - SkRect r = {0, fSpacing * selected, this->width(), fSpacing * (selected+1)}; - p.setColor(SKDEBUGGER_HIGHLIGHTCOLOR); - canvas->drawRect(r, p); - - int endIndex = fTopIndex + fRange; - if (endIndex > fList.count()) - endIndex = fList.count(); - - p.setColor(SKDEBUGGER_TEXTCOLOR); - int pos; - for (int i = fTopIndex; i < endIndex; ++i) { - pos = i - fTopIndex; - canvas->drawText(fList[i]->c_str(), fList[i]->size(), - 0, fSpacing - 2 + fSpacing * pos, p); - } - p.setColor(SKDEBUGGER_RESIZEBARCOLOR); - r = SkRect::MakeXYWH(this->width() - SKDEBUGGER_RESIZEBARSIZE, 0, - SKDEBUGGER_RESIZEBARSIZE, this->height()); - canvas->drawRect(r, p); -} - diff --git a/experimental/Debugger/DebuggerContentView.cpp b/experimental/Debugger/DebuggerContentView.cpp deleted file mode 100644 index 91ebf2b5bd..0000000000 --- a/experimental/Debugger/DebuggerContentView.cpp +++ /dev/null @@ -1,278 +0,0 @@ - -#ifdef SK_DEVELOPER - -#include "SampleCode.h" -#include "SkOSMenu.h" - -#include "DebuggerViews.h" -static const char gIsDebuggerQuery[] = "is-debugger"; -class DebuggerView : public SampleView { -public: - DebuggerView(const char* data, size_t size) { - fData.append(size, data); - fCommandsVisible = true; - fCommandsResizing = false; - fStateVisible = true; - fStateResizing = false; - - fCommands = new DebuggerCommandsView; - fCommands->setVisibleP(fCommandsVisible); - this->attachChildToFront(fCommands)->unref(); - - - fState = new DebuggerStateView; - fState->setVisibleP(fStateVisible); - this->attachChildToFront(fState)->unref(); - - fAtomsToRead = 0; - fDisplayClip = false; - - fDumper = new SkDebugDumper(this->getSinkID(), fCommands->getSinkID(), - fState->getSinkID()); - - fDumper->unload(); - fAtomBounds.reset(); - fFrameBounds.reset(); - - SkDumpCanvas* dumpCanvas = new SkDumpCanvas(fDumper); - SkGPipeReader* dumpReader = new SkGPipeReader(dumpCanvas); - - - if (size > 0) { - int offset = 0; - int frameBound = 0; - size_t bytesRead; - while (static_cast(offset) < size) { - SkGPipeReader::Status s = - dumpReader->playback(data + offset, size - offset, - SkGPipeReader::kReadAtom_PlaybackFlag, &bytesRead); - SkASSERT(SkGPipeReader::kError_Status != s); - offset += bytesRead; - - if (SkGPipeReader::kDone_Status == s) { - fDumper->dump(dumpCanvas, SkDumpCanvas::kNULL_Verb, - "End of Frame", NULL); - delete dumpReader; - delete dumpCanvas; - dumpCanvas = new SkDumpCanvas(fDumper); - dumpReader = new SkGPipeReader(dumpCanvas); - frameBound = offset; - } - fAtomBounds.append(1, &offset); - fFrameBounds.append(1, &frameBound); - } - } - - delete dumpReader; - delete dumpCanvas; - - fDumper->load(); - } - - ~DebuggerView() { - fAtomBounds.reset(); - fFrameBounds.reset(); - delete fDumper; - } - - virtual void requestMenu(SkOSMenu* menu) { - menu->setTitle("Debugger"); - menu->appendSwitch("Show Commands", "Commands", this->getSinkID(), fCommandsVisible); - menu->appendSwitch("Show State", "State", this->getSinkID(), fStateVisible); - menu->appendSwitch("Display Clip", "Clip", this->getSinkID(), fDisplayClip); - } - - - void goToAtom(int atom) { - if (atom != fAtomsToRead) { - fAtomsToRead = atom; - this->inval(NULL); - } - } - -protected: - virtual bool onQuery(SkEvent* evt) { - if (SampleCode::TitleQ(*evt)) { - SampleCode::TitleR(evt, "Debugger"); - return true; - } - if (evt->isType(gIsDebuggerQuery)) { - return true; - } - return this->INHERITED::onQuery(evt); - } - - virtual bool onEvent(const SkEvent& evt) { - if (SkOSMenu::FindSwitchState(evt, "Commands", &fCommandsVisible) || - SkOSMenu::FindSwitchState(evt, "State", &fStateVisible)) { - fCommands->setVisibleP(fCommandsVisible); - fState->setVisibleP(fStateVisible); - fStateOffset = (fCommandsVisible) ? fCommands->width() : 0; - fState->setSize(this->width() - fStateOffset, fState->height()); - fState->setLoc(fStateOffset, this->height() - fState->height()); - this->inval(NULL); - return true; - } - if (SkOSMenu::FindSwitchState(evt, "Clip", &fDisplayClip)) { - this->inval(NULL); - return true; - } - return this->INHERITED::onEvent(evt); - } - - virtual void onDrawContent(SkCanvas* canvas) { - if (fData.count() <= 0) - return; - SkAutoCanvasRestore acr(canvas, true); - canvas->translate(fStateOffset, 0); - - int lastFrameBound = fFrameBounds[fAtomsToRead]; - int toBeRead = fAtomBounds[fAtomsToRead] - lastFrameBound; - int firstChunk = (fAtomsToRead > 0) ? fAtomBounds[fAtomsToRead - 1] - lastFrameBound: 0; - if (toBeRead > 0) { - SkDumpCanvas* dumpCanvas = new SkDumpCanvas(fDumper); - SkGPipeReader* dumpReader = new SkGPipeReader(dumpCanvas); - SkGPipeReader* reader = new SkGPipeReader(canvas); - fDumper->disable(); - - int offset = 0; - size_t bytesRead; - SkGPipeReader::Status s; - //Read the first chunk - if (offset < firstChunk && firstChunk < toBeRead) { - s = dumpReader->playback(fData.begin() + offset, firstChunk - offset); - SkASSERT(SkGPipeReader::kError_Status != s); - s = reader->playback(fData.begin() + offset, firstChunk - offset, 0, &bytesRead); - SkASSERT(SkGPipeReader::kError_Status != s); - if (SkGPipeReader::kDone_Status == s){ - delete dumpReader; - delete dumpCanvas; - dumpCanvas = new SkDumpCanvas(fDumper); - dumpReader = new SkGPipeReader(dumpCanvas); - delete reader; - reader = new SkGPipeReader(canvas); - } - offset += bytesRead; - } - SkASSERT(offset == firstChunk); - //Then read the current atom - fDumper->enable(); - s = dumpReader->playback(fData.begin() + offset, toBeRead - offset, - SkGPipeReader::kReadAtom_PlaybackFlag); - SkASSERT(SkGPipeReader::kError_Status != s); - s = reader->playback(fData.begin() + offset, toBeRead - offset, - SkGPipeReader::kReadAtom_PlaybackFlag, &bytesRead); - SkASSERT(SkGPipeReader::kError_Status != s); - - delete reader; - delete dumpReader; - delete dumpCanvas; - - if (fDisplayClip) { - SkPaint p; - p.setColor(0x440000AA); - SkPath path; - canvas->getTotalClip().getBoundaryPath(&path); - canvas->drawPath(path, p); - } - } - } - - virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y) { - return new Click(this); - } - - virtual bool onClick(SkView::Click* click) { - SkPoint prev = click->fPrev; - SkPoint curr = click->fCurr; - bool handled = true; - switch (click->fState) { - case SkView::Click::kDown_State: - if (SkScalarAbs(curr.fX - fCommands->width()) <= SKDEBUGGER_RESIZEBARSIZE) { - fCommandsResizing = true; - } - else if (SkScalarAbs(curr.fY - (this->height() - fState->height())) <= SKDEBUGGER_RESIZEBARSIZE && - curr.fX > fCommands->width()) { - fStateResizing = true; - } - else if (curr.fX < fCommands->width()) { - fAtomsToRead = fCommands->selectHighlight( - SkScalarFloorToInt(curr.fY)); - } - else - handled = false; - break; - case SkView::Click::kMoved_State: - if (fCommandsResizing) - fCommands->setSize(curr.fX, this->height()); - else if (fStateResizing) - fState->setSize(this->width(), this->height() - curr.fY); - else if (curr.fX < fCommands->width()) { - if (curr.fY - prev.fY < 0) { - fCommands->scrollDown(); - } - if (curr.fY - prev.fY > 0) { - fCommands->scrollUp(); - } - } - else - handled = false; - break; - case SkView::Click::kUp_State: - fStateResizing = fCommandsResizing = false; - break; - default: - break; - } - - fStateOffset = fCommands->width(); - fState->setSize(this->width() - fStateOffset, fState->height()); - fState->setLoc(fStateOffset, this->height() - fState->height()); - if (handled) - this->inval(NULL); - return handled; - } - - virtual void onSizeChange() { - this->INHERITED::onSizeChange(); - fCommands->setSize(CMD_WIDTH, this->height()); - fCommands->setLoc(0, 0); - fState->setSize(this->width() - CMD_WIDTH, SkFloatToScalar(INFO_HEIGHT)); - fState->setLoc(CMD_WIDTH, this->height() - SkFloatToScalar(INFO_HEIGHT)); - } - -private: - DebuggerCommandsView* fCommands; - DebuggerStateView* fState; - bool fCommandsResizing; - bool fCommandsVisible; - bool fStateResizing; - bool fStateVisible; - float fStateOffset; - bool fDisplayClip; - int fAtomsToRead; - SkTDArray fAtomBounds; - SkTDArray fFrameBounds; - SkTDArray fData; - SkDebugDumper* fDumper; - - typedef SampleView INHERITED; -}; - - -/////////////////////////////////////////////////////////////////////////////// - -SkView* create_debugger(const char* data, size_t size); - -SkView* create_debugger(const char* data, size_t size) { - return SkNEW_ARGS(DebuggerView, (data, size)); -}; - -bool is_debugger(SkView* view); - -bool is_debugger(SkView* view) { - SkEvent isDebugger(gIsDebuggerQuery); - return view->doQuery(&isDebugger); -} - -#endif diff --git a/experimental/Debugger/DebuggerStateView.cpp b/experimental/Debugger/DebuggerStateView.cpp deleted file mode 100644 index 27befcbaa0..0000000000 --- a/experimental/Debugger/DebuggerStateView.cpp +++ /dev/null @@ -1,52 +0,0 @@ - -/* - * Copyright 2011 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ -#include "DebuggerViews.h" -#include "SkRect.h" - -DebuggerStateView::DebuggerStateView() { - fBGColor = 0xFF999999; - fPaint.setColor(fBGColor); - fResizing = false; -} - -bool DebuggerStateView::onEvent(const SkEvent& evt) { - if (evt.isType(SKDEBUGGER_STATETYPE)) { - fMatrix = evt.findString(SKDEBUGGER_MATRIX); - fClip = evt.findString(SKDEBUGGER_CLIP); - - SkPaint* ptr; - if (evt.getMetaData().findPtr(SKDEBUGGER_PAINT, (void**)&ptr)) { - fPaint = *ptr; - fPaintInfo = evt.findString(SKDEBUGGER_PAINTINFO); - } - this->inval(NULL); - return true; - } - return this->INHERITED::onEvent(evt); -} - -void DebuggerStateView::onDraw(SkCanvas* canvas) { - canvas->drawColor(fBGColor); - - //Display Current Paint - SkRect r = {10, 20, 40, 50}; - canvas->drawRect(r, fPaint); - //Display Information - SkPaint p; - p.setTextSize(SKDEBUGGER_TEXTSIZE); - p.setAntiAlias(true); - SkScalar x = 50 * SK_Scalar1; - canvas->drawText(fPaintInfo.c_str(), fPaintInfo.size(), x, 30, p); - canvas->drawText(fMatrix.c_str(), fMatrix.size(), x, 60, p); - canvas->drawText(fClip.c_str(), fClip.size(), x, 90, p); - - p.setColor(SKDEBUGGER_RESIZEBARCOLOR); - r = SkRect::MakeXYWH(0, 0, this->width(), SKDEBUGGER_RESIZEBARSIZE); - canvas->drawRect(r, p); -} - diff --git a/experimental/Debugger/DebuggerViews.h b/experimental/Debugger/DebuggerViews.h deleted file mode 100644 index 926881e3bb..0000000000 --- a/experimental/Debugger/DebuggerViews.h +++ /dev/null @@ -1,100 +0,0 @@ - -/* - * Copyright 2011 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ -#include "SkView.h" -#include "SkColor.h" -#include "SkBitmap.h" -#include "SkCanvas.h" -#include "SkGPipe.h" -#include "SkPaint.h" - -#include "SkDebugDumper.h" - -#define SKDEBUGGER_COMMANDTYPE "SKDEBUGGER_COMMAND" -#define SKDEBUGGER_STATETYPE "SKDEBUGGER_STATE" - -#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" - -#define SKDEBUGGER_TEXTSIZE 14 -#define CMD_WIDTH 200 -#define INFO_HEIGHT 150.0f -#define SKDEBUGGER_HIGHLIGHTCOLOR 0xFF113399 -#define SKDEBUGGER_TEXTCOLOR 0xFF000000 -#define SKDEBUGGER_RESIZEBARCOLOR 0xFF333333 -#define SKDEBUGGER_RESIZEBARSIZE 5 - -/* - * Debugger - Info Panel - */ -class DebuggerStateView : public SkView { -public: - DebuggerStateView(); - -protected: - virtual bool onEvent(const SkEvent& evt); - virtual void onDraw(SkCanvas* canvas); -private: - SkColor fBGColor; - SkPaint fPaint; - SkString fMatrix; - SkString fPaintInfo; - SkString fClip; - bool fResizing; - typedef SkView INHERITED; -}; - -/* - * Debugger - Commands List - */ -class DebuggerCommandsView : public SkView { -public: - DebuggerCommandsView(); - ~DebuggerCommandsView(); - 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: - void init(); - void alignCenter(); - SkColor fBGColor; - int fTopIndex; - int fHighlight; - SkScalar fSpacing; - int fRange; - bool fResizing; - bool fCentered; - SkTDArray fList; - typedef SkView INHERITED; -}; - - -static inline void* PaintProc(void* ptr, bool doRef) { - SkPaint* p = (SkPaint*) ptr; - - if (doRef) { - return new SkPaint(*p); - } - else { - delete p; - return NULL; - } - -} - diff --git a/experimental/Debugger/SkDebugDumper.cpp b/experimental/Debugger/SkDebugDumper.cpp deleted file mode 100644 index 9f8afedae7..0000000000 --- a/experimental/Debugger/SkDebugDumper.cpp +++ /dev/null @@ -1,153 +0,0 @@ - -/* - * Copyright 2011 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ -#include "SkDebugDumper.h" - -#ifdef SK_DEVELOPER - -#include "SkString.h" -#include "SkPaint.h" -#include "SkShader.h" -#include "SkPathEffect.h" -#include "SkXfermode.h" -#include "SkColorFilter.h" -#include "SkPathEffect.h" -#include "SkMaskFilter.h" -#include "DebuggerViews.h" - -SkDebugDumper::SkDebugDumper(SkEventSinkID cID, SkEventSinkID clID, - SkEventSinkID ipID) { - fContentID = cID; - fCommandsID = clID; - fStateID = ipID; - fInit = false; - fDisabled = false; - fCount = 0; -} - -static void appendPtr(SkString* str, const void* ptr, const char name[]) { - if (ptr) { - str->appendf("%s: %p\t", name, ptr); - } -} - -static void appendFlattenable(SkString* str, const SkFlattenable* ptr, - const char name[]) { - if (ptr) { - str->appendf("%s: %p\n", name, ptr); - } -} - -static SkString dumpMatrix(SkDumpCanvas* canvas) { - SkString str; - SkMatrix m = canvas->getTotalMatrix(); - str.append("Matrix:"); - str.appendf("Translate (%0.4g, %0.4g) ", - SkScalarToFloat(m.get(SkMatrix::kMTransX)), - SkScalarToFloat(m.get(SkMatrix::kMTransY))); - str.appendf("Scale (%0.4g, %0.4g) ", - SkScalarToFloat(m.get(SkMatrix::kMScaleX)), - SkScalarToFloat(m.get(SkMatrix::kMScaleY))); - str.appendf("Skew (%0.4g, %0.4g) ", - SkScalarToFloat(m.get(SkMatrix::kMSkewX)), - SkScalarToFloat(m.get(SkMatrix::kMSkewY))); - str.appendf("Perspective (%0.4g, %0.4g, %0.4g) ", - SkScalarToFloat(SkPerspToScalar(m.get(SkMatrix::kMPersp0))), - SkScalarToFloat(SkPerspToScalar(m.get(SkMatrix::kMPersp1))), - SkScalarToFloat(SkPerspToScalar(m.get(SkMatrix::kMPersp2)))); - return str; -} - - -static const int maxPts = 50; -static SkString dumpClip(SkDumpCanvas* canvas) { - SkString str; - SkPath p; - if (canvas->getTotalClip().getBoundaryPath(&p)) { - SkPoint pts[maxPts]; - int numPts = p.getPoints(pts, maxPts); - - str.append("Clip: [ "); - for (int i = 0; i < numPts; ++i) { - str.appendf("(%0.4g, %0.4g)", pts[i].x(), pts[i].y()); - if (i < numPts-1) - str.append(" , "); - } - str.append(" ]"); - } - return str; -} - -static const char* gPaintFlags[] = { - "AntiAliasing", - "Bitmap Filtering", - "Dithering", - "Underline Text", - "Strike-Through Text", - "Fake Bold Text", - "Linear Text", - "Subpixel Positioned Text", - "Device Kerning Text", - "LCD/Subpixel Glyph Rendering", - "Embedded Bitmap Text", - "Freetype Autohinting", - "ALL" -}; - - -static SkString dumpPaint(SkDumpCanvas* canvas, const SkPaint* p, - SkDumpCanvas::Verb verb) { - SkString str; - str.appendf("Color: #%08X\n", p->getColor()); - str.appendf("Flags: %s\n", gPaintFlags[p->getFlags()]); - appendFlattenable(&str, p->getShader(), "shader"); - appendFlattenable(&str, p->getXfermode(), "xfermode"); - appendFlattenable(&str, p->getPathEffect(), "pathEffect"); - appendFlattenable(&str, p->getMaskFilter(), "maskFilter"); - appendFlattenable(&str, p->getPathEffect(), "pathEffect"); - appendFlattenable(&str, p->getColorFilter(), "filter"); - - if (SkDumpCanvas::kDrawText_Verb == verb) { - str.appendf("Text Size:%0.4g\n", SkScalarToFloat(p->getTextSize())); - appendPtr(&str, p->getTypeface(), "typeface"); - } - - return str; -} - -void SkDebugDumper::dump(SkDumpCanvas* canvas, SkDumpCanvas::Verb verb, - const char str[], const SkPaint* p) { - if (!fDisabled) { - SkString msg, tab; - - const int level = canvas->getNestLevel() + canvas->getSaveCount() - 1; - SkASSERT(level >= 0); - for (int i = 0; i < level; i++) { - tab.append("| "); - } - - msg.appendf("%03d: %s%s\n", fCount, tab.c_str(), str); - ++fCount; - if (!fInit) { - SkEvent* cmd = new SkEvent(SKDEBUGGER_COMMANDTYPE, fCommandsID); - cmd->setString(SKDEBUGGER_ATOM, msg); - cmd->postDelay(100); - } - else { - SkEvent* state = new SkEvent(SKDEBUGGER_STATETYPE, fStateID); - state->setString(SKDEBUGGER_MATRIX, dumpMatrix(canvas)); - state->setString(SKDEBUGGER_CLIP, dumpClip(canvas)); - if (p) { - state->setString(SKDEBUGGER_PAINTINFO, dumpPaint(canvas, p, verb)); - state->getMetaData().setPtr(SKDEBUGGER_PAINT, (void*)p, PaintProc); - } - state->post(); - } - } -} - -#endif diff --git a/experimental/Debugger/SkDebugDumper.h b/experimental/Debugger/SkDebugDumper.h deleted file mode 100644 index 16190c694d..0000000000 --- a/experimental/Debugger/SkDebugDumper.h +++ /dev/null @@ -1,44 +0,0 @@ - -/* - * Copyright 2011 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ -#ifndef SkDebugDumper_DEFINED -#define SkDebugDumper_DEFINED - -#ifdef SK_DEVELOPER - -#include "SkDumpCanvas.h" -#include "SkEvent.h" - -/** Formats the draw commands, and send them to a function-pointer provided - by the caller. - */ -class SkDebugDumper : public SkDumpCanvas::Dumper { -public: - SkDebugDumper(SkEventSinkID cID, SkEventSinkID clID, SkEventSinkID ipID); - // override from baseclass that does the formatting, and in turn calls - // the function pointer that was passed to the constructor - virtual void dump(SkDumpCanvas*, SkDumpCanvas::Verb, const char str[], - const SkPaint*); - - void load() { fInit = true; }; - void unload() { fInit = false; fCount = 0;}; - void disable() { fDisabled = true; }; - void enable() { fDisabled = false; }; -private: - int fCount; - bool fInit; - bool fDisabled; - SkEventSinkID fContentID; - SkEventSinkID fCommandsID; - SkEventSinkID fStateID; - - typedef SkDumpCanvas::Dumper INHERITED; -}; - -#endif - -#endif diff --git a/gyp/SampleApp.gyp b/gyp/SampleApp.gyp index 02405f88ba..7ed08b287a 100644 --- a/gyp/SampleApp.gyp +++ b/gyp/SampleApp.gyp @@ -118,14 +118,6 @@ #'../experimental/Networking/SkSockets.cpp', #'../experimental/Networking/SkSockets.h', - # Debugger - '../experimental/Debugger/DebuggerViews.h', - '../experimental/Debugger/DebuggerContentView.cpp', - '../experimental/Debugger/DebuggerCommandsView.cpp', - '../experimental/Debugger/DebuggerStateView.cpp', - '../experimental/Debugger/SkDebugDumper.cpp', - '../experimental/Debugger/SkDebugDumper.h', - # TiledPipeController '../src/pipe/utils/SamplePipeControllers.h', '../src/pipe/utils/SamplePipeControllers.cpp', diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp index b2789bce22..b59df61e86 100644 --- a/samplecode/SampleApp.cpp +++ b/samplecode/SampleApp.cpp @@ -64,14 +64,6 @@ public: SkTCPServer gServer; #endif -#define DEBUGGERx -#ifdef DEBUGGER -extern SkView* create_debugger(const char* data, size_t size); -extern bool is_debugger(SkView* view); -SkTDArray gTempDataStore; -#endif - - #define USE_ARROWS_FOR_ZOOM true #if SK_ANGLE @@ -811,7 +803,6 @@ SampleWindow::SampleWindow(void* hwnd, int argc, char** argv, DeviceManager* dev fZoomScale = SK_Scalar1; fMagnify = false; - fDebugger = false; fSaveToPdf = false; fPdfCanvas = NULL; @@ -847,10 +838,6 @@ SampleWindow::SampleWindow(void* hwnd, int argc, char** argv, DeviceManager* dev itemID = fAppMenu->appendTriState("Tiling", "Tiling", sinkID, fTilingState); fAppMenu->assignKeyEquivalentToItem(itemID, 't'); -#ifdef DEBUGGER - itemID = fAppMenu->appendSwitch("Debugger", "Debugger", sinkID, fDebugger); - fAppMenu->assignKeyEquivalentToItem(itemID, 'q'); -#endif itemID = fAppMenu->appendSwitch("Slide Show", "Slide Show" , sinkID, false); fAppMenu->assignKeyEquivalentToItem(itemID, 'a'); itemID = fAppMenu->appendSwitch("Clip", "Clip" , sinkID, fUseClip); @@ -1421,25 +1408,6 @@ void SampleWindow::afterChildren(SkCanvas* orig) { bm.scrollRect(&r, dx, dy, &inval); paint_rgn(bm, r, inval); } -#ifdef DEBUGGER - SkView* curr = curr_view(this); - if (fDebugger && !is_debugger(curr) && !is_transition(curr) && !is_overview(curr)) { - //Stop Pipe when fDebugger is active - if (fPipeState != SkOSMenu::kOffState) { - fPipeState = SkOSMenu::kOffState; - (void)SampleView::SetUsePipe(curr, fPipeState); - fAppMenu->getItemByID(fUsePipeMenuItemID)->setTriState(fPipeState); - this->onUpdateMenu(fAppMenu); - } - - //Reset any transformations - fGesture.stop(); - fGesture.reset(); - - this->loadView(create_debugger(gTempDataStore.begin(), - gTempDataStore.count())); - } -#endif } void SampleWindow::beforeChild(SkView* child, SkCanvas* canvas) { @@ -1686,18 +1654,6 @@ bool SampleWindow::onEvent(const SkEvent& evt) { this->saveToPdf(); return true; } -#ifdef DEBUGGER - if (SkOSMenu::FindSwitchState(evt, "Debugger", &fDebugger)) { - if (fDebugger) { - fPipeState = SkOSMenu::kOnState; - (void)SampleView::SetUsePipe(curr_view(this), fPipeState); - } else { - this->loadView((*fSamples[fCurrIndex])()); - } - this->inval(NULL); - return true; - } -#endif return this->INHERITED::onEvent(evt); } @@ -2041,12 +1997,7 @@ void SampleWindow::loadView(SkView* view) { //repopulate the slide menu when a view is loaded fSlideMenu->reset(); -#ifdef DEBUGGER - if (!is_debugger(view) && !is_overview(view) && !is_transition(view) && fDebugger) { - //Force Pipe to be on if using debugger - fPipeState = SkOSMenu::kOnState; - } -#endif + (void)SampleView::SetUsePipe(view, fPipeState); if (SampleView::IsSampleView(view)) ((SampleView*)view)->requestMenu(fSlideMenu); @@ -2315,10 +2266,6 @@ SimplePC::~SimplePC() { gServer.acceptConnections(); gServer.writePacket(fBlock, fTotalWritten); } -#endif -#ifdef DEBUGGER - gTempDataStore.reset(); - gTempDataStore.append(fTotalWritten, (const char*)fBlock); #endif } sk_free(fBlock); diff --git a/samplecode/SampleApp.h b/samplecode/SampleApp.h index ecf552ce8b..e062e218fb 100644 --- a/samplecode/SampleApp.h +++ b/samplecode/SampleApp.h @@ -179,7 +179,6 @@ private: // On uses a normal pipe // Off uses no pipe int fUsePipeMenuItemID; - bool fDebugger; // The following are for the 'fatbits' drawing // Latest position of the mouse.