Rename SkDrawCommand subclasses

SkDrawCommand subclass names are too generic and likely to clash in the default namespace.
This makes the header unusable in Chrome - for example, on Mac builders:

../../third_party/skia/src/utils/debugger/SkDrawCommand.h:251:7: error: redefinition of 'Comment'
class Comment : public SkDrawCommand {
	      ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/AIFF.h:192:8: note: previous definition is here
struct Comment {


This CL renames SkDrawCommand subclasses using the following pattern: "${cmd}" -> "Sk${cmd}Command".

R=robertphillips@google.com, bungeman@google.com, djsollen@google.com

Author: fmalita@chromium.org

Review URL: https://chromiumcodereview.appspot.com/17101005

git-svn-id: http://skia.googlecode.com/svn/trunk@9667 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
commit-bot@chromium.org 2013-06-18 20:20:55 +00:00
Родитель c41295d122
Коммит 7a11591e5e
4 изменённых файлов: 291 добавлений и 259 удалений

Просмотреть файл

@ -258,169 +258,171 @@ void SkDebugCanvas::toggleFilter(bool toggle) {
} }
void SkDebugCanvas::clear(SkColor color) { void SkDebugCanvas::clear(SkColor color) {
addDrawCommand(new Clear(color)); addDrawCommand(new SkClearCommand(color));
} }
bool SkDebugCanvas::clipPath(const SkPath& path, SkRegion::Op op, bool doAA) { bool SkDebugCanvas::clipPath(const SkPath& path, SkRegion::Op op, bool doAA) {
addDrawCommand(new ClipPath(path, op, doAA)); addDrawCommand(new SkClipPathCommand(path, op, doAA));
return true; return true;
} }
bool SkDebugCanvas::clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) { bool SkDebugCanvas::clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) {
addDrawCommand(new ClipRect(rect, op, doAA)); addDrawCommand(new SkClipRectCommand(rect, op, doAA));
return true; return true;
} }
bool SkDebugCanvas::clipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA) { bool SkDebugCanvas::clipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA) {
addDrawCommand(new ClipRRect(rrect, op, doAA)); addDrawCommand(new SkClipRRectCommand(rrect, op, doAA));
return true; return true;
} }
bool SkDebugCanvas::clipRegion(const SkRegion& region, SkRegion::Op op) { bool SkDebugCanvas::clipRegion(const SkRegion& region, SkRegion::Op op) {
addDrawCommand(new ClipRegion(region, op)); addDrawCommand(new SkClipRegionCommand(region, op));
return true; return true;
} }
bool SkDebugCanvas::concat(const SkMatrix& matrix) { bool SkDebugCanvas::concat(const SkMatrix& matrix) {
addDrawCommand(new Concat(matrix)); addDrawCommand(new SkConcatCommand(matrix));
return true; return true;
} }
void SkDebugCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar left, void SkDebugCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar left,
SkScalar top, const SkPaint* paint = NULL) { SkScalar top, const SkPaint* paint = NULL) {
addDrawCommand(new DrawBitmap(bitmap, left, top, paint)); addDrawCommand(new SkDrawBitmapCommand(bitmap, left, top, paint));
} }
void SkDebugCanvas::drawBitmapRectToRect(const SkBitmap& bitmap, void SkDebugCanvas::drawBitmapRectToRect(const SkBitmap& bitmap,
const SkRect* src, const SkRect& dst, const SkPaint* paint) { const SkRect* src, const SkRect& dst, const SkPaint* paint) {
addDrawCommand(new DrawBitmapRect(bitmap, src, dst, paint)); addDrawCommand(new SkDrawBitmapRectCommand(bitmap, src, dst, paint));
} }
void SkDebugCanvas::drawBitmapMatrix(const SkBitmap& bitmap, void SkDebugCanvas::drawBitmapMatrix(const SkBitmap& bitmap,
const SkMatrix& matrix, const SkPaint* paint) { const SkMatrix& matrix, const SkPaint* paint) {
addDrawCommand(new DrawBitmapMatrix(bitmap, matrix, paint)); addDrawCommand(new SkDrawBitmapMatrixCommand(bitmap, matrix, paint));
} }
void SkDebugCanvas::drawBitmapNine(const SkBitmap& bitmap, void SkDebugCanvas::drawBitmapNine(const SkBitmap& bitmap,
const SkIRect& center, const SkRect& dst, const SkPaint* paint) { const SkIRect& center, const SkRect& dst, const SkPaint* paint) {
addDrawCommand(new DrawBitmapNine(bitmap, center, dst, paint)); addDrawCommand(new SkDrawBitmapNineCommand(bitmap, center, dst, paint));
} }
void SkDebugCanvas::drawData(const void* data, size_t length) { void SkDebugCanvas::drawData(const void* data, size_t length) {
addDrawCommand(new DrawData(data, length)); addDrawCommand(new SkDrawDataCommand(data, length));
} }
void SkDebugCanvas::beginCommentGroup(const char* description) { void SkDebugCanvas::beginCommentGroup(const char* description) {
addDrawCommand(new BeginCommentGroup(description)); addDrawCommand(new SkBeginCommentGroupCommand(description));
} }
void SkDebugCanvas::addComment(const char* kywd, const char* value) { void SkDebugCanvas::addComment(const char* kywd, const char* value) {
addDrawCommand(new Comment(kywd, value)); addDrawCommand(new SkCommentCommand(kywd, value));
} }
void SkDebugCanvas::endCommentGroup() { void SkDebugCanvas::endCommentGroup() {
addDrawCommand(new EndCommentGroup()); addDrawCommand(new SkEndCommentGroupCommand());
} }
void SkDebugCanvas::drawOval(const SkRect& oval, const SkPaint& paint) { void SkDebugCanvas::drawOval(const SkRect& oval, const SkPaint& paint) {
addDrawCommand(new DrawOval(oval, paint)); addDrawCommand(new SkDrawOvalCommand(oval, paint));
} }
void SkDebugCanvas::drawPaint(const SkPaint& paint) { void SkDebugCanvas::drawPaint(const SkPaint& paint) {
addDrawCommand(new DrawPaint(paint)); addDrawCommand(new SkDrawPaintCommand(paint));
} }
void SkDebugCanvas::drawPath(const SkPath& path, const SkPaint& paint) { void SkDebugCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
addDrawCommand(new DrawPath(path, paint)); addDrawCommand(new SkDrawPathCommand(path, paint));
} }
void SkDebugCanvas::drawPicture(SkPicture& picture) { void SkDebugCanvas::drawPicture(SkPicture& picture) {
addDrawCommand(new DrawPicture(picture)); addDrawCommand(new SkDrawPictureCommand(picture));
} }
void SkDebugCanvas::drawPoints(PointMode mode, size_t count, void SkDebugCanvas::drawPoints(PointMode mode, size_t count,
const SkPoint pts[], const SkPaint& paint) { const SkPoint pts[], const SkPaint& paint) {
addDrawCommand(new DrawPoints(mode, count, pts, paint)); addDrawCommand(new SkDrawPointsCommand(mode, count, pts, paint));
} }
void SkDebugCanvas::drawPosText(const void* text, size_t byteLength, void SkDebugCanvas::drawPosText(const void* text, size_t byteLength,
const SkPoint pos[], const SkPaint& paint) { const SkPoint pos[], const SkPaint& paint) {
addDrawCommand(new DrawPosText(text, byteLength, pos, paint)); addDrawCommand(new SkDrawPosTextCommand(text, byteLength, pos, paint));
} }
void SkDebugCanvas::drawPosTextH(const void* text, size_t byteLength, void SkDebugCanvas::drawPosTextH(const void* text, size_t byteLength,
const SkScalar xpos[], SkScalar constY, const SkPaint& paint) { const SkScalar xpos[], SkScalar constY, const SkPaint& paint) {
addDrawCommand(new DrawPosTextH(text, byteLength, xpos, constY, paint)); addDrawCommand(
new SkDrawPosTextHCommand(text, byteLength, xpos, constY, paint));
} }
void SkDebugCanvas::drawRect(const SkRect& rect, const SkPaint& paint) { void SkDebugCanvas::drawRect(const SkRect& rect, const SkPaint& paint) {
// NOTE(chudy): Messing up when renamed to DrawRect... Why? // NOTE(chudy): Messing up when renamed to DrawRect... Why?
addDrawCommand(new DrawRectC(rect, paint)); addDrawCommand(new SkDrawRectCommand(rect, paint));
} }
void SkDebugCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) { void SkDebugCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
addDrawCommand(new DrawRRect(rrect, paint)); addDrawCommand(new SkDrawRRectCommand(rrect, paint));
} }
void SkDebugCanvas::drawSprite(const SkBitmap& bitmap, int left, int top, void SkDebugCanvas::drawSprite(const SkBitmap& bitmap, int left, int top,
const SkPaint* paint = NULL) { const SkPaint* paint = NULL) {
addDrawCommand(new DrawSprite(bitmap, left, top, paint)); addDrawCommand(new SkDrawSpriteCommand(bitmap, left, top, paint));
} }
void SkDebugCanvas::drawText(const void* text, size_t byteLength, SkScalar x, void SkDebugCanvas::drawText(const void* text, size_t byteLength, SkScalar x,
SkScalar y, const SkPaint& paint) { SkScalar y, const SkPaint& paint) {
addDrawCommand(new DrawTextC(text, byteLength, x, y, paint)); addDrawCommand(new SkDrawTextCommand(text, byteLength, x, y, paint));
} }
void SkDebugCanvas::drawTextOnPath(const void* text, size_t byteLength, void SkDebugCanvas::drawTextOnPath(const void* text, size_t byteLength,
const SkPath& path, const SkMatrix* matrix, const SkPaint& paint) { const SkPath& path, const SkMatrix* matrix, const SkPaint& paint) {
addDrawCommand(new DrawTextOnPath(text, byteLength, path, matrix, paint)); addDrawCommand(
new SkDrawTextOnPathCommand(text, byteLength, path, matrix, paint));
} }
void SkDebugCanvas::drawVertices(VertexMode vmode, int vertexCount, void SkDebugCanvas::drawVertices(VertexMode vmode, int vertexCount,
const SkPoint vertices[], const SkPoint texs[], const SkColor colors[], const SkPoint vertices[], const SkPoint texs[], const SkColor colors[],
SkXfermode*, const uint16_t indices[], int indexCount, SkXfermode*, const uint16_t indices[], int indexCount,
const SkPaint& paint) { const SkPaint& paint) {
addDrawCommand(new DrawVertices(vmode, vertexCount, vertices, texs, colors, addDrawCommand(new SkDrawVerticesCommand(vmode, vertexCount, vertices,
NULL, indices, indexCount, paint)); texs, colors, NULL, indices, indexCount, paint));
} }
void SkDebugCanvas::restore() { void SkDebugCanvas::restore() {
addDrawCommand(new Restore()); addDrawCommand(new SkRestoreCommand());
} }
bool SkDebugCanvas::rotate(SkScalar degrees) { bool SkDebugCanvas::rotate(SkScalar degrees) {
addDrawCommand(new Rotate(degrees)); addDrawCommand(new SkRotateCommand(degrees));
return true; return true;
} }
int SkDebugCanvas::save(SaveFlags flags) { int SkDebugCanvas::save(SaveFlags flags) {
addDrawCommand(new Save(flags)); addDrawCommand(new SkSaveCommand(flags));
return true; return true;
} }
int SkDebugCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint, int SkDebugCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint,
SaveFlags flags) { SaveFlags flags) {
addDrawCommand(new SaveLayer(bounds, paint, flags)); addDrawCommand(new SkSaveLayerCommand(bounds, paint, flags));
return true; return true;
} }
bool SkDebugCanvas::scale(SkScalar sx, SkScalar sy) { bool SkDebugCanvas::scale(SkScalar sx, SkScalar sy) {
addDrawCommand(new Scale(sx, sy)); addDrawCommand(new SkScaleCommand(sx, sy));
return true; return true;
} }
void SkDebugCanvas::setMatrix(const SkMatrix& matrix) { void SkDebugCanvas::setMatrix(const SkMatrix& matrix) {
addDrawCommand(new SetMatrix(matrix)); addDrawCommand(new SkSetMatrixCommand(matrix));
} }
bool SkDebugCanvas::skew(SkScalar sx, SkScalar sy) { bool SkDebugCanvas::skew(SkScalar sx, SkScalar sy) {
addDrawCommand(new Skew(sx, sy)); addDrawCommand(new SkSkewCommand(sx, sy));
return true; return true;
} }
bool SkDebugCanvas::translate(SkScalar dx, SkScalar dy) { bool SkDebugCanvas::translate(SkScalar dx, SkScalar dy) {
addDrawCommand(new Translate(dx, dy)); addDrawCommand(new SkTranslateCommand(dx, dy));
return true; return true;
} }

Просмотреть файл

@ -77,13 +77,13 @@ SkString SkDrawCommand::toString() {
return SkString(GetCommandString(fDrawType)); return SkString(GetCommandString(fDrawType));
} }
Clear::Clear(SkColor color) { SkClearCommand::SkClearCommand(SkColor color) {
fColor = color; fColor = color;
fDrawType = DRAW_CLEAR; fDrawType = DRAW_CLEAR;
fInfo.push(SkObjectParser::CustomTextToString("No Parameters")); fInfo.push(SkObjectParser::CustomTextToString("No Parameters"));
} }
void Clear::execute(SkCanvas* canvas) { void SkClearCommand::execute(SkCanvas* canvas) {
canvas->clear(fColor); canvas->clear(fColor);
} }
@ -173,7 +173,7 @@ void render_rrect(SkCanvas* canvas, const SkRRect& rrect) {
}; };
ClipPath::ClipPath(const SkPath& path, SkRegion::Op op, bool doAA) { SkClipPathCommand::SkClipPathCommand(const SkPath& path, SkRegion::Op op, bool doAA) {
fPath = path; fPath = path;
fOp = op; fOp = op;
fDoAA = doAA; fDoAA = doAA;
@ -184,16 +184,16 @@ ClipPath::ClipPath(const SkPath& path, SkRegion::Op op, bool doAA) {
fInfo.push(SkObjectParser::BoolToString(doAA)); fInfo.push(SkObjectParser::BoolToString(doAA));
} }
void ClipPath::execute(SkCanvas* canvas) { void SkClipPathCommand::execute(SkCanvas* canvas) {
canvas->clipPath(fPath, fOp, fDoAA); canvas->clipPath(fPath, fOp, fDoAA);
} }
bool ClipPath::render(SkCanvas* canvas) const { bool SkClipPathCommand::render(SkCanvas* canvas) const {
render_path(canvas, fPath); render_path(canvas, fPath);
return true; return true;
} }
ClipRegion::ClipRegion(const SkRegion& region, SkRegion::Op op) { SkClipRegionCommand::SkClipRegionCommand(const SkRegion& region, SkRegion::Op op) {
fRegion = region; fRegion = region;
fOp = op; fOp = op;
fDrawType = CLIP_REGION; fDrawType = CLIP_REGION;
@ -202,11 +202,11 @@ ClipRegion::ClipRegion(const SkRegion& region, SkRegion::Op op) {
fInfo.push(SkObjectParser::RegionOpToString(op)); fInfo.push(SkObjectParser::RegionOpToString(op));
} }
void ClipRegion::execute(SkCanvas* canvas) { void SkClipRegionCommand::execute(SkCanvas* canvas) {
canvas->clipRegion(fRegion, fOp); canvas->clipRegion(fRegion, fOp);
} }
ClipRect::ClipRect(const SkRect& rect, SkRegion::Op op, bool doAA) { SkClipRectCommand::SkClipRectCommand(const SkRect& rect, SkRegion::Op op, bool doAA) {
fRect = rect; fRect = rect;
fOp = op; fOp = op;
fDoAA = doAA; fDoAA = doAA;
@ -217,11 +217,11 @@ ClipRect::ClipRect(const SkRect& rect, SkRegion::Op op, bool doAA) {
fInfo.push(SkObjectParser::BoolToString(doAA)); fInfo.push(SkObjectParser::BoolToString(doAA));
} }
void ClipRect::execute(SkCanvas* canvas) { void SkClipRectCommand::execute(SkCanvas* canvas) {
canvas->clipRect(fRect, fOp, fDoAA); canvas->clipRect(fRect, fOp, fDoAA);
} }
ClipRRect::ClipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA) { SkClipRRectCommand::SkClipRRectCommand(const SkRRect& rrect, SkRegion::Op op, bool doAA) {
fRRect = rrect; fRRect = rrect;
fOp = op; fOp = op;
fDoAA = doAA; fDoAA = doAA;
@ -232,27 +232,27 @@ ClipRRect::ClipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA) {
fInfo.push(SkObjectParser::BoolToString(doAA)); fInfo.push(SkObjectParser::BoolToString(doAA));
} }
void ClipRRect::execute(SkCanvas* canvas) { void SkClipRRectCommand::execute(SkCanvas* canvas) {
canvas->clipRRect(fRRect, fOp, fDoAA); canvas->clipRRect(fRRect, fOp, fDoAA);
} }
bool ClipRRect::render(SkCanvas* canvas) const { bool SkClipRRectCommand::render(SkCanvas* canvas) const {
render_rrect(canvas, fRRect); render_rrect(canvas, fRRect);
return true; return true;
} }
Concat::Concat(const SkMatrix& matrix) { SkConcatCommand::SkConcatCommand(const SkMatrix& matrix) {
fMatrix = matrix; fMatrix = matrix;
fDrawType = CONCAT; fDrawType = CONCAT;
fInfo.push(SkObjectParser::MatrixToString(matrix)); fInfo.push(SkObjectParser::MatrixToString(matrix));
} }
void Concat::execute(SkCanvas* canvas) { void SkConcatCommand::execute(SkCanvas* canvas) {
canvas->concat(fMatrix); canvas->concat(fMatrix);
} }
DrawBitmap::DrawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top, SkDrawBitmapCommand::SkDrawBitmapCommand(const SkBitmap& bitmap, SkScalar left, SkScalar top,
const SkPaint* paint) { const SkPaint* paint) {
fBitmap = bitmap; fBitmap = bitmap;
fLeft = left; fLeft = left;
@ -273,16 +273,16 @@ DrawBitmap::DrawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top,
} }
} }
void DrawBitmap::execute(SkCanvas* canvas) { void SkDrawBitmapCommand::execute(SkCanvas* canvas) {
canvas->drawBitmap(fBitmap, fLeft, fTop, fPaintPtr); canvas->drawBitmap(fBitmap, fLeft, fTop, fPaintPtr);
} }
bool DrawBitmap::render(SkCanvas* canvas) const { bool SkDrawBitmapCommand::render(SkCanvas* canvas) const {
render_bitmap(canvas, fBitmap); render_bitmap(canvas, fBitmap);
return true; return true;
} }
DrawBitmapMatrix::DrawBitmapMatrix(const SkBitmap& bitmap, SkDrawBitmapMatrixCommand::SkDrawBitmapMatrixCommand(const SkBitmap& bitmap,
const SkMatrix& matrix, const SkMatrix& matrix,
const SkPaint* paint) { const SkPaint* paint) {
fBitmap = bitmap; fBitmap = bitmap;
@ -302,16 +302,16 @@ DrawBitmapMatrix::DrawBitmapMatrix(const SkBitmap& bitmap,
} }
} }
void DrawBitmapMatrix::execute(SkCanvas* canvas) { void SkDrawBitmapMatrixCommand::execute(SkCanvas* canvas) {
canvas->drawBitmapMatrix(fBitmap, fMatrix, fPaintPtr); canvas->drawBitmapMatrix(fBitmap, fMatrix, fPaintPtr);
} }
bool DrawBitmapMatrix::render(SkCanvas* canvas) const { bool SkDrawBitmapMatrixCommand::render(SkCanvas* canvas) const {
render_bitmap(canvas, fBitmap); render_bitmap(canvas, fBitmap);
return true; return true;
} }
DrawBitmapNine::DrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, SkDrawBitmapNineCommand::SkDrawBitmapNineCommand(const SkBitmap& bitmap, const SkIRect& center,
const SkRect& dst, const SkPaint* paint) { const SkRect& dst, const SkPaint* paint) {
fBitmap = bitmap; fBitmap = bitmap;
fCenter = center; fCenter = center;
@ -332,16 +332,16 @@ DrawBitmapNine::DrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center,
} }
} }
void DrawBitmapNine::execute(SkCanvas* canvas) { void SkDrawBitmapNineCommand::execute(SkCanvas* canvas) {
canvas->drawBitmapNine(fBitmap, fCenter, fDst, fPaintPtr); canvas->drawBitmapNine(fBitmap, fCenter, fDst, fPaintPtr);
} }
bool DrawBitmapNine::render(SkCanvas* canvas) const { bool SkDrawBitmapNineCommand::render(SkCanvas* canvas) const {
render_bitmap(canvas, fBitmap); render_bitmap(canvas, fBitmap);
return true; return true;
} }
DrawBitmapRect::DrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, SkDrawBitmapRectCommand::SkDrawBitmapRectCommand(const SkBitmap& bitmap, const SkRect* src,
const SkRect& dst, const SkPaint* paint) { const SkRect& dst, const SkPaint* paint) {
fBitmap = bitmap; fBitmap = bitmap;
if (NULL != src) { if (NULL != src) {
@ -369,16 +369,16 @@ DrawBitmapRect::DrawBitmapRect(const SkBitmap& bitmap, const SkRect* src,
} }
} }
void DrawBitmapRect::execute(SkCanvas* canvas) { void SkDrawBitmapRectCommand::execute(SkCanvas* canvas) {
canvas->drawBitmapRectToRect(fBitmap, this->srcRect(), fDst, fPaintPtr); canvas->drawBitmapRectToRect(fBitmap, this->srcRect(), fDst, fPaintPtr);
} }
bool DrawBitmapRect::render(SkCanvas* canvas) const { bool SkDrawBitmapRectCommand::render(SkCanvas* canvas) const {
render_bitmap(canvas, fBitmap, this->srcRect()); render_bitmap(canvas, fBitmap, this->srcRect());
return true; return true;
} }
DrawData::DrawData(const void* data, size_t length) { SkDrawDataCommand::SkDrawDataCommand(const void* data, size_t length) {
fData = new char[length]; fData = new char[length];
memcpy(fData, data, length); memcpy(fData, data, length);
fLength = length; fLength = length;
@ -390,11 +390,11 @@ DrawData::DrawData(const void* data, size_t length) {
fInfo.push(str); fInfo.push(str);
} }
void DrawData::execute(SkCanvas* canvas) { void SkDrawDataCommand::execute(SkCanvas* canvas) {
canvas->drawData(fData, fLength); canvas->drawData(fData, fLength);
} }
BeginCommentGroup::BeginCommentGroup(const char* description) SkBeginCommentGroupCommand::SkBeginCommentGroupCommand(const char* description)
: INHERITED(BEGIN_COMMENT_GROUP) : INHERITED(BEGIN_COMMENT_GROUP)
, fDescription(description) { , fDescription(description) {
SkString* temp = new SkString; SkString* temp = new SkString;
@ -402,7 +402,7 @@ BeginCommentGroup::BeginCommentGroup(const char* description)
fInfo.push(temp); fInfo.push(temp);
} }
Comment::Comment(const char* kywd, const char* value) SkCommentCommand::SkCommentCommand(const char* kywd, const char* value)
: INHERITED(COMMENT) : INHERITED(COMMENT)
, fKywd(kywd) , fKywd(kywd)
, fValue(value) { , fValue(value) {
@ -411,10 +411,10 @@ Comment::Comment(const char* kywd, const char* value)
fInfo.push(temp); fInfo.push(temp);
} }
EndCommentGroup::EndCommentGroup() : INHERITED(END_COMMENT_GROUP) { SkEndCommentGroupCommand::SkEndCommentGroupCommand() : INHERITED(END_COMMENT_GROUP) {
} }
DrawOval::DrawOval(const SkRect& oval, const SkPaint& paint) { SkDrawOvalCommand::SkDrawOvalCommand(const SkRect& oval, const SkPaint& paint) {
fOval = oval; fOval = oval;
fPaint = paint; fPaint = paint;
fDrawType = DRAW_OVAL; fDrawType = DRAW_OVAL;
@ -423,11 +423,11 @@ DrawOval::DrawOval(const SkRect& oval, const SkPaint& paint) {
fInfo.push(SkObjectParser::PaintToString(paint)); fInfo.push(SkObjectParser::PaintToString(paint));
} }
void DrawOval::execute(SkCanvas* canvas) { void SkDrawOvalCommand::execute(SkCanvas* canvas) {
canvas->drawOval(fOval, fPaint); canvas->drawOval(fOval, fPaint);
} }
bool DrawOval::render(SkCanvas* canvas) const { bool SkDrawOvalCommand::render(SkCanvas* canvas) const {
canvas->clear(0xFFFFFFFF); canvas->clear(0xFFFFFFFF);
canvas->save(); canvas->save();
@ -443,24 +443,24 @@ bool DrawOval::render(SkCanvas* canvas) const {
return true; return true;
} }
DrawPaint::DrawPaint(const SkPaint& paint) { SkDrawPaintCommand::SkDrawPaintCommand(const SkPaint& paint) {
fPaint = paint; fPaint = paint;
fDrawType = DRAW_PAINT; fDrawType = DRAW_PAINT;
fInfo.push(SkObjectParser::PaintToString(paint)); fInfo.push(SkObjectParser::PaintToString(paint));
} }
void DrawPaint::execute(SkCanvas* canvas) { void SkDrawPaintCommand::execute(SkCanvas* canvas) {
canvas->drawPaint(fPaint); canvas->drawPaint(fPaint);
} }
bool DrawPaint::render(SkCanvas* canvas) const { bool SkDrawPaintCommand::render(SkCanvas* canvas) const {
canvas->clear(0xFFFFFFFF); canvas->clear(0xFFFFFFFF);
canvas->drawPaint(fPaint); canvas->drawPaint(fPaint);
return true; return true;
} }
DrawPath::DrawPath(const SkPath& path, const SkPaint& paint) { SkDrawPathCommand::SkDrawPathCommand(const SkPath& path, const SkPaint& paint) {
fPath = path; fPath = path;
fPaint = paint; fPaint = paint;
fDrawType = DRAW_PATH; fDrawType = DRAW_PATH;
@ -469,26 +469,26 @@ DrawPath::DrawPath(const SkPath& path, const SkPaint& paint) {
fInfo.push(SkObjectParser::PaintToString(paint)); fInfo.push(SkObjectParser::PaintToString(paint));
} }
void DrawPath::execute(SkCanvas* canvas) { void SkDrawPathCommand::execute(SkCanvas* canvas) {
canvas->drawPath(fPath, fPaint); canvas->drawPath(fPath, fPaint);
} }
bool DrawPath::render(SkCanvas* canvas) const { bool SkDrawPathCommand::render(SkCanvas* canvas) const {
render_path(canvas, fPath); render_path(canvas, fPath);
return true; return true;
} }
DrawPicture::DrawPicture(SkPicture& picture) : SkDrawPictureCommand::SkDrawPictureCommand(SkPicture& picture) :
fPicture(picture) { fPicture(picture) {
fDrawType = DRAW_PICTURE; fDrawType = DRAW_PICTURE;
fInfo.push(SkObjectParser::CustomTextToString("To be implemented.")); fInfo.push(SkObjectParser::CustomTextToString("To be implemented."));
} }
void DrawPicture::execute(SkCanvas* canvas) { void SkDrawPictureCommand::execute(SkCanvas* canvas) {
canvas->drawPicture(fPicture); canvas->drawPicture(fPicture);
} }
DrawPoints::DrawPoints(SkCanvas::PointMode mode, size_t count, SkDrawPointsCommand::SkDrawPointsCommand(SkCanvas::PointMode mode, size_t count,
const SkPoint pts[], const SkPaint& paint) { const SkPoint pts[], const SkPaint& paint) {
fMode = mode; fMode = mode;
fCount = count; fCount = count;
@ -504,11 +504,11 @@ DrawPoints::DrawPoints(SkCanvas::PointMode mode, size_t count,
fInfo.push(SkObjectParser::PaintToString(paint)); fInfo.push(SkObjectParser::PaintToString(paint));
} }
void DrawPoints::execute(SkCanvas* canvas) { void SkDrawPointsCommand::execute(SkCanvas* canvas) {
canvas->drawPoints(fMode, fCount, fPts, fPaint); canvas->drawPoints(fMode, fCount, fPts, fPaint);
} }
bool DrawPoints::render(SkCanvas* canvas) const { bool SkDrawPointsCommand::render(SkCanvas* canvas) const {
canvas->clear(0xFFFFFFFF); canvas->clear(0xFFFFFFFF);
canvas->save(); canvas->save();
@ -531,8 +531,8 @@ bool DrawPoints::render(SkCanvas* canvas) const {
return true; return true;
} }
DrawPosText::DrawPosText(const void* text, size_t byteLength, const SkPoint pos[], SkDrawPosTextCommand::SkDrawPosTextCommand(const void* text, size_t byteLength,
const SkPaint& paint) { const SkPoint pos[], const SkPaint& paint) {
size_t numPts = paint.countText(text, byteLength); size_t numPts = paint.countText(text, byteLength);
fText = new char[byteLength]; fText = new char[byteLength];
@ -551,12 +551,12 @@ DrawPosText::DrawPosText(const void* text, size_t byteLength, const SkPoint pos[
fInfo.push(SkObjectParser::PaintToString(paint)); fInfo.push(SkObjectParser::PaintToString(paint));
} }
void DrawPosText::execute(SkCanvas* canvas) { void SkDrawPosTextCommand::execute(SkCanvas* canvas) {
canvas->drawPosText(fText, fByteLength, fPos, fPaint); canvas->drawPosText(fText, fByteLength, fPos, fPaint);
} }
DrawPosTextH::DrawPosTextH(const void* text, size_t byteLength, SkDrawPosTextHCommand::SkDrawPosTextHCommand(const void* text, size_t byteLength,
const SkScalar xpos[], SkScalar constY, const SkScalar xpos[], SkScalar constY,
const SkPaint& paint) { const SkPaint& paint) {
size_t numPts = paint.countText(text, byteLength); size_t numPts = paint.countText(text, byteLength);
@ -578,11 +578,11 @@ DrawPosTextH::DrawPosTextH(const void* text, size_t byteLength,
fInfo.push(SkObjectParser::PaintToString(paint)); fInfo.push(SkObjectParser::PaintToString(paint));
} }
void DrawPosTextH::execute(SkCanvas* canvas) { void SkDrawPosTextHCommand::execute(SkCanvas* canvas) {
canvas->drawPosTextH(fText, fByteLength, fXpos, fConstY, fPaint); canvas->drawPosTextH(fText, fByteLength, fXpos, fConstY, fPaint);
} }
DrawRectC::DrawRectC(const SkRect& rect, const SkPaint& paint) { SkDrawRectCommand::SkDrawRectCommand(const SkRect& rect, const SkPaint& paint) {
fRect = rect; fRect = rect;
fPaint = paint; fPaint = paint;
fDrawType = DRAW_RECT; fDrawType = DRAW_RECT;
@ -591,11 +591,11 @@ DrawRectC::DrawRectC(const SkRect& rect, const SkPaint& paint) {
fInfo.push(SkObjectParser::PaintToString(paint)); fInfo.push(SkObjectParser::PaintToString(paint));
} }
void DrawRectC::execute(SkCanvas* canvas) { void SkDrawRectCommand::execute(SkCanvas* canvas) {
canvas->drawRect(fRect, fPaint); canvas->drawRect(fRect, fPaint);
} }
DrawRRect::DrawRRect(const SkRRect& rrect, const SkPaint& paint) { SkDrawRRectCommand::SkDrawRRectCommand(const SkRRect& rrect, const SkPaint& paint) {
fRRect = rrect; fRRect = rrect;
fPaint = paint; fPaint = paint;
fDrawType = DRAW_RRECT; fDrawType = DRAW_RRECT;
@ -604,16 +604,16 @@ DrawRRect::DrawRRect(const SkRRect& rrect, const SkPaint& paint) {
fInfo.push(SkObjectParser::PaintToString(paint)); fInfo.push(SkObjectParser::PaintToString(paint));
} }
void DrawRRect::execute(SkCanvas* canvas) { void SkDrawRRectCommand::execute(SkCanvas* canvas) {
canvas->drawRRect(fRRect, fPaint); canvas->drawRRect(fRRect, fPaint);
} }
bool DrawRRect::render(SkCanvas* canvas) const { bool SkDrawRRectCommand::render(SkCanvas* canvas) const {
render_rrect(canvas, fRRect); render_rrect(canvas, fRRect);
return true; return true;
} }
DrawSprite::DrawSprite(const SkBitmap& bitmap, int left, int top, SkDrawSpriteCommand::SkDrawSpriteCommand(const SkBitmap& bitmap, int left, int top,
const SkPaint* paint) { const SkPaint* paint) {
fBitmap = bitmap; fBitmap = bitmap;
fLeft = left; fLeft = left;
@ -634,16 +634,16 @@ DrawSprite::DrawSprite(const SkBitmap& bitmap, int left, int top,
} }
} }
void DrawSprite::execute(SkCanvas* canvas) { void SkDrawSpriteCommand::execute(SkCanvas* canvas) {
canvas->drawSprite(fBitmap, fLeft, fTop, fPaintPtr); canvas->drawSprite(fBitmap, fLeft, fTop, fPaintPtr);
} }
bool DrawSprite::render(SkCanvas* canvas) const { bool SkDrawSpriteCommand::render(SkCanvas* canvas) const {
render_bitmap(canvas, fBitmap); render_bitmap(canvas, fBitmap);
return true; return true;
} }
DrawTextC::DrawTextC(const void* text, size_t byteLength, SkScalar x, SkScalar y, SkDrawTextCommand::SkDrawTextCommand(const void* text, size_t byteLength, SkScalar x, SkScalar y,
const SkPaint& paint) { const SkPaint& paint) {
fText = new char[byteLength]; fText = new char[byteLength];
memcpy(fText, text, byteLength); memcpy(fText, text, byteLength);
@ -659,11 +659,11 @@ DrawTextC::DrawTextC(const void* text, size_t byteLength, SkScalar x, SkScalar y
fInfo.push(SkObjectParser::PaintToString(paint)); fInfo.push(SkObjectParser::PaintToString(paint));
} }
void DrawTextC::execute(SkCanvas* canvas) { void SkDrawTextCommand::execute(SkCanvas* canvas) {
canvas->drawText(fText, fByteLength, fX, fY, fPaint); canvas->drawText(fText, fByteLength, fX, fY, fPaint);
} }
DrawTextOnPath::DrawTextOnPath(const void* text, size_t byteLength, SkDrawTextOnPathCommand::SkDrawTextOnPathCommand(const void* text, size_t byteLength,
const SkPath& path, const SkMatrix* matrix, const SkPath& path, const SkMatrix* matrix,
const SkPaint& paint) { const SkPaint& paint) {
fText = new char[byteLength]; fText = new char[byteLength];
@ -686,13 +686,13 @@ DrawTextOnPath::DrawTextOnPath(const void* text, size_t byteLength,
fInfo.push(SkObjectParser::PaintToString(paint)); fInfo.push(SkObjectParser::PaintToString(paint));
} }
void DrawTextOnPath::execute(SkCanvas* canvas) { void SkDrawTextOnPathCommand::execute(SkCanvas* canvas) {
canvas->drawTextOnPath(fText, fByteLength, fPath, canvas->drawTextOnPath(fText, fByteLength, fPath,
fMatrix.isIdentity() ? NULL : &fMatrix, fMatrix.isIdentity() ? NULL : &fMatrix,
fPaint); fPaint);
} }
DrawVertices::DrawVertices(SkCanvas::VertexMode vmode, int vertexCount, SkDrawVerticesCommand::SkDrawVerticesCommand(SkCanvas::VertexMode vmode, int vertexCount,
const SkPoint vertices[], const SkPoint texs[], const SkPoint vertices[], const SkPoint texs[],
const SkColor colors[], SkXfermode* xfermode, const SkColor colors[], SkXfermode* xfermode,
const uint16_t indices[], int indexCount, const uint16_t indices[], int indexCount,
@ -739,7 +739,7 @@ DrawVertices::DrawVertices(SkCanvas::VertexMode vmode, int vertexCount,
fInfo.push(SkObjectParser::PaintToString(paint)); fInfo.push(SkObjectParser::PaintToString(paint));
} }
DrawVertices::~DrawVertices() { SkDrawVerticesCommand::~SkDrawVerticesCommand() {
delete [] fVertices; delete [] fVertices;
delete [] fTexs; delete [] fTexs;
delete [] fColors; delete [] fColors;
@ -747,51 +747,51 @@ DrawVertices::~DrawVertices() {
delete [] fIndices; delete [] fIndices;
} }
void DrawVertices::execute(SkCanvas* canvas) { void SkDrawVerticesCommand::execute(SkCanvas* canvas) {
canvas->drawVertices(fVmode, fVertexCount, fVertices, canvas->drawVertices(fVmode, fVertexCount, fVertices,
fTexs, fColors, fXfermode, fIndices, fTexs, fColors, fXfermode, fIndices,
fIndexCount, fPaint); fIndexCount, fPaint);
} }
Restore::Restore() { SkRestoreCommand::SkRestoreCommand() {
fDrawType = RESTORE; fDrawType = RESTORE;
fInfo.push(SkObjectParser::CustomTextToString("No Parameters")); fInfo.push(SkObjectParser::CustomTextToString("No Parameters"));
} }
void Restore::execute(SkCanvas* canvas) { void SkRestoreCommand::execute(SkCanvas* canvas) {
canvas->restore(); canvas->restore();
} }
void Restore::trackSaveState(int* state) { void SkRestoreCommand::trackSaveState(int* state) {
(*state)--; (*state)--;
} }
Rotate::Rotate(SkScalar degrees) { SkRotateCommand::SkRotateCommand(SkScalar degrees) {
fDegrees = degrees; fDegrees = degrees;
fDrawType = ROTATE; fDrawType = ROTATE;
fInfo.push(SkObjectParser::ScalarToString(degrees, "SkScalar degrees: ")); fInfo.push(SkObjectParser::ScalarToString(degrees, "SkScalar degrees: "));
} }
void Rotate::execute(SkCanvas* canvas) { void SkRotateCommand::execute(SkCanvas* canvas) {
canvas->rotate(fDegrees); canvas->rotate(fDegrees);
} }
Save::Save(SkCanvas::SaveFlags flags) { SkSaveCommand::SkSaveCommand(SkCanvas::SaveFlags flags) {
fFlags = flags; fFlags = flags;
fDrawType = SAVE; fDrawType = SAVE;
fInfo.push(SkObjectParser::SaveFlagsToString(flags)); fInfo.push(SkObjectParser::SaveFlagsToString(flags));
} }
void Save::execute(SkCanvas* canvas) { void SkSaveCommand::execute(SkCanvas* canvas) {
canvas->save(fFlags); canvas->save(fFlags);
} }
void Save::trackSaveState(int* state) { void SkSaveCommand::trackSaveState(int* state) {
(*state)++; (*state)++;
} }
SaveLayer::SaveLayer(const SkRect* bounds, const SkPaint* paint, SkSaveLayerCommand::SkSaveLayerCommand(const SkRect* bounds, const SkPaint* paint,
SkCanvas::SaveFlags flags) { SkCanvas::SaveFlags flags) {
if (NULL != bounds) { if (NULL != bounds) {
fBounds = *bounds; fBounds = *bounds;
@ -817,17 +817,17 @@ SaveLayer::SaveLayer(const SkRect* bounds, const SkPaint* paint,
fInfo.push(SkObjectParser::SaveFlagsToString(flags)); fInfo.push(SkObjectParser::SaveFlagsToString(flags));
} }
void SaveLayer::execute(SkCanvas* canvas) { void SkSaveLayerCommand::execute(SkCanvas* canvas) {
canvas->saveLayer(fBounds.isEmpty() ? NULL : &fBounds, canvas->saveLayer(fBounds.isEmpty() ? NULL : &fBounds,
fPaintPtr, fPaintPtr,
fFlags); fFlags);
} }
void SaveLayer::trackSaveState(int* state) { void SkSaveLayerCommand::trackSaveState(int* state) {
(*state)++; (*state)++;
} }
Scale::Scale(SkScalar sx, SkScalar sy) { SkScaleCommand::SkScaleCommand(SkScalar sx, SkScalar sy) {
fSx = sx; fSx = sx;
fSy = sy; fSy = sy;
fDrawType = SCALE; fDrawType = SCALE;
@ -836,22 +836,22 @@ Scale::Scale(SkScalar sx, SkScalar sy) {
fInfo.push(SkObjectParser::ScalarToString(sy, "SkScalar sy: ")); fInfo.push(SkObjectParser::ScalarToString(sy, "SkScalar sy: "));
} }
void Scale::execute(SkCanvas* canvas) { void SkScaleCommand::execute(SkCanvas* canvas) {
canvas->scale(fSx, fSy); canvas->scale(fSx, fSy);
} }
SetMatrix::SetMatrix(const SkMatrix& matrix) { SkSetMatrixCommand::SkSetMatrixCommand(const SkMatrix& matrix) {
fMatrix = matrix; fMatrix = matrix;
fDrawType = SET_MATRIX; fDrawType = SET_MATRIX;
fInfo.push(SkObjectParser::MatrixToString(matrix)); fInfo.push(SkObjectParser::MatrixToString(matrix));
} }
void SetMatrix::execute(SkCanvas* canvas) { void SkSetMatrixCommand::execute(SkCanvas* canvas) {
canvas->setMatrix(fMatrix); canvas->setMatrix(fMatrix);
} }
Skew::Skew(SkScalar sx, SkScalar sy) { SkSkewCommand::SkSkewCommand(SkScalar sx, SkScalar sy) {
fSx = sx; fSx = sx;
fSy = sy; fSy = sy;
fDrawType = SKEW; fDrawType = SKEW;
@ -860,11 +860,11 @@ Skew::Skew(SkScalar sx, SkScalar sy) {
fInfo.push(SkObjectParser::ScalarToString(sy, "SkScalar sy: ")); fInfo.push(SkObjectParser::ScalarToString(sy, "SkScalar sy: "));
} }
void Skew::execute(SkCanvas* canvas) { void SkSkewCommand::execute(SkCanvas* canvas) {
canvas->skew(fSx, fSy); canvas->skew(fSx, fSy);
} }
Translate::Translate(SkScalar dx, SkScalar dy) { SkTranslateCommand::SkTranslateCommand(SkScalar dx, SkScalar dy) {
fDx = dx; fDx = dx;
fDy = dy; fDy = dy;
fDrawType = TRANSLATE; fDrawType = TRANSLATE;
@ -873,6 +873,6 @@ Translate::Translate(SkScalar dx, SkScalar dy) {
fInfo.push(SkObjectParser::ScalarToString(dy, "SkScalar dy: ")); fInfo.push(SkObjectParser::ScalarToString(dy, "SkScalar dy: "));
} }
void Translate::execute(SkCanvas* canvas) { void SkTranslateCommand::execute(SkCanvas* canvas) {
canvas->translate(fDx, fDy); canvas->translate(fDx, fDy);
} }

Просмотреть файл

@ -54,9 +54,9 @@ private:
bool fVisible; bool fVisible;
}; };
class Restore : public SkDrawCommand { class SkRestoreCommand : public SkDrawCommand {
public: public:
Restore(); SkRestoreCommand();
virtual void execute(SkCanvas* canvas) SK_OVERRIDE; virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
virtual void trackSaveState(int* state) SK_OVERRIDE; virtual void trackSaveState(int* state) SK_OVERRIDE;
@ -64,9 +64,9 @@ private:
typedef SkDrawCommand INHERITED; typedef SkDrawCommand INHERITED;
}; };
class Clear : public SkDrawCommand { class SkClearCommand : public SkDrawCommand {
public: public:
Clear(SkColor color); SkClearCommand(SkColor color);
virtual void execute(SkCanvas* canvas) SK_OVERRIDE; virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
private: private:
SkColor fColor; SkColor fColor;
@ -74,9 +74,9 @@ private:
typedef SkDrawCommand INHERITED; typedef SkDrawCommand INHERITED;
}; };
class ClipPath : public SkDrawCommand { class SkClipPathCommand : public SkDrawCommand {
public: public:
ClipPath(const SkPath& path, SkRegion::Op op, bool doAA); SkClipPathCommand(const SkPath& path, SkRegion::Op op, bool doAA);
virtual void execute(SkCanvas* canvas) SK_OVERRIDE; virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; virtual bool render(SkCanvas* canvas) const SK_OVERRIDE;
private: private:
@ -87,9 +87,9 @@ private:
typedef SkDrawCommand INHERITED; typedef SkDrawCommand INHERITED;
}; };
class ClipRegion : public SkDrawCommand { class SkClipRegionCommand : public SkDrawCommand {
public: public:
ClipRegion(const SkRegion& region, SkRegion::Op op); SkClipRegionCommand(const SkRegion& region, SkRegion::Op op);
virtual void execute(SkCanvas* canvas) SK_OVERRIDE; virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
private: private:
SkRegion fRegion; SkRegion fRegion;
@ -98,9 +98,9 @@ private:
typedef SkDrawCommand INHERITED; typedef SkDrawCommand INHERITED;
}; };
class ClipRect : public SkDrawCommand { class SkClipRectCommand : public SkDrawCommand {
public: public:
ClipRect(const SkRect& rect, SkRegion::Op op, bool doAA); SkClipRectCommand(const SkRect& rect, SkRegion::Op op, bool doAA);
virtual void execute(SkCanvas* canvas) SK_OVERRIDE; virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
const SkRect& rect() const { return fRect; } const SkRect& rect() const { return fRect; }
@ -115,9 +115,9 @@ private:
typedef SkDrawCommand INHERITED; typedef SkDrawCommand INHERITED;
}; };
class ClipRRect : public SkDrawCommand { class SkClipRRectCommand : public SkDrawCommand {
public: public:
ClipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA); SkClipRRectCommand(const SkRRect& rrect, SkRegion::Op op, bool doAA);
virtual void execute(SkCanvas* canvas) SK_OVERRIDE; virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; virtual bool render(SkCanvas* canvas) const SK_OVERRIDE;
@ -133,9 +133,9 @@ private:
typedef SkDrawCommand INHERITED; typedef SkDrawCommand INHERITED;
}; };
class Concat : public SkDrawCommand { class SkConcatCommand : public SkDrawCommand {
public: public:
Concat(const SkMatrix& matrix); SkConcatCommand(const SkMatrix& matrix);
virtual void execute(SkCanvas* canvas) SK_OVERRIDE; virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
private: private:
SkMatrix fMatrix; SkMatrix fMatrix;
@ -143,9 +143,9 @@ private:
typedef SkDrawCommand INHERITED; typedef SkDrawCommand INHERITED;
}; };
class DrawBitmap : public SkDrawCommand { class SkDrawBitmapCommand : public SkDrawCommand {
public: public:
DrawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top, SkDrawBitmapCommand(const SkBitmap& bitmap, SkScalar left, SkScalar top,
const SkPaint* paint); const SkPaint* paint);
virtual void execute(SkCanvas* canvas) SK_OVERRIDE; virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; virtual bool render(SkCanvas* canvas) const SK_OVERRIDE;
@ -159,9 +159,9 @@ private:
typedef SkDrawCommand INHERITED; typedef SkDrawCommand INHERITED;
}; };
class DrawBitmapMatrix : public SkDrawCommand { class SkDrawBitmapMatrixCommand : public SkDrawCommand {
public: public:
DrawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& matrix, SkDrawBitmapMatrixCommand(const SkBitmap& bitmap, const SkMatrix& matrix,
const SkPaint* paint); const SkPaint* paint);
virtual void execute(SkCanvas* canvas) SK_OVERRIDE; virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; virtual bool render(SkCanvas* canvas) const SK_OVERRIDE;
@ -174,9 +174,9 @@ private:
typedef SkDrawCommand INHERITED; typedef SkDrawCommand INHERITED;
}; };
class DrawBitmapNine : public SkDrawCommand { class SkDrawBitmapNineCommand : public SkDrawCommand {
public: public:
DrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, SkDrawBitmapNineCommand(const SkBitmap& bitmap, const SkIRect& center,
const SkRect& dst, const SkPaint* paint); const SkRect& dst, const SkPaint* paint);
virtual void execute(SkCanvas* canvas) SK_OVERRIDE; virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; virtual bool render(SkCanvas* canvas) const SK_OVERRIDE;
@ -190,9 +190,9 @@ private:
typedef SkDrawCommand INHERITED; typedef SkDrawCommand INHERITED;
}; };
class DrawBitmapRect : public SkDrawCommand { class SkDrawBitmapRectCommand : public SkDrawCommand {
public: public:
DrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, SkDrawBitmapRectCommand(const SkBitmap& bitmap, const SkRect* src,
const SkRect& dst, const SkPaint* paint); const SkRect& dst, const SkPaint* paint);
virtual void execute(SkCanvas* canvas) SK_OVERRIDE; virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; virtual bool render(SkCanvas* canvas) const SK_OVERRIDE;
@ -224,10 +224,10 @@ private:
typedef SkDrawCommand INHERITED; typedef SkDrawCommand INHERITED;
}; };
class DrawData : public SkDrawCommand { class SkDrawDataCommand : public SkDrawCommand {
public: public:
DrawData(const void* data, size_t length); SkDrawDataCommand(const void* data, size_t length);
virtual ~DrawData() { delete [] fData; } virtual ~SkDrawDataCommand() { delete [] fData; }
virtual void execute(SkCanvas* canvas) SK_OVERRIDE; virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
private: private:
char* fData; char* fData;
@ -236,9 +236,9 @@ private:
typedef SkDrawCommand INHERITED; typedef SkDrawCommand INHERITED;
}; };
class BeginCommentGroup : public SkDrawCommand { class SkBeginCommentGroupCommand : public SkDrawCommand {
public: public:
BeginCommentGroup(const char* description); SkBeginCommentGroupCommand(const char* description);
virtual void execute(SkCanvas* canvas) SK_OVERRIDE { virtual void execute(SkCanvas* canvas) SK_OVERRIDE {
canvas->beginCommentGroup(fDescription.c_str()); canvas->beginCommentGroup(fDescription.c_str());
}; };
@ -248,9 +248,9 @@ private:
typedef SkDrawCommand INHERITED; typedef SkDrawCommand INHERITED;
}; };
class Comment : public SkDrawCommand { class SkCommentCommand : public SkDrawCommand {
public: public:
Comment(const char* kywd, const char* value); SkCommentCommand(const char* kywd, const char* value);
virtual void execute(SkCanvas* canvas) SK_OVERRIDE { virtual void execute(SkCanvas* canvas) SK_OVERRIDE {
canvas->addComment(fKywd.c_str(), fValue.c_str()); canvas->addComment(fKywd.c_str(), fValue.c_str());
}; };
@ -261,9 +261,9 @@ private:
typedef SkDrawCommand INHERITED; typedef SkDrawCommand INHERITED;
}; };
class EndCommentGroup : public SkDrawCommand { class SkEndCommentGroupCommand : public SkDrawCommand {
public: public:
EndCommentGroup(); SkEndCommentGroupCommand();
virtual void execute(SkCanvas* canvas) SK_OVERRIDE { virtual void execute(SkCanvas* canvas) SK_OVERRIDE {
canvas->endCommentGroup(); canvas->endCommentGroup();
}; };
@ -271,9 +271,9 @@ private:
typedef SkDrawCommand INHERITED; typedef SkDrawCommand INHERITED;
}; };
class DrawOval : public SkDrawCommand { class SkDrawOvalCommand : public SkDrawCommand {
public: public:
DrawOval(const SkRect& oval, const SkPaint& paint); SkDrawOvalCommand(const SkRect& oval, const SkPaint& paint);
virtual void execute(SkCanvas* canvas) SK_OVERRIDE; virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; virtual bool render(SkCanvas* canvas) const SK_OVERRIDE;
private: private:
@ -283,9 +283,9 @@ private:
typedef SkDrawCommand INHERITED; typedef SkDrawCommand INHERITED;
}; };
class DrawPaint : public SkDrawCommand { class SkDrawPaintCommand : public SkDrawCommand {
public: public:
DrawPaint(const SkPaint& paint); SkDrawPaintCommand(const SkPaint& paint);
virtual void execute(SkCanvas* canvas) SK_OVERRIDE; virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; virtual bool render(SkCanvas* canvas) const SK_OVERRIDE;
private: private:
@ -294,9 +294,9 @@ private:
typedef SkDrawCommand INHERITED; typedef SkDrawCommand INHERITED;
}; };
class DrawPath : public SkDrawCommand { class SkDrawPathCommand : public SkDrawCommand {
public: public:
DrawPath(const SkPath& path, const SkPaint& paint); SkDrawPathCommand(const SkPath& path, const SkPaint& paint);
virtual void execute(SkCanvas* canvas) SK_OVERRIDE; virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; virtual bool render(SkCanvas* canvas) const SK_OVERRIDE;
@ -307,9 +307,9 @@ private:
typedef SkDrawCommand INHERITED; typedef SkDrawCommand INHERITED;
}; };
class DrawPicture : public SkDrawCommand { class SkDrawPictureCommand : public SkDrawCommand {
public: public:
DrawPicture(SkPicture& picture); SkDrawPictureCommand(SkPicture& picture);
virtual void execute(SkCanvas* canvas) SK_OVERRIDE; virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
private: private:
SkPicture fPicture; SkPicture fPicture;
@ -317,11 +317,11 @@ private:
typedef SkDrawCommand INHERITED; typedef SkDrawCommand INHERITED;
}; };
class DrawPoints : public SkDrawCommand { class SkDrawPointsCommand : public SkDrawCommand {
public: public:
DrawPoints(SkCanvas::PointMode mode, size_t count, const SkPoint pts[], SkDrawPointsCommand(SkCanvas::PointMode mode, size_t count, const SkPoint pts[],
const SkPaint& paint); const SkPaint& paint);
virtual ~DrawPoints() { delete [] fPts; } virtual ~SkDrawPointsCommand() { delete [] fPts; }
virtual void execute(SkCanvas* canvas) SK_OVERRIDE; virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; virtual bool render(SkCanvas* canvas) const SK_OVERRIDE;
private: private:
@ -333,14 +333,11 @@ private:
typedef SkDrawCommand INHERITED; typedef SkDrawCommand INHERITED;
}; };
/* TODO(chudy): DrawText is a predefined macro and was breaking something class SkDrawTextCommand : public SkDrawCommand {
* in the windows build of the debugger.
*/
class DrawTextC : public SkDrawCommand {
public: public:
DrawTextC(const void* text, size_t byteLength, SkScalar x, SkScalar y, SkDrawTextCommand(const void* text, size_t byteLength, SkScalar x, SkScalar y,
const SkPaint& paint); const SkPaint& paint);
virtual ~DrawTextC() { delete [] fText; } virtual ~SkDrawTextCommand() { delete [] fText; }
virtual void execute(SkCanvas* canvas) SK_OVERRIDE; virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
private: private:
char* fText; char* fText;
@ -352,11 +349,11 @@ private:
typedef SkDrawCommand INHERITED; typedef SkDrawCommand INHERITED;
}; };
class DrawPosText : public SkDrawCommand { class SkDrawPosTextCommand : public SkDrawCommand {
public: public:
DrawPosText(const void* text, size_t byteLength, const SkPoint pos[], SkDrawPosTextCommand(const void* text, size_t byteLength, const SkPoint pos[],
const SkPaint& paint); const SkPaint& paint);
virtual ~DrawPosText() { delete [] fPos; delete [] fText; } virtual ~SkDrawPosTextCommand() { delete [] fPos; delete [] fText; }
virtual void execute(SkCanvas* canvas) SK_OVERRIDE; virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
private: private:
char* fText; char* fText;
@ -367,11 +364,11 @@ private:
typedef SkDrawCommand INHERITED; typedef SkDrawCommand INHERITED;
}; };
class DrawTextOnPath : public SkDrawCommand { class SkDrawTextOnPathCommand : public SkDrawCommand {
public: public:
DrawTextOnPath(const void* text, size_t byteLength, const SkPath& path, SkDrawTextOnPathCommand(const void* text, size_t byteLength, const SkPath& path,
const SkMatrix* matrix, const SkPaint& paint); const SkMatrix* matrix, const SkPaint& paint);
virtual ~DrawTextOnPath() { delete [] fText; } virtual ~SkDrawTextOnPathCommand() { delete [] fText; }
virtual void execute(SkCanvas* canvas) SK_OVERRIDE; virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
private: private:
char* fText; char* fText;
@ -383,11 +380,11 @@ private:
typedef SkDrawCommand INHERITED; typedef SkDrawCommand INHERITED;
}; };
class DrawPosTextH : public SkDrawCommand { class SkDrawPosTextHCommand : public SkDrawCommand {
public: public:
DrawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[], SkDrawPosTextHCommand(const void* text, size_t byteLength, const SkScalar xpos[],
SkScalar constY, const SkPaint& paint); SkScalar constY, const SkPaint& paint);
virtual ~DrawPosTextH() { delete [] fXpos; delete [] fText; } virtual ~SkDrawPosTextHCommand() { delete [] fXpos; delete [] fText; }
virtual void execute(SkCanvas* canvas) SK_OVERRIDE; virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
private: private:
SkScalar* fXpos; SkScalar* fXpos;
@ -399,9 +396,9 @@ private:
typedef SkDrawCommand INHERITED; typedef SkDrawCommand INHERITED;
}; };
class DrawRectC : public SkDrawCommand { class SkDrawRectCommand : public SkDrawCommand {
public: public:
DrawRectC(const SkRect& rect, const SkPaint& paint); SkDrawRectCommand(const SkRect& rect, const SkPaint& paint);
virtual void execute(SkCanvas* canvas) SK_OVERRIDE; virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
const SkRect& rect() const { return fRect; } const SkRect& rect() const { return fRect; }
@ -413,9 +410,9 @@ private:
typedef SkDrawCommand INHERITED; typedef SkDrawCommand INHERITED;
}; };
class DrawRRect : public SkDrawCommand { class SkDrawRRectCommand : public SkDrawCommand {
public: public:
DrawRRect(const SkRRect& rrect, const SkPaint& paint); SkDrawRRectCommand(const SkRRect& rrect, const SkPaint& paint);
virtual void execute(SkCanvas* canvas) SK_OVERRIDE; virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; virtual bool render(SkCanvas* canvas) const SK_OVERRIDE;
private: private:
@ -425,9 +422,9 @@ private:
typedef SkDrawCommand INHERITED; typedef SkDrawCommand INHERITED;
}; };
class DrawSprite : public SkDrawCommand { class SkDrawSpriteCommand : public SkDrawCommand {
public: public:
DrawSprite(const SkBitmap& bitmap, int left, int top, const SkPaint* paint); SkDrawSpriteCommand(const SkBitmap& bitmap, int left, int top, const SkPaint* paint);
virtual void execute(SkCanvas* canvas) SK_OVERRIDE; virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; virtual bool render(SkCanvas* canvas) const SK_OVERRIDE;
private: private:
@ -440,14 +437,14 @@ private:
typedef SkDrawCommand INHERITED; typedef SkDrawCommand INHERITED;
}; };
class DrawVertices : public SkDrawCommand { class SkDrawVerticesCommand : public SkDrawCommand {
public: public:
DrawVertices(SkCanvas::VertexMode vmode, int vertexCount, SkDrawVerticesCommand(SkCanvas::VertexMode vmode, int vertexCount,
const SkPoint vertices[], const SkPoint texs[], const SkPoint vertices[], const SkPoint texs[],
const SkColor colors[], SkXfermode* xfermode, const SkColor colors[], SkXfermode* xfermode,
const uint16_t indices[], int indexCount, const uint16_t indices[], int indexCount,
const SkPaint& paint); const SkPaint& paint);
virtual ~DrawVertices(); virtual ~SkDrawVerticesCommand();
virtual void execute(SkCanvas* canvas) SK_OVERRIDE; virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
private: private:
SkCanvas::VertexMode fVmode; SkCanvas::VertexMode fVmode;
@ -463,9 +460,9 @@ private:
typedef SkDrawCommand INHERITED; typedef SkDrawCommand INHERITED;
}; };
class Rotate : public SkDrawCommand { class SkRotateCommand : public SkDrawCommand {
public: public:
Rotate(SkScalar degrees); SkRotateCommand(SkScalar degrees);
virtual void execute(SkCanvas* canvas) SK_OVERRIDE; virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
private: private:
SkScalar fDegrees; SkScalar fDegrees;
@ -473,9 +470,9 @@ private:
typedef SkDrawCommand INHERITED; typedef SkDrawCommand INHERITED;
}; };
class Save : public SkDrawCommand { class SkSaveCommand : public SkDrawCommand {
public: public:
Save(SkCanvas::SaveFlags flags); SkSaveCommand(SkCanvas::SaveFlags flags);
virtual void execute(SkCanvas* canvas) SK_OVERRIDE; virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
virtual void trackSaveState(int* state) SK_OVERRIDE; virtual void trackSaveState(int* state) SK_OVERRIDE;
private: private:
@ -484,9 +481,9 @@ private:
typedef SkDrawCommand INHERITED; typedef SkDrawCommand INHERITED;
}; };
class SaveLayer : public SkDrawCommand { class SkSaveLayerCommand : public SkDrawCommand {
public: public:
SaveLayer(const SkRect* bounds, const SkPaint* paint, SkSaveLayerCommand(const SkRect* bounds, const SkPaint* paint,
SkCanvas::SaveFlags flags); SkCanvas::SaveFlags flags);
virtual void execute(SkCanvas* canvas) SK_OVERRIDE; virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
virtual void trackSaveState(int* state) SK_OVERRIDE; virtual void trackSaveState(int* state) SK_OVERRIDE;
@ -502,9 +499,9 @@ private:
typedef SkDrawCommand INHERITED; typedef SkDrawCommand INHERITED;
}; };
class Scale : public SkDrawCommand { class SkScaleCommand : public SkDrawCommand {
public: public:
Scale(SkScalar sx, SkScalar sy); SkScaleCommand(SkScalar sx, SkScalar sy);
virtual void execute(SkCanvas* canvas) SK_OVERRIDE; virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
SkScalar x() const { return fSx; } SkScalar x() const { return fSx; }
@ -517,9 +514,9 @@ private:
typedef SkDrawCommand INHERITED; typedef SkDrawCommand INHERITED;
}; };
class SetMatrix : public SkDrawCommand { class SkSetMatrixCommand : public SkDrawCommand {
public: public:
SetMatrix(const SkMatrix& matrix); SkSetMatrixCommand(const SkMatrix& matrix);
virtual void execute(SkCanvas* canvas) SK_OVERRIDE; virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
private: private:
SkMatrix fMatrix; SkMatrix fMatrix;
@ -527,9 +524,9 @@ private:
typedef SkDrawCommand INHERITED; typedef SkDrawCommand INHERITED;
}; };
class Skew : public SkDrawCommand { class SkSkewCommand : public SkDrawCommand {
public: public:
Skew(SkScalar sx, SkScalar sy); SkSkewCommand(SkScalar sx, SkScalar sy);
virtual void execute(SkCanvas* canvas) SK_OVERRIDE; virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
private: private:
SkScalar fSx; SkScalar fSx;
@ -538,9 +535,9 @@ private:
typedef SkDrawCommand INHERITED; typedef SkDrawCommand INHERITED;
}; };
class Translate : public SkDrawCommand { class SkTranslateCommand : public SkDrawCommand {
public: public:
Translate(SkScalar dx, SkScalar dy); SkTranslateCommand(SkScalar dx, SkScalar dy);
virtual void execute(SkCanvas* canvas) SK_OVERRIDE; virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
SkScalar x() const { return fDx; } SkScalar x() const { return fDx; }

Просмотреть файл

@ -57,8 +57,10 @@ static bool check_0(SkDebugCanvas* canvas, int curCommand) {
return false; return false;
} }
SaveLayer* saveLayer = (SaveLayer*) canvas->getDrawCommandAt(curCommand); SkSaveLayerCommand* saveLayer =
DrawBitmapRect* dbmr = (DrawBitmapRect*) canvas->getDrawCommandAt(curCommand+1); (SkSaveLayerCommand*) canvas->getDrawCommandAt(curCommand);
SkDrawBitmapRectCommand* dbmr =
(SkDrawBitmapRectCommand*) canvas->getDrawCommandAt(curCommand+1);
const SkPaint* saveLayerPaint = saveLayer->paint(); const SkPaint* saveLayerPaint = saveLayer->paint();
SkPaint* dbmrPaint = dbmr->paint(); SkPaint* dbmrPaint = dbmr->paint();
@ -78,12 +80,14 @@ static bool check_0(SkDebugCanvas* canvas, int curCommand) {
// Fold the saveLayer's alpha into the drawBitmapRect and remove the saveLayer // Fold the saveLayer's alpha into the drawBitmapRect and remove the saveLayer
// and restore // and restore
static void apply_0(SkDebugCanvas* canvas, int curCommand) { static void apply_0(SkDebugCanvas* canvas, int curCommand) {
SaveLayer* saveLayer = (SaveLayer*) canvas->getDrawCommandAt(curCommand); SkSaveLayerCommand* saveLayer =
(SkSaveLayerCommand*) canvas->getDrawCommandAt(curCommand);
const SkPaint* saveLayerPaint = saveLayer->paint(); const SkPaint* saveLayerPaint = saveLayer->paint();
// if (NULL == saveLayerPaint) the dbmr's paint doesn't need to be changed // if (NULL == saveLayerPaint) the dbmr's paint doesn't need to be changed
if (NULL != saveLayerPaint) { if (NULL != saveLayerPaint) {
DrawBitmapRect* dbmr = (DrawBitmapRect*) canvas->getDrawCommandAt(curCommand+1); SkDrawBitmapRectCommand* dbmr =
(SkDrawBitmapRectCommand*) canvas->getDrawCommandAt(curCommand+1);
SkPaint* dbmrPaint = dbmr->paint(); SkPaint* dbmrPaint = dbmr->paint();
if (NULL == dbmrPaint) { if (NULL == dbmrPaint) {
@ -128,8 +132,10 @@ static bool check_1(SkDebugCanvas* canvas, int curCommand) {
return false; return false;
} }
SaveLayer* saveLayer = (SaveLayer*) canvas->getDrawCommandAt(curCommand); SkSaveLayerCommand* saveLayer =
DrawBitmapRect* dbmr = (DrawBitmapRect*) canvas->getDrawCommandAt(curCommand+3); (SkSaveLayerCommand*) canvas->getDrawCommandAt(curCommand);
SkDrawBitmapRectCommand* dbmr =
(SkDrawBitmapRectCommand*) canvas->getDrawCommandAt(curCommand+3);
const SkPaint* saveLayerPaint = saveLayer->paint(); const SkPaint* saveLayerPaint = saveLayer->paint();
SkPaint* dbmrPaint = dbmr->paint(); SkPaint* dbmrPaint = dbmr->paint();
@ -152,12 +158,14 @@ static bool check_1(SkDebugCanvas* canvas, int curCommand) {
// Fold the saveLayer's alpha into the drawBitmapRect and remove the saveLayer // Fold the saveLayer's alpha into the drawBitmapRect and remove the saveLayer
// and restore // and restore
static void apply_1(SkDebugCanvas* canvas, int curCommand) { static void apply_1(SkDebugCanvas* canvas, int curCommand) {
SaveLayer* saveLayer = (SaveLayer*) canvas->getDrawCommandAt(curCommand); SkSaveLayerCommand* saveLayer =
(SkSaveLayerCommand*) canvas->getDrawCommandAt(curCommand);
const SkPaint* saveLayerPaint = saveLayer->paint(); const SkPaint* saveLayerPaint = saveLayer->paint();
// if (NULL == saveLayerPaint) the dbmr's paint doesn't need to be changed // if (NULL == saveLayerPaint) the dbmr's paint doesn't need to be changed
if (NULL != saveLayerPaint) { if (NULL != saveLayerPaint) {
DrawBitmapRect* dbmr = (DrawBitmapRect*) canvas->getDrawCommandAt(curCommand+3); SkDrawBitmapRectCommand* dbmr =
(SkDrawBitmapRectCommand*) canvas->getDrawCommandAt(curCommand+3);
SkPaint* dbmrPaint = dbmr->paint(); SkPaint* dbmrPaint = dbmr->paint();
if (NULL == dbmrPaint) { if (NULL == dbmrPaint) {
@ -188,8 +196,10 @@ static bool check_2(SkDebugCanvas* canvas, int curCommand) {
return false; return false;
} }
ClipRect* cr = (ClipRect*) canvas->getDrawCommandAt(curCommand+1); SkClipRectCommand* cr =
DrawRectC* dr = (DrawRectC*) canvas->getDrawCommandAt(curCommand+2); (SkClipRectCommand*) canvas->getDrawCommandAt(curCommand+1);
SkDrawRectCommand* dr =
(SkDrawRectCommand*) canvas->getDrawCommandAt(curCommand+2);
if (SkRegion::kIntersect_Op != cr->op()) { if (SkRegion::kIntersect_Op != cr->op()) {
return false; return false;
@ -221,8 +231,10 @@ static bool check_3(SkDebugCanvas* canvas, int curCommand) {
return false; return false;
} }
ClipRRect* crr = (ClipRRect*) canvas->getDrawCommandAt(curCommand+1); SkClipRRectCommand* crr =
DrawRectC* dr = (DrawRectC*) canvas->getDrawCommandAt(curCommand+2); (SkClipRRectCommand*) canvas->getDrawCommandAt(curCommand+1);
SkDrawRectCommand* dr =
(SkDrawRectCommand*) canvas->getDrawCommandAt(curCommand+2);
if (SkRegion::kIntersect_Op != crr->op()) { if (SkRegion::kIntersect_Op != crr->op()) {
return false; return false;
@ -237,13 +249,15 @@ static void apply_3(SkDebugCanvas* canvas, int curCommand) {
canvas->deleteDrawCommandAt(curCommand+3); // restore canvas->deleteDrawCommandAt(curCommand+3); // restore
ClipRRect* crr = (ClipRRect*) canvas->getDrawCommandAt(curCommand+1); SkClipRRectCommand* crr =
DrawRectC* dr = (DrawRectC*) canvas->getDrawCommandAt(curCommand+2); (SkClipRRectCommand*) canvas->getDrawCommandAt(curCommand+1);
SkDrawRectCommand* dr =
(SkDrawRectCommand*) canvas->getDrawCommandAt(curCommand+2);
// TODO: could skip paint re-creation if the AA settings already match // TODO: could skip paint re-creation if the AA settings already match
SkPaint newPaint = dr->paint(); SkPaint newPaint = dr->paint();
newPaint.setAntiAlias(crr->doAA()); newPaint.setAntiAlias(crr->doAA());
DrawRRect* drr = new DrawRRect(crr->rrect(), newPaint); SkDrawRRectCommand* drr = new SkDrawRRectCommand(crr->rrect(), newPaint);
canvas->setDrawCommandAt(curCommand+2, drr); canvas->setDrawCommandAt(curCommand+2, drr);
canvas->deleteDrawCommandAt(curCommand+1); // clipRRect canvas->deleteDrawCommandAt(curCommand+1); // clipRRect
@ -265,8 +279,10 @@ static bool check_4(SkDebugCanvas* canvas, int curCommand) {
return false; return false;
} }
ClipRect* cr = (ClipRect*) canvas->getDrawCommandAt(curCommand+1); SkClipRectCommand* cr =
DrawBitmapRect* dbmr = (DrawBitmapRect*) canvas->getDrawCommandAt(curCommand+2); (SkClipRectCommand*) canvas->getDrawCommandAt(curCommand+1);
SkDrawBitmapRectCommand* dbmr =
(SkDrawBitmapRectCommand*) canvas->getDrawCommandAt(curCommand+2);
if (SkRegion::kIntersect_Op != cr->op()) { if (SkRegion::kIntersect_Op != cr->op()) {
return false; return false;
@ -291,7 +307,8 @@ static bool check_5(SkDebugCanvas* canvas, int curCommand) {
return false; return false;
} }
Translate* t = (Translate*) canvas->getDrawCommandAt(curCommand); SkTranslateCommand* t =
(SkTranslateCommand*) canvas->getDrawCommandAt(curCommand);
return 0 == t->x() && 0 == t->y(); return 0 == t->x() && 0 == t->y();
} }
@ -309,7 +326,7 @@ static bool check_6(SkDebugCanvas* canvas, int curCommand) {
return false; return false;
} }
Scale* s = (Scale*) canvas->getDrawCommandAt(curCommand); SkScaleCommand* s = (SkScaleCommand*) canvas->getDrawCommandAt(curCommand);
return SK_Scalar1 == s->x() && SK_Scalar1 == s->y(); return SK_Scalar1 == s->x() && SK_Scalar1 == s->y();
} }
@ -359,12 +376,18 @@ static bool check_7(SkDebugCanvas* canvas, int curCommand) {
return false; return false;
} }
ClipRect* clip0 = (ClipRect*) canvas->getDrawCommandAt(curCommand+1); SkClipRectCommand* clip0 =
SaveLayer* saveLayer0 = (SaveLayer*) canvas->getDrawCommandAt(curCommand+2); (SkClipRectCommand*) canvas->getDrawCommandAt(curCommand+1);
ClipRect* clip1 = (ClipRect*) canvas->getDrawCommandAt(curCommand+4); SkSaveLayerCommand* saveLayer0 =
SaveLayer* saveLayer1 = (SaveLayer*) canvas->getDrawCommandAt(curCommand+5); (SkSaveLayerCommand*) canvas->getDrawCommandAt(curCommand+2);
ClipRect* clip2 = (ClipRect*) canvas->getDrawCommandAt(curCommand+7); SkClipRectCommand* clip1 =
DrawBitmapRect* dbmr = (DrawBitmapRect*) canvas->getDrawCommandAt(curCommand+8); (SkClipRectCommand*) canvas->getDrawCommandAt(curCommand+4);
SkSaveLayerCommand* saveLayer1 =
(SkSaveLayerCommand*) canvas->getDrawCommandAt(curCommand+5);
SkClipRectCommand* clip2 =
(SkClipRectCommand*) canvas->getDrawCommandAt(curCommand+7);
SkDrawBitmapRectCommand* dbmr =
(SkDrawBitmapRectCommand*) canvas->getDrawCommandAt(curCommand+8);
if (clip0->doAA() || clip1->doAA() || clip2->doAA()) { if (clip0->doAA() || clip1->doAA() || clip2->doAA()) {
return false; return false;
@ -433,10 +456,14 @@ static bool check_7(SkDebugCanvas* canvas, int curCommand) {
// the src and dst Rects and the saveLayer paints into the drawBitmapRectToRect's // the src and dst Rects and the saveLayer paints into the drawBitmapRectToRect's
// paint. // paint.
static void apply_7(SkDebugCanvas* canvas, int curCommand) { static void apply_7(SkDebugCanvas* canvas, int curCommand) {
SaveLayer* saveLayer0 = (SaveLayer*) canvas->getDrawCommandAt(curCommand+2); SkSaveLayerCommand* saveLayer0 =
SaveLayer* saveLayer1 = (SaveLayer*) canvas->getDrawCommandAt(curCommand+5); (SkSaveLayerCommand*) canvas->getDrawCommandAt(curCommand+2);
ClipRect* clip2 = (ClipRect*) canvas->getDrawCommandAt(curCommand+7); SkSaveLayerCommand* saveLayer1 =
DrawBitmapRect* dbmr = (DrawBitmapRect*) canvas->getDrawCommandAt(curCommand+8); (SkSaveLayerCommand*) canvas->getDrawCommandAt(curCommand+5);
SkClipRectCommand* clip2 =
(SkClipRectCommand*) canvas->getDrawCommandAt(curCommand+7);
SkDrawBitmapRectCommand* dbmr =
(SkDrawBitmapRectCommand*) canvas->getDrawCommandAt(curCommand+8);
SkScalar newSrcLeft = dbmr->srcRect()->fLeft + clip2->rect().fLeft - dbmr->dstRect().fLeft; SkScalar newSrcLeft = dbmr->srcRect()->fLeft + clip2->rect().fLeft - dbmr->dstRect().fLeft;
SkScalar newSrcTop = dbmr->srcRect()->fTop + clip2->rect().fTop - dbmr->dstRect().fTop; SkScalar newSrcTop = dbmr->srcRect()->fTop + clip2->rect().fTop - dbmr->dstRect().fTop;
@ -515,8 +542,10 @@ static bool check_8(SkDebugCanvas* canvas, int curCommand) {
return false; return false;
} }
ClipRect* clip = (ClipRect*) canvas->getDrawCommandAt(curCommand+1); SkClipRectCommand* clip =
DrawBitmapRect* dbmr = (DrawBitmapRect*) canvas->getDrawCommandAt(curCommand+2); (SkClipRectCommand*) canvas->getDrawCommandAt(curCommand+1);
SkDrawBitmapRectCommand* dbmr =
(SkDrawBitmapRectCommand*) canvas->getDrawCommandAt(curCommand+2);
if (clip->doAA() || SkRegion::kIntersect_Op != clip->op()) { if (clip->doAA() || SkRegion::kIntersect_Op != clip->op()) {
return false; return false;
@ -544,8 +573,10 @@ static bool check_8(SkDebugCanvas* canvas, int curCommand) {
// Fold the clipRect into the drawBitmapRectToRect's src and dest rects // Fold the clipRect into the drawBitmapRectToRect's src and dest rects
static void apply_8(SkDebugCanvas* canvas, int curCommand) { static void apply_8(SkDebugCanvas* canvas, int curCommand) {
ClipRect* clip = (ClipRect*) canvas->getDrawCommandAt(curCommand+1); SkClipRectCommand* clip =
DrawBitmapRect* dbmr = (DrawBitmapRect*) canvas->getDrawCommandAt(curCommand+2); (SkClipRectCommand*) canvas->getDrawCommandAt(curCommand+1);
SkDrawBitmapRectCommand* dbmr =
(SkDrawBitmapRectCommand*) canvas->getDrawCommandAt(curCommand+2);
SkScalar newSrcLeft, newSrcTop; SkScalar newSrcLeft, newSrcTop;
@ -585,8 +616,10 @@ static bool check_9(SkDebugCanvas* canvas, int curCommand) {
return false; return false;
} }
ClipRect* clip = (ClipRect*) canvas->getDrawCommandAt(curCommand+1); SkClipRectCommand* clip =
DrawBitmapRect* dbmr = (DrawBitmapRect*) canvas->getDrawCommandAt(curCommand+2); (SkClipRectCommand*) canvas->getDrawCommandAt(curCommand+1);
SkDrawBitmapRectCommand* dbmr =
(SkDrawBitmapRectCommand*) canvas->getDrawCommandAt(curCommand+2);
if (clip->doAA() || SkRegion::kIntersect_Op != clip->op()) { if (clip->doAA() || SkRegion::kIntersect_Op != clip->op()) {
return false; return false;