From 1931ec5b5dac68f1e452af0c65161bdce35b2dec Mon Sep 17 00:00:00 2001 From: fmalita Date: Fri, 7 Nov 2014 12:09:20 -0800 Subject: [PATCH] SkDrawCommand scrubbing Remove unused ctor, constify, etc. R=robertphillips@google.com Review URL: https://codereview.chromium.org/706363002 --- debugger/QT/SkDebuggerGUI.cpp | 3 +- debugger/SkDebugger.h | 2 +- src/utils/debugger/SkDebugCanvas.cpp | 2 +- src/utils/debugger/SkDebugCanvas.h | 2 +- src/utils/debugger/SkDrawCommand.cpp | 83 ++++++++++------------ src/utils/debugger/SkDrawCommand.h | 102 +++++++++++++-------------- 6 files changed, 93 insertions(+), 101 deletions(-) diff --git a/debugger/QT/SkDebuggerGUI.cpp b/debugger/QT/SkDebuggerGUI.cpp index 59bfcca5fe..4901d62389 100644 --- a/debugger/QT/SkDebuggerGUI.cpp +++ b/debugger/QT/SkDebuggerGUI.cpp @@ -689,8 +689,7 @@ void SkDebuggerGUI::registerListClick(QListWidgetItem *item) { fCanvasWidget.drawTo(currentRow); fImageWidget.draw(); } - SkTDArray *currInfo = fDebugger.getCommandInfo( - currentRow); + const SkTDArray *currInfo = fDebugger.getCommandInfo(currentRow); /* TODO(chudy): Add command type before parameters. Rename v * to something more informative. */ diff --git a/debugger/SkDebugger.h b/debugger/SkDebugger.h index 53b480a28d..5359b10fe9 100644 --- a/debugger/SkDebugger.h +++ b/debugger/SkDebugger.h @@ -79,7 +79,7 @@ public: return fDebugCanvas->getCommandAtPoint(x, y, index); } - SkTDArray* getCommandInfo(int index) { + const SkTDArray* getCommandInfo(int index) const { return fDebugCanvas->getCommandInfo(index); } diff --git a/src/utils/debugger/SkDebugCanvas.cpp b/src/utils/debugger/SkDebugCanvas.cpp index 3b68365fc1..b07b383781 100644 --- a/src/utils/debugger/SkDebugCanvas.cpp +++ b/src/utils/debugger/SkDebugCanvas.cpp @@ -379,7 +379,7 @@ void SkDebugCanvas::setDrawCommandAt(int index, SkDrawCommand* command) { fCommandVector[index] = command; } -SkTDArray* SkDebugCanvas::getCommandInfo(int index) { +const SkTDArray* SkDebugCanvas::getCommandInfo(int index) const { SkASSERT(index < fCommandVector.count()); return fCommandVector[index]->Info(); } diff --git a/src/utils/debugger/SkDebugCanvas.h b/src/utils/debugger/SkDebugCanvas.h index 0beb64237f..bdd04aa2db 100644 --- a/src/utils/debugger/SkDebugCanvas.h +++ b/src/utils/debugger/SkDebugCanvas.h @@ -102,7 +102,7 @@ public: Returns information about the command at the given index. @param index The index of the command */ - SkTDArray* getCommandInfo(int index); + const SkTDArray* getCommandInfo(int index) const; /** Returns the visibility of the command at the given index. diff --git a/src/utils/debugger/SkDrawCommand.cpp b/src/utils/debugger/SkDrawCommand.cpp index 93c436df64..142c4a44b1 100644 --- a/src/utils/debugger/SkDrawCommand.cpp +++ b/src/utils/debugger/SkDrawCommand.cpp @@ -20,11 +20,6 @@ SkDrawCommand::SkDrawCommand(DrawType type) , fVisible(true) { } -SkDrawCommand::SkDrawCommand() { - fOffset = 0; - fVisible = true; -} - SkDrawCommand::~SkDrawCommand() { fInfo.deleteAll(); } @@ -81,7 +76,7 @@ const char* SkDrawCommand::GetCommandString(DrawType type) { return NULL; } -SkString SkDrawCommand::toString() { +SkString SkDrawCommand::toString() const { return SkString(GetCommandString(fDrawType)); } @@ -90,7 +85,7 @@ SkClearCommand::SkClearCommand(SkColor color) : INHERITED(DRAW_CLEAR) { fInfo.push(SkObjectParser::CustomTextToString("No Parameters")); } -void SkClearCommand::execute(SkCanvas* canvas) { +void SkClearCommand::execute(SkCanvas* canvas) const { canvas->clear(fColor); } @@ -207,7 +202,7 @@ SkClipPathCommand::SkClipPathCommand(const SkPath& path, SkRegion::Op op, bool d fInfo.push(SkObjectParser::BoolToString(doAA)); } -void SkClipPathCommand::execute(SkCanvas* canvas) { +void SkClipPathCommand::execute(SkCanvas* canvas) const { canvas->clipPath(fPath, fOp, fDoAA); } @@ -225,7 +220,7 @@ SkClipRegionCommand::SkClipRegionCommand(const SkRegion& region, SkRegion::Op op fInfo.push(SkObjectParser::RegionOpToString(op)); } -void SkClipRegionCommand::execute(SkCanvas* canvas) { +void SkClipRegionCommand::execute(SkCanvas* canvas) const { canvas->clipRegion(fRegion, fOp); } @@ -240,7 +235,7 @@ SkClipRectCommand::SkClipRectCommand(const SkRect& rect, SkRegion::Op op, bool d fInfo.push(SkObjectParser::BoolToString(doAA)); } -void SkClipRectCommand::execute(SkCanvas* canvas) { +void SkClipRectCommand::execute(SkCanvas* canvas) const { canvas->clipRect(fRect, fOp, fDoAA); } @@ -255,7 +250,7 @@ SkClipRRectCommand::SkClipRRectCommand(const SkRRect& rrect, SkRegion::Op op, bo fInfo.push(SkObjectParser::BoolToString(doAA)); } -void SkClipRRectCommand::execute(SkCanvas* canvas) { +void SkClipRRectCommand::execute(SkCanvas* canvas) const { canvas->clipRRect(fRRect, fOp, fDoAA); } @@ -271,7 +266,7 @@ SkConcatCommand::SkConcatCommand(const SkMatrix& matrix) fInfo.push(SkObjectParser::MatrixToString(matrix)); } -void SkConcatCommand::execute(SkCanvas* canvas) { +void SkConcatCommand::execute(SkCanvas* canvas) const { canvas->concat(fMatrix); } @@ -296,7 +291,7 @@ SkDrawBitmapCommand::SkDrawBitmapCommand(const SkBitmap& bitmap, SkScalar left, } } -void SkDrawBitmapCommand::execute(SkCanvas* canvas) { +void SkDrawBitmapCommand::execute(SkCanvas* canvas) const { canvas->drawBitmap(fBitmap, fLeft, fTop, fPaintPtr); } @@ -325,7 +320,7 @@ SkDrawBitmapMatrixCommand::SkDrawBitmapMatrixCommand(const SkBitmap& bitmap, } } -void SkDrawBitmapMatrixCommand::execute(SkCanvas* canvas) { +void SkDrawBitmapMatrixCommand::execute(SkCanvas* canvas) const { canvas->drawBitmapMatrix(fBitmap, fMatrix, fPaintPtr); } @@ -355,7 +350,7 @@ SkDrawBitmapNineCommand::SkDrawBitmapNineCommand(const SkBitmap& bitmap, const S } } -void SkDrawBitmapNineCommand::execute(SkCanvas* canvas) { +void SkDrawBitmapNineCommand::execute(SkCanvas* canvas) const { canvas->drawBitmapNine(fBitmap, fCenter, fDst, fPaintPtr); } @@ -395,7 +390,7 @@ SkDrawBitmapRectCommand::SkDrawBitmapRectCommand(const SkBitmap& bitmap, const S fInfo.push(SkObjectParser::IntToString(fFlags, "Flags: ")); } -void SkDrawBitmapRectCommand::execute(SkCanvas* canvas) { +void SkDrawBitmapRectCommand::execute(SkCanvas* canvas) const { canvas->drawBitmapRectToRect(fBitmap, this->srcRect(), fDst, fPaintPtr, fFlags); } @@ -416,7 +411,7 @@ SkDrawDataCommand::SkDrawDataCommand(const void* data, size_t length) fInfo.push(str); } -void SkDrawDataCommand::execute(SkCanvas* canvas) { +void SkDrawDataCommand::execute(SkCanvas* canvas) const { canvas->drawData(fData, fLength); } @@ -450,7 +445,7 @@ SkDrawOvalCommand::SkDrawOvalCommand(const SkRect& oval, const SkPaint& paint) fInfo.push(SkObjectParser::PaintToString(paint)); } -void SkDrawOvalCommand::execute(SkCanvas* canvas) { +void SkDrawOvalCommand::execute(SkCanvas* canvas) const { canvas->drawOval(fOval, fPaint); } @@ -477,7 +472,7 @@ SkDrawPaintCommand::SkDrawPaintCommand(const SkPaint& paint) fInfo.push(SkObjectParser::PaintToString(paint)); } -void SkDrawPaintCommand::execute(SkCanvas* canvas) { +void SkDrawPaintCommand::execute(SkCanvas* canvas) const { canvas->drawPaint(fPaint); } @@ -496,7 +491,7 @@ SkDrawPathCommand::SkDrawPathCommand(const SkPath& path, const SkPaint& paint) fInfo.push(SkObjectParser::PaintToString(paint)); } -void SkDrawPathCommand::execute(SkCanvas* canvas) { +void SkDrawPathCommand::execute(SkCanvas* canvas) const { canvas->drawPath(fPath, fPaint); } @@ -535,7 +530,7 @@ SkDrawPictureCommand::SkDrawPictureCommand(const SkPicture* picture, } } -void SkDrawPictureCommand::execute(SkCanvas* canvas) { +void SkDrawPictureCommand::execute(SkCanvas* canvas) const { canvas->drawPicture(fPicture, fMatrixPtr, fPaintPtr); } @@ -568,7 +563,7 @@ SkDrawPointsCommand::SkDrawPointsCommand(SkCanvas::PointMode mode, size_t count, fInfo.push(SkObjectParser::PaintToString(paint)); } -void SkDrawPointsCommand::execute(SkCanvas* canvas) { +void SkDrawPointsCommand::execute(SkCanvas* canvas) const { canvas->drawPoints(fMode, fCount, fPts, fPaint); } @@ -615,7 +610,7 @@ SkDrawPosTextCommand::SkDrawPosTextCommand(const void* text, size_t byteLength, fInfo.push(SkObjectParser::PaintToString(paint)); } -void SkDrawPosTextCommand::execute(SkCanvas* canvas) { +void SkDrawPosTextCommand::execute(SkCanvas* canvas) const { canvas->drawPosText(fText, fByteLength, fPos, fPaint); } @@ -642,7 +637,7 @@ SkDrawPosTextHCommand::SkDrawPosTextHCommand(const void* text, size_t byteLength fInfo.push(SkObjectParser::PaintToString(paint)); } -void SkDrawPosTextHCommand::execute(SkCanvas* canvas) { +void SkDrawPosTextHCommand::execute(SkCanvas* canvas) const { canvas->drawPosTextH(fText, fByteLength, fXpos, fConstY, fPaint); } @@ -662,7 +657,7 @@ SkDrawTextBlobCommand::SkDrawTextBlobCommand(const SkTextBlob* blob, SkScalar x, fInfo.push(SkObjectParser::PaintToString(paint)); } -void SkDrawTextBlobCommand::execute(SkCanvas* canvas) { +void SkDrawTextBlobCommand::execute(SkCanvas* canvas) const { canvas->drawTextBlob(fBlob, fXPos, fYPos, fPaint); } @@ -689,7 +684,7 @@ SkDrawRectCommand::SkDrawRectCommand(const SkRect& rect, const SkPaint& paint) fInfo.push(SkObjectParser::PaintToString(paint)); } -void SkDrawRectCommand::execute(SkCanvas* canvas) { +void SkDrawRectCommand::execute(SkCanvas* canvas) const { canvas->drawRect(fRect, fPaint); } @@ -702,7 +697,7 @@ SkDrawRRectCommand::SkDrawRRectCommand(const SkRRect& rrect, const SkPaint& pain fInfo.push(SkObjectParser::PaintToString(paint)); } -void SkDrawRRectCommand::execute(SkCanvas* canvas) { +void SkDrawRRectCommand::execute(SkCanvas* canvas) const { canvas->drawRRect(fRRect, fPaint); } @@ -724,7 +719,7 @@ SkDrawDRRectCommand::SkDrawDRRectCommand(const SkRRect& outer, fInfo.push(SkObjectParser::PaintToString(paint)); } -void SkDrawDRRectCommand::execute(SkCanvas* canvas) { +void SkDrawDRRectCommand::execute(SkCanvas* canvas) const { canvas->drawDRRect(fOuter, fInner, fPaint); } @@ -754,7 +749,7 @@ SkDrawSpriteCommand::SkDrawSpriteCommand(const SkBitmap& bitmap, int left, int t } } -void SkDrawSpriteCommand::execute(SkCanvas* canvas) { +void SkDrawSpriteCommand::execute(SkCanvas* canvas) const { canvas->drawSprite(fBitmap, fLeft, fTop, fPaintPtr); } @@ -779,7 +774,7 @@ SkDrawTextCommand::SkDrawTextCommand(const void* text, size_t byteLength, SkScal fInfo.push(SkObjectParser::PaintToString(paint)); } -void SkDrawTextCommand::execute(SkCanvas* canvas) { +void SkDrawTextCommand::execute(SkCanvas* canvas) const { canvas->drawText(fText, fByteLength, fX, fY, fPaint); } @@ -806,7 +801,7 @@ SkDrawTextOnPathCommand::SkDrawTextOnPathCommand(const void* text, size_t byteLe fInfo.push(SkObjectParser::PaintToString(paint)); } -void SkDrawTextOnPathCommand::execute(SkCanvas* canvas) { +void SkDrawTextOnPathCommand::execute(SkCanvas* canvas) const { canvas->drawTextOnPath(fText, fByteLength, fPath, fMatrix.isIdentity() ? NULL : &fMatrix, fPaint); @@ -867,7 +862,7 @@ SkDrawVerticesCommand::~SkDrawVerticesCommand() { delete [] fIndices; } -void SkDrawVerticesCommand::execute(SkCanvas* canvas) { +void SkDrawVerticesCommand::execute(SkCanvas* canvas) const { canvas->drawVertices(fVmode, fVertexCount, fVertices, fTexs, fColors, fXfermode, fIndices, fIndexCount, fPaint); @@ -878,7 +873,7 @@ SkRestoreCommand::SkRestoreCommand() fInfo.push(SkObjectParser::CustomTextToString("No Parameters")); } -void SkRestoreCommand::execute(SkCanvas* canvas) { +void SkRestoreCommand::execute(SkCanvas* canvas) const { canvas->restore(); } @@ -893,7 +888,7 @@ SkRotateCommand::SkRotateCommand(SkScalar degrees) fInfo.push(SkObjectParser::ScalarToString(degrees, "SkScalar degrees: ")); } -void SkRotateCommand::execute(SkCanvas* canvas) { +void SkRotateCommand::execute(SkCanvas* canvas) const { canvas->rotate(fDegrees); } @@ -901,7 +896,7 @@ SkSaveCommand::SkSaveCommand() : INHERITED(SAVE) { } -void SkSaveCommand::execute(SkCanvas* canvas) { +void SkSaveCommand::execute(SkCanvas* canvas) const { canvas->save(); } @@ -935,13 +930,13 @@ SkSaveLayerCommand::SkSaveLayerCommand(const SkRect* bounds, const SkPaint* pain fInfo.push(SkObjectParser::SaveFlagsToString(flags)); } -void SkSaveLayerCommand::execute(SkCanvas* canvas) { +void SkSaveLayerCommand::execute(SkCanvas* canvas) const { canvas->saveLayer(fBounds.isEmpty() ? NULL : &fBounds, fPaintPtr, fFlags); } -void SkSaveLayerCommand::vizExecute(SkCanvas* canvas) { +void SkSaveLayerCommand::vizExecute(SkCanvas* canvas) const { canvas->save(); } @@ -958,7 +953,7 @@ SkScaleCommand::SkScaleCommand(SkScalar sx, SkScalar sy) fInfo.push(SkObjectParser::ScalarToString(sy, "SkScalar sy: ")); } -void SkScaleCommand::execute(SkCanvas* canvas) { +void SkScaleCommand::execute(SkCanvas* canvas) const { canvas->scale(fSx, fSy); } @@ -974,7 +969,7 @@ void SkSetMatrixCommand::setUserMatrix(const SkMatrix& userMatrix) { fUserMatrix = userMatrix; } -void SkSetMatrixCommand::execute(SkCanvas* canvas) { +void SkSetMatrixCommand::execute(SkCanvas* canvas) const { SkMatrix temp = SkMatrix::Concat(fUserMatrix, fMatrix); canvas->setMatrix(temp); } @@ -988,7 +983,7 @@ SkSkewCommand::SkSkewCommand(SkScalar sx, SkScalar sy) fInfo.push(SkObjectParser::ScalarToString(sy, "SkScalar sy: ")); } -void SkSkewCommand::execute(SkCanvas* canvas) { +void SkSkewCommand::execute(SkCanvas* canvas) const { canvas->skew(fSx, fSy); } @@ -1001,7 +996,7 @@ SkTranslateCommand::SkTranslateCommand(SkScalar dx, SkScalar dy) fInfo.push(SkObjectParser::ScalarToString(dy, "SkScalar dy: ")); } -void SkTranslateCommand::execute(SkCanvas* canvas) { +void SkTranslateCommand::execute(SkCanvas* canvas) const { canvas->translate(fDx, fDy); } @@ -1011,11 +1006,11 @@ SkPushCullCommand::SkPushCullCommand(const SkRect& cullRect) fInfo.push(SkObjectParser::RectToString(cullRect)); } -void SkPushCullCommand::execute(SkCanvas* canvas) { +void SkPushCullCommand::execute(SkCanvas* canvas) const { canvas->pushCull(fCullRect); } -void SkPushCullCommand::vizExecute(SkCanvas* canvas) { +void SkPushCullCommand::vizExecute(SkCanvas* canvas) const { canvas->pushCull(fCullRect); SkPaint p; @@ -1026,6 +1021,6 @@ void SkPushCullCommand::vizExecute(SkCanvas* canvas) { SkPopCullCommand::SkPopCullCommand() : INHERITED(POP_CULL) { } -void SkPopCullCommand::execute(SkCanvas* canvas) { +void SkPopCullCommand::execute(SkCanvas* canvas) const { canvas->popCull(); } diff --git a/src/utils/debugger/SkDrawCommand.h b/src/utils/debugger/SkDrawCommand.h index 1d3d373ac8..cae0e145f2 100644 --- a/src/utils/debugger/SkDrawCommand.h +++ b/src/utils/debugger/SkDrawCommand.h @@ -15,18 +15,16 @@ class SK_API SkDrawCommand { public: - /* TODO(chudy): Remove subclasses. */ SkDrawCommand(DrawType drawType); - SkDrawCommand(); virtual ~SkDrawCommand(); - virtual SkString toString(); + virtual SkString toString() const; void setOffset(size_t offset) { fOffset = offset; } - virtual size_t offset() { return fOffset; } + size_t offset() const { return fOffset; } - virtual const char* toCString() { + virtual const char* toCString() const { return GetCommandString(fDrawType); } @@ -38,15 +36,15 @@ public: fVisible = toggle; } - SkTDArray* Info() {return &fInfo; }; - virtual void execute(SkCanvas* canvas) = 0; - virtual void vizExecute(SkCanvas* canvas) { }; + const SkTDArray* Info() const { return &fInfo; } + virtual void execute(SkCanvas*) const = 0; + virtual void vizExecute(SkCanvas*) const {} - virtual void setUserMatrix(const SkMatrix& userMtx) { }; + virtual void setUserMatrix(const SkMatrix&) {} /** Does nothing by default, but used by save() and restore()-type subclasses to track unresolved save() calls. */ - virtual void trackSaveState(int* state) { }; + virtual void trackSaveState(int* state) {} // The next "active" system is only used by save, saveLayer, restore, // pushCull and popCull. It is used in two ways: @@ -70,7 +68,7 @@ public: virtual void setActive(bool active) {} virtual bool active() const { return false; } - DrawType getType() { return fDrawType; }; + DrawType getType() const { return fDrawType; } virtual bool render(SkCanvas* canvas) const { return false; } @@ -88,7 +86,7 @@ private: class SkRestoreCommand : public SkDrawCommand { public: SkRestoreCommand(); - virtual void execute(SkCanvas* canvas) SK_OVERRIDE; + virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; virtual void trackSaveState(int* state) SK_OVERRIDE; virtual Action action() const SK_OVERRIDE { return kPopLayer_Action; } @@ -99,7 +97,7 @@ private: class SkClearCommand : public SkDrawCommand { public: SkClearCommand(SkColor color); - virtual void execute(SkCanvas* canvas) SK_OVERRIDE; + virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; private: SkColor fColor; @@ -109,7 +107,7 @@ private: class SkClipPathCommand : public SkDrawCommand { public: SkClipPathCommand(const SkPath& path, SkRegion::Op op, bool doAA); - virtual void execute(SkCanvas* canvas) SK_OVERRIDE; + virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; private: SkPath fPath; @@ -122,7 +120,7 @@ private: class SkClipRegionCommand : public SkDrawCommand { public: SkClipRegionCommand(const SkRegion& region, SkRegion::Op op); - virtual void execute(SkCanvas* canvas) SK_OVERRIDE; + virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; private: SkRegion fRegion; SkRegion::Op fOp; @@ -133,7 +131,7 @@ private: class SkClipRectCommand : public SkDrawCommand { public: SkClipRectCommand(const SkRect& rect, SkRegion::Op op, bool doAA); - virtual void execute(SkCanvas* canvas) SK_OVERRIDE; + virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; const SkRect& rect() const { return fRect; } SkRegion::Op op() const { return fOp; } @@ -150,7 +148,7 @@ private: class SkClipRRectCommand : public SkDrawCommand { public: SkClipRRectCommand(const SkRRect& rrect, SkRegion::Op op, bool doAA); - virtual void execute(SkCanvas* canvas) SK_OVERRIDE; + virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; const SkRRect& rrect() const { return fRRect; } @@ -168,7 +166,7 @@ private: class SkConcatCommand : public SkDrawCommand { public: SkConcatCommand(const SkMatrix& matrix); - virtual void execute(SkCanvas* canvas) SK_OVERRIDE; + virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; private: SkMatrix fMatrix; @@ -179,7 +177,7 @@ class SkDrawBitmapCommand : public SkDrawCommand { public: SkDrawBitmapCommand(const SkBitmap& bitmap, SkScalar left, SkScalar top, const SkPaint* paint); - virtual void execute(SkCanvas* canvas) SK_OVERRIDE; + virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; private: SkBitmap fBitmap; @@ -195,7 +193,7 @@ class SkDrawBitmapMatrixCommand : public SkDrawCommand { public: SkDrawBitmapMatrixCommand(const SkBitmap& bitmap, const SkMatrix& matrix, const SkPaint* paint); - virtual void execute(SkCanvas* canvas) SK_OVERRIDE; + virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; private: SkBitmap fBitmap; @@ -210,7 +208,7 @@ class SkDrawBitmapNineCommand : public SkDrawCommand { public: SkDrawBitmapNineCommand(const SkBitmap& bitmap, const SkIRect& center, const SkRect& dst, const SkPaint* paint); - virtual void execute(SkCanvas* canvas) SK_OVERRIDE; + virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; private: SkBitmap fBitmap; @@ -227,7 +225,7 @@ public: SkDrawBitmapRectCommand(const SkBitmap& bitmap, const SkRect* src, const SkRect& dst, const SkPaint* paint, SkCanvas::DrawBitmapRectFlags flags); - virtual void execute(SkCanvas* canvas) SK_OVERRIDE; + virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; const SkBitmap& bitmap() const { return fBitmap; } @@ -265,7 +263,7 @@ class SkDrawDataCommand : public SkDrawCommand { public: SkDrawDataCommand(const void* data, size_t length); virtual ~SkDrawDataCommand() { delete [] fData; } - virtual void execute(SkCanvas* canvas) SK_OVERRIDE; + virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; private: char* fData; size_t fLength; @@ -276,7 +274,7 @@ private: class SkBeginCommentGroupCommand : public SkDrawCommand { public: SkBeginCommentGroupCommand(const char* description); - virtual void execute(SkCanvas* canvas) SK_OVERRIDE { + virtual void execute(SkCanvas* canvas) const SK_OVERRIDE { canvas->beginCommentGroup(fDescription.c_str()); }; private: @@ -288,7 +286,7 @@ private: class SkCommentCommand : public SkDrawCommand { public: SkCommentCommand(const char* kywd, const char* value); - virtual void execute(SkCanvas* canvas) SK_OVERRIDE { + virtual void execute(SkCanvas* canvas) const SK_OVERRIDE { canvas->addComment(fKywd.c_str(), fValue.c_str()); }; private: @@ -301,7 +299,7 @@ private: class SkEndCommentGroupCommand : public SkDrawCommand { public: SkEndCommentGroupCommand(); - virtual void execute(SkCanvas* canvas) SK_OVERRIDE { + virtual void execute(SkCanvas* canvas) const SK_OVERRIDE { canvas->endCommentGroup(); }; private: @@ -311,7 +309,7 @@ private: class SkDrawOvalCommand : public SkDrawCommand { public: SkDrawOvalCommand(const SkRect& oval, const SkPaint& paint); - virtual void execute(SkCanvas* canvas) SK_OVERRIDE; + virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; private: SkRect fOval; @@ -323,7 +321,7 @@ private: class SkDrawPaintCommand : public SkDrawCommand { public: SkDrawPaintCommand(const SkPaint& paint); - virtual void execute(SkCanvas* canvas) SK_OVERRIDE; + virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; private: SkPaint fPaint; @@ -334,7 +332,7 @@ private: class SkDrawPathCommand : public SkDrawCommand { public: SkDrawPathCommand(const SkPath& path, const SkPaint& paint); - virtual void execute(SkCanvas* canvas) SK_OVERRIDE; + virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; private: @@ -347,7 +345,7 @@ private: class SkDrawPictureCommand : public SkDrawCommand { public: SkDrawPictureCommand(const SkPicture* picture, const SkMatrix* matrix, const SkPaint* paint); - virtual void execute(SkCanvas* canvas) SK_OVERRIDE; + virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; private: @@ -365,7 +363,7 @@ public: SkDrawPointsCommand(SkCanvas::PointMode mode, size_t count, const SkPoint pts[], const SkPaint& paint); virtual ~SkDrawPointsCommand() { delete [] fPts; } - virtual void execute(SkCanvas* canvas) SK_OVERRIDE; + virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; private: SkCanvas::PointMode fMode; @@ -381,7 +379,7 @@ public: SkDrawTextCommand(const void* text, size_t byteLength, SkScalar x, SkScalar y, const SkPaint& paint); virtual ~SkDrawTextCommand() { delete [] fText; } - virtual void execute(SkCanvas* canvas) SK_OVERRIDE; + virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; private: char* fText; size_t fByteLength; @@ -397,7 +395,7 @@ public: SkDrawPosTextCommand(const void* text, size_t byteLength, const SkPoint pos[], const SkPaint& paint); virtual ~SkDrawPosTextCommand() { delete [] fPos; delete [] fText; } - virtual void execute(SkCanvas* canvas) SK_OVERRIDE; + virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; private: char* fText; size_t fByteLength; @@ -412,7 +410,7 @@ public: SkDrawTextOnPathCommand(const void* text, size_t byteLength, const SkPath& path, const SkMatrix* matrix, const SkPaint& paint); virtual ~SkDrawTextOnPathCommand() { delete [] fText; } - virtual void execute(SkCanvas* canvas) SK_OVERRIDE; + virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; private: char* fText; size_t fByteLength; @@ -428,7 +426,7 @@ public: SkDrawPosTextHCommand(const void* text, size_t byteLength, const SkScalar xpos[], SkScalar constY, const SkPaint& paint); virtual ~SkDrawPosTextHCommand() { delete [] fXpos; delete [] fText; } - virtual void execute(SkCanvas* canvas) SK_OVERRIDE; + virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; private: SkScalar* fXpos; char* fText; @@ -443,7 +441,7 @@ class SkDrawTextBlobCommand : public SkDrawCommand { public: SkDrawTextBlobCommand(const SkTextBlob* blob, SkScalar x, SkScalar y, const SkPaint& paint); - virtual void execute(SkCanvas* canvas) SK_OVERRIDE; + virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; private: @@ -458,7 +456,7 @@ private: class SkDrawRectCommand : public SkDrawCommand { public: SkDrawRectCommand(const SkRect& rect, const SkPaint& paint); - virtual void execute(SkCanvas* canvas) SK_OVERRIDE; + virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; const SkRect& rect() const { return fRect; } const SkPaint& paint() const { return fPaint; } @@ -472,7 +470,7 @@ private: class SkDrawRRectCommand : public SkDrawCommand { public: SkDrawRRectCommand(const SkRRect& rrect, const SkPaint& paint); - virtual void execute(SkCanvas* canvas) SK_OVERRIDE; + virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; private: SkRRect fRRect; @@ -485,7 +483,7 @@ class SkDrawDRRectCommand : public SkDrawCommand { public: SkDrawDRRectCommand(const SkRRect& outer, const SkRRect& inner, const SkPaint& paint); - virtual void execute(SkCanvas* canvas) SK_OVERRIDE; + virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; private: SkRRect fOuter; @@ -498,7 +496,7 @@ private: class SkDrawSpriteCommand : public SkDrawCommand { public: SkDrawSpriteCommand(const SkBitmap& bitmap, int left, int top, const SkPaint* paint); - virtual void execute(SkCanvas* canvas) SK_OVERRIDE; + virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; private: SkBitmap fBitmap; @@ -518,7 +516,7 @@ public: const uint16_t indices[], int indexCount, const SkPaint& paint); virtual ~SkDrawVerticesCommand(); - virtual void execute(SkCanvas* canvas) SK_OVERRIDE; + virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; private: SkCanvas::VertexMode fVmode; int fVertexCount; @@ -536,7 +534,7 @@ private: class SkRotateCommand : public SkDrawCommand { public: SkRotateCommand(SkScalar degrees); - virtual void execute(SkCanvas* canvas) SK_OVERRIDE; + virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; private: SkScalar fDegrees; @@ -546,7 +544,7 @@ private: class SkSaveCommand : public SkDrawCommand { public: SkSaveCommand(); - virtual void execute(SkCanvas* canvas) SK_OVERRIDE; + virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; virtual void trackSaveState(int* state) SK_OVERRIDE; virtual Action action() const SK_OVERRIDE { return kPushLayer_Action; } private: @@ -557,8 +555,8 @@ class SkSaveLayerCommand : public SkDrawCommand { public: SkSaveLayerCommand(const SkRect* bounds, const SkPaint* paint, SkCanvas::SaveFlags flags); - virtual void execute(SkCanvas* canvas) SK_OVERRIDE; - virtual void vizExecute(SkCanvas* canvas) SK_OVERRIDE; + virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; + virtual void vizExecute(SkCanvas* canvas) const SK_OVERRIDE; virtual void trackSaveState(int* state) SK_OVERRIDE; virtual Action action() const SK_OVERRIDE{ return kPushLayer_Action; } virtual void setActive(bool active) SK_OVERRIDE { fActive = active; } @@ -580,7 +578,7 @@ private: class SkScaleCommand : public SkDrawCommand { public: SkScaleCommand(SkScalar sx, SkScalar sy); - virtual void execute(SkCanvas* canvas) SK_OVERRIDE; + virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; SkScalar x() const { return fSx; } SkScalar y() const { return fSy; } @@ -596,7 +594,7 @@ class SkSetMatrixCommand : public SkDrawCommand { public: SkSetMatrixCommand(const SkMatrix& matrix); virtual void setUserMatrix(const SkMatrix&) SK_OVERRIDE; - virtual void execute(SkCanvas* canvas) SK_OVERRIDE; + virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; private: SkMatrix fUserMatrix; SkMatrix fMatrix; @@ -607,7 +605,7 @@ private: class SkSkewCommand : public SkDrawCommand { public: SkSkewCommand(SkScalar sx, SkScalar sy); - virtual void execute(SkCanvas* canvas) SK_OVERRIDE; + virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; private: SkScalar fSx; SkScalar fSy; @@ -618,7 +616,7 @@ private: class SkTranslateCommand : public SkDrawCommand { public: SkTranslateCommand(SkScalar dx, SkScalar dy); - virtual void execute(SkCanvas* canvas) SK_OVERRIDE; + virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; SkScalar x() const { return fDx; } SkScalar y() const { return fDy; } @@ -633,8 +631,8 @@ private: class SkPushCullCommand : public SkDrawCommand { public: SkPushCullCommand(const SkRect&); - virtual void execute(SkCanvas*) SK_OVERRIDE; - virtual void vizExecute(SkCanvas* canvas) SK_OVERRIDE; + virtual void execute(SkCanvas*) const SK_OVERRIDE; + virtual void vizExecute(SkCanvas* canvas) const SK_OVERRIDE; virtual Action action() const { return kPushCull_Action; } virtual void setActive(bool active) { fActive = active; } virtual bool active() const { return fActive; } @@ -648,7 +646,7 @@ private: class SkPopCullCommand : public SkDrawCommand { public: SkPopCullCommand(); - virtual void execute(SkCanvas* canvas) SK_OVERRIDE; + virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; virtual Action action() const { return kPopCull_Action; } private: typedef SkDrawCommand INHERITED;