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) {
addDrawCommand(new Clear(color));
addDrawCommand(new SkClearCommand(color));
}
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;
}
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;
}
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;
}
bool SkDebugCanvas::clipRegion(const SkRegion& region, SkRegion::Op op) {
addDrawCommand(new ClipRegion(region, op));
addDrawCommand(new SkClipRegionCommand(region, op));
return true;
}
bool SkDebugCanvas::concat(const SkMatrix& matrix) {
addDrawCommand(new Concat(matrix));
addDrawCommand(new SkConcatCommand(matrix));
return true;
}
void SkDebugCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar left,
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,
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,
const SkMatrix& matrix, const SkPaint* paint) {
addDrawCommand(new DrawBitmapMatrix(bitmap, matrix, paint));
addDrawCommand(new SkDrawBitmapMatrixCommand(bitmap, matrix, paint));
}
void SkDebugCanvas::drawBitmapNine(const SkBitmap& bitmap,
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) {
addDrawCommand(new DrawData(data, length));
addDrawCommand(new SkDrawDataCommand(data, length));
}
void SkDebugCanvas::beginCommentGroup(const char* description) {
addDrawCommand(new BeginCommentGroup(description));
addDrawCommand(new SkBeginCommentGroupCommand(description));
}
void SkDebugCanvas::addComment(const char* kywd, const char* value) {
addDrawCommand(new Comment(kywd, value));
addDrawCommand(new SkCommentCommand(kywd, value));
}
void SkDebugCanvas::endCommentGroup() {
addDrawCommand(new EndCommentGroup());
addDrawCommand(new SkEndCommentGroupCommand());
}
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) {
addDrawCommand(new DrawPaint(paint));
addDrawCommand(new SkDrawPaintCommand(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) {
addDrawCommand(new DrawPicture(picture));
addDrawCommand(new SkDrawPictureCommand(picture));
}
void SkDebugCanvas::drawPoints(PointMode mode, size_t count,
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,
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,
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) {
// 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) {
addDrawCommand(new DrawRRect(rrect, paint));
addDrawCommand(new SkDrawRRectCommand(rrect, paint));
}
void SkDebugCanvas::drawSprite(const SkBitmap& bitmap, int left, int top,
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,
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,
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,
const SkPoint vertices[], const SkPoint texs[], const SkColor colors[],
SkXfermode*, const uint16_t indices[], int indexCount,
const SkPaint& paint) {
addDrawCommand(new DrawVertices(vmode, vertexCount, vertices, texs, colors,
NULL, indices, indexCount, paint));
addDrawCommand(new SkDrawVerticesCommand(vmode, vertexCount, vertices,
texs, colors, NULL, indices, indexCount, paint));
}
void SkDebugCanvas::restore() {
addDrawCommand(new Restore());
addDrawCommand(new SkRestoreCommand());
}
bool SkDebugCanvas::rotate(SkScalar degrees) {
addDrawCommand(new Rotate(degrees));
addDrawCommand(new SkRotateCommand(degrees));
return true;
}
int SkDebugCanvas::save(SaveFlags flags) {
addDrawCommand(new Save(flags));
addDrawCommand(new SkSaveCommand(flags));
return true;
}
int SkDebugCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint,
SaveFlags flags) {
addDrawCommand(new SaveLayer(bounds, paint, flags));
addDrawCommand(new SkSaveLayerCommand(bounds, paint, flags));
return true;
}
bool SkDebugCanvas::scale(SkScalar sx, SkScalar sy) {
addDrawCommand(new Scale(sx, sy));
addDrawCommand(new SkScaleCommand(sx, sy));
return true;
}
void SkDebugCanvas::setMatrix(const SkMatrix& matrix) {
addDrawCommand(new SetMatrix(matrix));
addDrawCommand(new SkSetMatrixCommand(matrix));
}
bool SkDebugCanvas::skew(SkScalar sx, SkScalar sy) {
addDrawCommand(new Skew(sx, sy));
addDrawCommand(new SkSkewCommand(sx, sy));
return true;
}
bool SkDebugCanvas::translate(SkScalar dx, SkScalar dy) {
addDrawCommand(new Translate(dx, dy));
addDrawCommand(new SkTranslateCommand(dx, dy));
return true;
}

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

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

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

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

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

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