Revert of Remove SkPictureFlat.h include from SkDrawCommands.h (patchset #2 id:20001 of https://codereview.chromium.org/912403004/)
Reason for revert: Chrome Original issue's description: > Remove SkPictureFlat.h include from SkDrawCommands.h > > Committed: https://skia.googlesource.com/skia/+/5a4c233a3657d12d836de388b41e30405b4ab976 TBR=reed@google.com,fmalita@google.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Review URL: https://codereview.chromium.org/917933002
This commit is contained in:
parent
94dff15404
commit
2e6024248f
@ -66,8 +66,8 @@ void SkDebugger::getOverviewText(const SkTDArray<double>* typeTimes,
|
||||
const SkTDArray<SkDrawCommand*>& commands = this->getDrawCommands();
|
||||
|
||||
SkTDArray<int> counts;
|
||||
counts.setCount(SkDrawCommand::kOpTypeCount);
|
||||
for (int i = 0; i < SkDrawCommand::kOpTypeCount; ++i) {
|
||||
counts.setCount(LAST_DRAWTYPE_ENUM+1);
|
||||
for (int i = 0; i < LAST_DRAWTYPE_ENUM+1; ++i) {
|
||||
counts[i] = 0;
|
||||
}
|
||||
|
||||
@ -80,14 +80,14 @@ void SkDebugger::getOverviewText(const SkTDArray<double>* typeTimes,
|
||||
#ifdef SK_DEBUG
|
||||
double totPercent = 0, tempSum = 0;
|
||||
#endif
|
||||
for (int i = 0; i < SkDrawCommand::kOpTypeCount; ++i) {
|
||||
for (int i = 0; i < LAST_DRAWTYPE_ENUM+1; ++i) {
|
||||
if (0 == counts[i]) {
|
||||
// if there were no commands of this type then they should've consumed no time
|
||||
SkASSERT(NULL == typeTimes || 0.0 == (*typeTimes)[i]);
|
||||
continue;
|
||||
}
|
||||
|
||||
overview->append(SkDrawCommand::GetCommandString((SkDrawCommand::OpType) i));
|
||||
overview->append(SkDrawCommand::GetCommandString((DrawType) i));
|
||||
overview->append(": ");
|
||||
overview->appendS32(counts[i]);
|
||||
if (typeTimes && totTime >= 0.0) {
|
||||
|
@ -396,7 +396,20 @@ void SkDebugCanvas::onClipRegion(const SkRegion& region, SkRegion::Op op) {
|
||||
}
|
||||
|
||||
void SkDebugCanvas::didConcat(const SkMatrix& matrix) {
|
||||
this->addDrawCommand(new SkConcatCommand(matrix));
|
||||
switch (matrix.getType()) {
|
||||
case SkMatrix::kTranslate_Mask:
|
||||
this->addDrawCommand(new SkTranslateCommand(matrix.getTranslateX(),
|
||||
matrix.getTranslateY()));
|
||||
break;
|
||||
case SkMatrix::kScale_Mask:
|
||||
this->addDrawCommand(new SkScaleCommand(matrix.getScaleX(),
|
||||
matrix.getScaleY()));
|
||||
break;
|
||||
default:
|
||||
this->addDrawCommand(new SkConcatCommand(matrix));
|
||||
break;
|
||||
}
|
||||
|
||||
this->INHERITED::didConcat(matrix);
|
||||
}
|
||||
|
||||
@ -505,12 +518,6 @@ void SkDebugCanvas::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar
|
||||
this->addDrawCommand(new SkDrawTextBlobCommand(blob, x, y, paint));
|
||||
}
|
||||
|
||||
void SkDebugCanvas::onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
|
||||
const SkPoint texCoords[4], SkXfermode* xmode,
|
||||
const SkPaint& paint) {
|
||||
this->addDrawCommand(new SkDrawPatchCommand(cubics, colors, texCoords, xmode, paint));
|
||||
}
|
||||
|
||||
void SkDebugCanvas::onDrawVertices(VertexMode vmode, int vertexCount, const SkPoint vertices[],
|
||||
const SkPoint texs[], const SkColor colors[],
|
||||
SkXfermode*, const uint16_t indices[], int indexCount,
|
||||
|
@ -175,30 +175,22 @@ protected:
|
||||
void didSetMatrix(const SkMatrix&) SK_OVERRIDE;
|
||||
|
||||
void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRIDE;
|
||||
void onDrawText(const void* text, size_t byteLength, SkScalar x, SkScalar y,
|
||||
const SkPaint&) SK_OVERRIDE;
|
||||
void onDrawPosText(const void* text, size_t byteLength, const SkPoint pos[],
|
||||
const SkPaint&) SK_OVERRIDE;
|
||||
void onDrawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[],
|
||||
SkScalar constY, const SkPaint&) SK_OVERRIDE;
|
||||
void onDrawTextOnPath(const void* text, size_t byteLength, const SkPath& path,
|
||||
const SkMatrix* matrix, const SkPaint&) SK_OVERRIDE;
|
||||
void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
|
||||
const SkPaint& paint) SK_OVERRIDE;
|
||||
virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, SkScalar y,
|
||||
const SkPaint&) SK_OVERRIDE;
|
||||
virtual void onDrawPosText(const void* text, size_t byteLength, const SkPoint pos[],
|
||||
const SkPaint&) SK_OVERRIDE;
|
||||
virtual void onDrawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[],
|
||||
SkScalar constY, const SkPaint&) SK_OVERRIDE;
|
||||
virtual void onDrawTextOnPath(const void* text, size_t byteLength, const SkPath& path,
|
||||
const SkMatrix* matrix, const SkPaint&) SK_OVERRIDE;
|
||||
virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
|
||||
const SkPaint& paint) SK_OVERRIDE;
|
||||
|
||||
void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
|
||||
const SkPoint texCoords[4], SkXfermode* xmode, const SkPaint& paint);
|
||||
void onDrawPaint(const SkPaint&) SK_OVERRIDE;
|
||||
|
||||
void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPaint&) SK_OVERRIDE;
|
||||
void onDrawRect(const SkRect&, const SkPaint&) SK_OVERRIDE;
|
||||
void onDrawOval(const SkRect&, const SkPaint&) SK_OVERRIDE;
|
||||
void onDrawRRect(const SkRRect&, const SkPaint&) SK_OVERRIDE;
|
||||
void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPaint&) SK_OVERRIDE;
|
||||
void onDrawVertices(VertexMode vmode, int vertexCount,
|
||||
const SkPoint vertices[], const SkPoint texs[],
|
||||
const SkColor colors[], SkXfermode* xmode,
|
||||
const uint16_t indices[], int indexCount,
|
||||
const SkPaint&) SK_OVERRIDE;
|
||||
void onDrawPath(const SkPath&, const SkPaint&) SK_OVERRIDE;
|
||||
void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPaint*) SK_OVERRIDE;
|
||||
void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst, const SkPaint*,
|
||||
@ -209,6 +201,12 @@ protected:
|
||||
void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst,
|
||||
const SkPaint*) SK_OVERRIDE;
|
||||
void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*) SK_OVERRIDE;
|
||||
void onDrawVertices(VertexMode vmode, int vertexCount,
|
||||
const SkPoint vertices[], const SkPoint texs[],
|
||||
const SkColor colors[], SkXfermode* xmode,
|
||||
const uint16_t indices[], int indexCount,
|
||||
const SkPaint&) SK_OVERRIDE;
|
||||
|
||||
void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
|
||||
void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
|
||||
void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
|
||||
|
@ -9,13 +9,13 @@
|
||||
|
||||
#include "SkDrawCommand.h"
|
||||
#include "SkObjectParser.h"
|
||||
#include "SkPicture.h"
|
||||
|
||||
#include "SkTextBlob.h"
|
||||
|
||||
// TODO(chudy): Refactor into non subclass model.
|
||||
|
||||
SkDrawCommand::SkDrawCommand(OpType type)
|
||||
: fOpType(type)
|
||||
SkDrawCommand::SkDrawCommand(DrawType type)
|
||||
: fDrawType(type)
|
||||
, fOffset(0)
|
||||
, fVisible(true) {
|
||||
}
|
||||
@ -24,42 +24,49 @@ SkDrawCommand::~SkDrawCommand() {
|
||||
fInfo.deleteAll();
|
||||
}
|
||||
|
||||
const char* SkDrawCommand::GetCommandString(OpType type) {
|
||||
const char* SkDrawCommand::GetCommandString(DrawType type) {
|
||||
switch (type) {
|
||||
case kBeginCommentGroup_OpType: return "BeginCommentGroup";
|
||||
case kClipPath_OpType: return "ClipPath";
|
||||
case kClipRegion_OpType: return "ClipRegion";
|
||||
case kClipRect_OpType: return "ClipRect";
|
||||
case kClipRRect_OpType: return "ClipRRect";
|
||||
case kComment_OpType: return "Comment";
|
||||
case kConcat_OpType: return "Concat";
|
||||
case kDrawBitmap_OpType: return "DrawBitmap";
|
||||
case kDrawBitmapNine_OpType: return "DrawBitmapNine";
|
||||
case kDrawBitmapRect_OpType: return "DrawBitmapRect";
|
||||
case kDrawClear_OpType: return "DrawClear";
|
||||
case kDrawDRRect_OpType: return "DrawDRRect";
|
||||
case kDrawOval_OpType: return "DrawOval";
|
||||
case kDrawPaint_OpType: return "DrawPaint";
|
||||
case kDrawPatch_OpType: return "DrawPatch";
|
||||
case kDrawPath_OpType: return "DrawPath";
|
||||
case kDrawPicture_OpType: return "DrawPicture";
|
||||
case kDrawPoints_OpType: return "DrawPoints";
|
||||
case kDrawPosText_OpType: return "DrawPosText";
|
||||
case kDrawPosTextH_OpType: return "DrawPosTextH";
|
||||
case kDrawRect_OpType: return "DrawRect";
|
||||
case kDrawRRect_OpType: return "DrawRRect";
|
||||
case kDrawSprite_OpType: return "DrawSprite";
|
||||
case kDrawText_OpType: return "DrawText";
|
||||
case kDrawTextBlob_OpType: return "DrawTextBlob";
|
||||
case kDrawTextOnPath_OpType: return "DrawTextOnPath";
|
||||
case kDrawVertices_OpType: return "DrawVertices";
|
||||
case kEndCommentGroup_OpType: return "EndCommentGroup";
|
||||
case kRestore_OpType: return "Restore";
|
||||
case kSave_OpType: return "Save";
|
||||
case kSaveLayer_OpType: return "SaveLayer";
|
||||
case kSetMatrix_OpType: return "SetMatrix";
|
||||
case UNUSED: SkDEBUGFAIL("DrawType UNUSED\n"); break;
|
||||
case DRAW_CLEAR: return "Clear";
|
||||
case CLIP_PATH: return "Clip Path";
|
||||
case CLIP_REGION: return "Clip Region";
|
||||
case CLIP_RECT: return "Clip Rect";
|
||||
case CLIP_RRECT: return "Clip RRect";
|
||||
case CONCAT: return "Concat";
|
||||
case DRAW_BITMAP: return "Draw Bitmap";
|
||||
case DRAW_BITMAP_MATRIX: return "Draw Bitmap Matrix";
|
||||
case DRAW_BITMAP_NINE: return "Draw Bitmap Nine";
|
||||
case DRAW_BITMAP_RECT_TO_RECT: return "Draw Bitmap Rect";
|
||||
case DRAW_DATA: return "Draw Data";
|
||||
case DRAW_OVAL: return "Draw Oval";
|
||||
case DRAW_PAINT: return "Draw Paint";
|
||||
case DRAW_PATH: return "Draw Path";
|
||||
case DRAW_PICTURE: return "Draw Picture";
|
||||
case DRAW_POINTS: return "Draw Points";
|
||||
case DRAW_POS_TEXT: return "Draw Pos Text";
|
||||
case DRAW_POS_TEXT_H: return "Draw Pos Text H";
|
||||
case DRAW_RECT: return "Draw Rect";
|
||||
case DRAW_RRECT: return "Draw RRect";
|
||||
case DRAW_SPRITE: return "Draw Sprite";
|
||||
case DRAW_TEXT: return "Draw Text";
|
||||
case DRAW_TEXT_BLOB: return "Draw Text Blob";
|
||||
case DRAW_TEXT_ON_PATH: return "Draw Text On Path";
|
||||
case DRAW_VERTICES: return "Draw Vertices";
|
||||
case RESTORE: return "Restore";
|
||||
case ROTATE: return "Rotate";
|
||||
case SAVE: return "Save";
|
||||
case SAVE_LAYER: return "Save Layer";
|
||||
case SCALE: return "Scale";
|
||||
case SET_MATRIX: return "Set Matrix";
|
||||
case SKEW: return "Skew";
|
||||
case TRANSLATE: return "Translate";
|
||||
case NOOP: return "NoOp";
|
||||
case BEGIN_COMMENT_GROUP: return "BeginCommentGroup";
|
||||
case COMMENT: return "Comment";
|
||||
case END_COMMENT_GROUP: return "EndCommentGroup";
|
||||
case DRAW_DRRECT: return "Draw DRRect";
|
||||
default:
|
||||
SkDebugf("OpType error 0x%08x\n", type);
|
||||
SkDebugf("DrawType error 0x%08x\n", type);
|
||||
SkASSERT(0);
|
||||
break;
|
||||
}
|
||||
@ -68,10 +75,10 @@ const char* SkDrawCommand::GetCommandString(OpType type) {
|
||||
}
|
||||
|
||||
SkString SkDrawCommand::toString() const {
|
||||
return SkString(GetCommandString(fOpType));
|
||||
return SkString(GetCommandString(fDrawType));
|
||||
}
|
||||
|
||||
SkClearCommand::SkClearCommand(SkColor color) : INHERITED(kDrawClear_OpType) {
|
||||
SkClearCommand::SkClearCommand(SkColor color) : INHERITED(DRAW_CLEAR) {
|
||||
fColor = color;
|
||||
fInfo.push(SkObjectParser::CustomTextToString("No Parameters"));
|
||||
}
|
||||
@ -183,7 +190,7 @@ void render_drrect(SkCanvas* canvas, const SkRRect& outer, const SkRRect& inner)
|
||||
|
||||
|
||||
SkClipPathCommand::SkClipPathCommand(const SkPath& path, SkRegion::Op op, bool doAA)
|
||||
: INHERITED(kClipPath_OpType) {
|
||||
: INHERITED(CLIP_PATH) {
|
||||
fPath = path;
|
||||
fOp = op;
|
||||
fDoAA = doAA;
|
||||
@ -203,7 +210,7 @@ bool SkClipPathCommand::render(SkCanvas* canvas) const {
|
||||
}
|
||||
|
||||
SkClipRegionCommand::SkClipRegionCommand(const SkRegion& region, SkRegion::Op op)
|
||||
: INHERITED(kClipRegion_OpType) {
|
||||
: INHERITED(CLIP_REGION) {
|
||||
fRegion = region;
|
||||
fOp = op;
|
||||
|
||||
@ -216,7 +223,7 @@ void SkClipRegionCommand::execute(SkCanvas* canvas) const {
|
||||
}
|
||||
|
||||
SkClipRectCommand::SkClipRectCommand(const SkRect& rect, SkRegion::Op op, bool doAA)
|
||||
: INHERITED(kClipRect_OpType) {
|
||||
: INHERITED(CLIP_RECT) {
|
||||
fRect = rect;
|
||||
fOp = op;
|
||||
fDoAA = doAA;
|
||||
@ -231,7 +238,7 @@ void SkClipRectCommand::execute(SkCanvas* canvas) const {
|
||||
}
|
||||
|
||||
SkClipRRectCommand::SkClipRRectCommand(const SkRRect& rrect, SkRegion::Op op, bool doAA)
|
||||
: INHERITED(kClipRRect_OpType) {
|
||||
: INHERITED(CLIP_RRECT) {
|
||||
fRRect = rrect;
|
||||
fOp = op;
|
||||
fDoAA = doAA;
|
||||
@ -251,7 +258,7 @@ bool SkClipRRectCommand::render(SkCanvas* canvas) const {
|
||||
}
|
||||
|
||||
SkConcatCommand::SkConcatCommand(const SkMatrix& matrix)
|
||||
: INHERITED(kConcat_OpType) {
|
||||
: INHERITED(CONCAT) {
|
||||
fMatrix = matrix;
|
||||
|
||||
fInfo.push(SkObjectParser::MatrixToString(matrix));
|
||||
@ -263,7 +270,7 @@ void SkConcatCommand::execute(SkCanvas* canvas) const {
|
||||
|
||||
SkDrawBitmapCommand::SkDrawBitmapCommand(const SkBitmap& bitmap, SkScalar left, SkScalar top,
|
||||
const SkPaint* paint)
|
||||
: INHERITED(kDrawBitmap_OpType) {
|
||||
: INHERITED(DRAW_BITMAP) {
|
||||
fBitmap = bitmap;
|
||||
fLeft = left;
|
||||
fTop = top;
|
||||
@ -293,7 +300,7 @@ bool SkDrawBitmapCommand::render(SkCanvas* canvas) const {
|
||||
|
||||
SkDrawBitmapNineCommand::SkDrawBitmapNineCommand(const SkBitmap& bitmap, const SkIRect& center,
|
||||
const SkRect& dst, const SkPaint* paint)
|
||||
: INHERITED(kDrawBitmapNine_OpType) {
|
||||
: INHERITED(DRAW_BITMAP_NINE) {
|
||||
fBitmap = bitmap;
|
||||
fCenter = center;
|
||||
fDst = dst;
|
||||
@ -324,7 +331,7 @@ bool SkDrawBitmapNineCommand::render(SkCanvas* canvas) const {
|
||||
SkDrawBitmapRectCommand::SkDrawBitmapRectCommand(const SkBitmap& bitmap, const SkRect* src,
|
||||
const SkRect& dst, const SkPaint* paint,
|
||||
SkCanvas::DrawBitmapRectFlags flags)
|
||||
: INHERITED(kDrawBitmapRect_OpType) {
|
||||
: INHERITED(DRAW_BITMAP_RECT_TO_RECT) {
|
||||
fBitmap = bitmap;
|
||||
if (src) {
|
||||
fSrc = *src;
|
||||
@ -362,7 +369,7 @@ bool SkDrawBitmapRectCommand::render(SkCanvas* canvas) const {
|
||||
}
|
||||
|
||||
SkBeginCommentGroupCommand::SkBeginCommentGroupCommand(const char* description)
|
||||
: INHERITED(kBeginCommentGroup_OpType)
|
||||
: INHERITED(BEGIN_COMMENT_GROUP)
|
||||
, fDescription(description) {
|
||||
SkString* temp = new SkString;
|
||||
temp->appendf("Description: %s", description);
|
||||
@ -370,7 +377,7 @@ SkBeginCommentGroupCommand::SkBeginCommentGroupCommand(const char* description)
|
||||
}
|
||||
|
||||
SkCommentCommand::SkCommentCommand(const char* kywd, const char* value)
|
||||
: INHERITED(kComment_OpType)
|
||||
: INHERITED(COMMENT)
|
||||
, fKywd(kywd)
|
||||
, fValue(value) {
|
||||
SkString* temp = new SkString;
|
||||
@ -379,11 +386,11 @@ SkCommentCommand::SkCommentCommand(const char* kywd, const char* value)
|
||||
}
|
||||
|
||||
SkEndCommentGroupCommand::SkEndCommentGroupCommand()
|
||||
: INHERITED(kEndCommentGroup_OpType) {
|
||||
: INHERITED(END_COMMENT_GROUP) {
|
||||
}
|
||||
|
||||
SkDrawOvalCommand::SkDrawOvalCommand(const SkRect& oval, const SkPaint& paint)
|
||||
: INHERITED(kDrawOval_OpType) {
|
||||
: INHERITED(DRAW_OVAL) {
|
||||
fOval = oval;
|
||||
fPaint = paint;
|
||||
|
||||
@ -412,7 +419,7 @@ bool SkDrawOvalCommand::render(SkCanvas* canvas) const {
|
||||
}
|
||||
|
||||
SkDrawPaintCommand::SkDrawPaintCommand(const SkPaint& paint)
|
||||
: INHERITED(kDrawPaint_OpType) {
|
||||
: INHERITED(DRAW_PAINT) {
|
||||
fPaint = paint;
|
||||
|
||||
fInfo.push(SkObjectParser::PaintToString(paint));
|
||||
@ -429,7 +436,7 @@ bool SkDrawPaintCommand::render(SkCanvas* canvas) const {
|
||||
}
|
||||
|
||||
SkDrawPathCommand::SkDrawPathCommand(const SkPath& path, const SkPaint& paint)
|
||||
: INHERITED(kDrawPath_OpType) {
|
||||
: INHERITED(DRAW_PATH) {
|
||||
fPath = path;
|
||||
fPaint = paint;
|
||||
|
||||
@ -449,7 +456,7 @@ bool SkDrawPathCommand::render(SkCanvas* canvas) const {
|
||||
SkDrawPictureCommand::SkDrawPictureCommand(const SkPicture* picture,
|
||||
const SkMatrix* matrix,
|
||||
const SkPaint* paint)
|
||||
: INHERITED(kDrawPicture_OpType)
|
||||
: INHERITED(DRAW_PICTURE)
|
||||
, fPicture(SkRef(picture))
|
||||
, fMatrixPtr(NULL)
|
||||
, fPaintPtr(NULL) {
|
||||
@ -495,7 +502,7 @@ bool SkDrawPictureCommand::render(SkCanvas* canvas) const {
|
||||
|
||||
SkDrawPointsCommand::SkDrawPointsCommand(SkCanvas::PointMode mode, size_t count,
|
||||
const SkPoint pts[], const SkPaint& paint)
|
||||
: INHERITED(kDrawPoints_OpType) {
|
||||
: INHERITED(DRAW_POINTS) {
|
||||
fMode = mode;
|
||||
fCount = count;
|
||||
fPts = new SkPoint[count];
|
||||
@ -538,7 +545,7 @@ bool SkDrawPointsCommand::render(SkCanvas* canvas) const {
|
||||
|
||||
SkDrawPosTextCommand::SkDrawPosTextCommand(const void* text, size_t byteLength,
|
||||
const SkPoint pos[], const SkPaint& paint)
|
||||
: INHERITED(kDrawPosText_OpType) {
|
||||
: INHERITED(DRAW_POS_TEXT) {
|
||||
size_t numPts = paint.countText(text, byteLength);
|
||||
|
||||
fText = new char[byteLength];
|
||||
@ -564,7 +571,7 @@ void SkDrawPosTextCommand::execute(SkCanvas* canvas) const {
|
||||
SkDrawPosTextHCommand::SkDrawPosTextHCommand(const void* text, size_t byteLength,
|
||||
const SkScalar xpos[], SkScalar constY,
|
||||
const SkPaint& paint)
|
||||
: INHERITED(kDrawPosTextH_OpType) {
|
||||
: INHERITED(DRAW_POS_TEXT_H) {
|
||||
size_t numPts = paint.countText(text, byteLength);
|
||||
|
||||
fText = new char[byteLength];
|
||||
@ -589,7 +596,7 @@ void SkDrawPosTextHCommand::execute(SkCanvas* canvas) const {
|
||||
|
||||
SkDrawTextBlobCommand::SkDrawTextBlobCommand(const SkTextBlob* blob, SkScalar x, SkScalar y,
|
||||
const SkPaint& paint)
|
||||
: INHERITED(kDrawTextBlob_OpType)
|
||||
: INHERITED(DRAW_TEXT_BLOB)
|
||||
, fBlob(blob)
|
||||
, fXPos(x)
|
||||
, fYPos(y)
|
||||
@ -622,25 +629,8 @@ bool SkDrawTextBlobCommand::render(SkCanvas* canvas) const {
|
||||
return true;
|
||||
}
|
||||
|
||||
SkDrawPatchCommand::SkDrawPatchCommand(const SkPoint cubics[12], const SkColor colors[4],
|
||||
const SkPoint texCoords[4], SkXfermode* xfermode,
|
||||
const SkPaint& paint)
|
||||
: INHERITED(kDrawPatch_OpType) {
|
||||
memcpy(fCubics, cubics, sizeof(fCubics));
|
||||
memcpy(fColors, colors, sizeof(fColors));
|
||||
memcpy(fTexCoords, texCoords, sizeof(fTexCoords));
|
||||
fXfermode.reset(xfermode);
|
||||
fPaint = paint;
|
||||
|
||||
fInfo.push(SkObjectParser::PaintToString(paint));
|
||||
}
|
||||
|
||||
void SkDrawPatchCommand::execute(SkCanvas* canvas) const {
|
||||
canvas->drawPatch(fCubics, fColors, fTexCoords, fXfermode, fPaint);
|
||||
}
|
||||
|
||||
SkDrawRectCommand::SkDrawRectCommand(const SkRect& rect, const SkPaint& paint)
|
||||
: INHERITED(kDrawRect_OpType) {
|
||||
: INHERITED(DRAW_RECT) {
|
||||
fRect = rect;
|
||||
fPaint = paint;
|
||||
|
||||
@ -653,7 +643,7 @@ void SkDrawRectCommand::execute(SkCanvas* canvas) const {
|
||||
}
|
||||
|
||||
SkDrawRRectCommand::SkDrawRRectCommand(const SkRRect& rrect, const SkPaint& paint)
|
||||
: INHERITED(kDrawRRect_OpType) {
|
||||
: INHERITED(DRAW_RRECT) {
|
||||
fRRect = rrect;
|
||||
fPaint = paint;
|
||||
|
||||
@ -673,7 +663,7 @@ bool SkDrawRRectCommand::render(SkCanvas* canvas) const {
|
||||
SkDrawDRRectCommand::SkDrawDRRectCommand(const SkRRect& outer,
|
||||
const SkRRect& inner,
|
||||
const SkPaint& paint)
|
||||
: INHERITED(kDrawDRRect_OpType) {
|
||||
: INHERITED(DRAW_DRRECT) {
|
||||
fOuter = outer;
|
||||
fInner = inner;
|
||||
fPaint = paint;
|
||||
@ -694,7 +684,7 @@ bool SkDrawDRRectCommand::render(SkCanvas* canvas) const {
|
||||
|
||||
SkDrawSpriteCommand::SkDrawSpriteCommand(const SkBitmap& bitmap, int left, int top,
|
||||
const SkPaint* paint)
|
||||
: INHERITED(kDrawSprite_OpType) {
|
||||
: INHERITED(DRAW_SPRITE) {
|
||||
fBitmap = bitmap;
|
||||
fLeft = left;
|
||||
fTop = top;
|
||||
@ -724,7 +714,7 @@ bool SkDrawSpriteCommand::render(SkCanvas* canvas) const {
|
||||
|
||||
SkDrawTextCommand::SkDrawTextCommand(const void* text, size_t byteLength, SkScalar x, SkScalar y,
|
||||
const SkPaint& paint)
|
||||
: INHERITED(kDrawText_OpType) {
|
||||
: INHERITED(DRAW_TEXT) {
|
||||
fText = new char[byteLength];
|
||||
memcpy(fText, text, byteLength);
|
||||
fByteLength = byteLength;
|
||||
@ -745,7 +735,7 @@ void SkDrawTextCommand::execute(SkCanvas* canvas) const {
|
||||
SkDrawTextOnPathCommand::SkDrawTextOnPathCommand(const void* text, size_t byteLength,
|
||||
const SkPath& path, const SkMatrix* matrix,
|
||||
const SkPaint& paint)
|
||||
: INHERITED(kDrawTextOnPath_OpType) {
|
||||
: INHERITED(DRAW_TEXT_ON_PATH) {
|
||||
fText = new char[byteLength];
|
||||
memcpy(fText, text, byteLength);
|
||||
fByteLength = byteLength;
|
||||
@ -776,7 +766,7 @@ SkDrawVerticesCommand::SkDrawVerticesCommand(SkCanvas::VertexMode vmode, int ver
|
||||
const SkColor colors[], SkXfermode* xfermode,
|
||||
const uint16_t indices[], int indexCount,
|
||||
const SkPaint& paint)
|
||||
: INHERITED(kDrawVertices_OpType) {
|
||||
: INHERITED(DRAW_VERTICES) {
|
||||
fVmode = vmode;
|
||||
|
||||
fVertexCount = vertexCount;
|
||||
@ -833,7 +823,7 @@ void SkDrawVerticesCommand::execute(SkCanvas* canvas) const {
|
||||
}
|
||||
|
||||
SkRestoreCommand::SkRestoreCommand()
|
||||
: INHERITED(kRestore_OpType) {
|
||||
: INHERITED(RESTORE) {
|
||||
fInfo.push(SkObjectParser::CustomTextToString("No Parameters"));
|
||||
}
|
||||
|
||||
@ -841,8 +831,19 @@ void SkRestoreCommand::execute(SkCanvas* canvas) const {
|
||||
canvas->restore();
|
||||
}
|
||||
|
||||
SkRotateCommand::SkRotateCommand(SkScalar degrees)
|
||||
: INHERITED(ROTATE) {
|
||||
fDegrees = degrees;
|
||||
|
||||
fInfo.push(SkObjectParser::ScalarToString(degrees, "SkScalar degrees: "));
|
||||
}
|
||||
|
||||
void SkRotateCommand::execute(SkCanvas* canvas) const {
|
||||
canvas->rotate(fDegrees);
|
||||
}
|
||||
|
||||
SkSaveCommand::SkSaveCommand()
|
||||
: INHERITED(kSave_OpType) {
|
||||
: INHERITED(SAVE) {
|
||||
}
|
||||
|
||||
void SkSaveCommand::execute(SkCanvas* canvas) const {
|
||||
@ -851,7 +852,7 @@ void SkSaveCommand::execute(SkCanvas* canvas) const {
|
||||
|
||||
SkSaveLayerCommand::SkSaveLayerCommand(const SkRect* bounds, const SkPaint* paint,
|
||||
SkCanvas::SaveFlags flags)
|
||||
: INHERITED(kSaveLayer_OpType) {
|
||||
: INHERITED(SAVE_LAYER) {
|
||||
if (bounds) {
|
||||
fBounds = *bounds;
|
||||
} else {
|
||||
@ -885,8 +886,21 @@ void SkSaveLayerCommand::vizExecute(SkCanvas* canvas) const {
|
||||
canvas->save();
|
||||
}
|
||||
|
||||
SkScaleCommand::SkScaleCommand(SkScalar sx, SkScalar sy)
|
||||
: INHERITED(SCALE) {
|
||||
fSx = sx;
|
||||
fSy = sy;
|
||||
|
||||
fInfo.push(SkObjectParser::ScalarToString(sx, "SkScalar sx: "));
|
||||
fInfo.push(SkObjectParser::ScalarToString(sy, "SkScalar sy: "));
|
||||
}
|
||||
|
||||
void SkScaleCommand::execute(SkCanvas* canvas) const {
|
||||
canvas->scale(fSx, fSy);
|
||||
}
|
||||
|
||||
SkSetMatrixCommand::SkSetMatrixCommand(const SkMatrix& matrix)
|
||||
: INHERITED(kSetMatrix_OpType) {
|
||||
: INHERITED(SET_MATRIX) {
|
||||
fUserMatrix.reset();
|
||||
fMatrix = matrix;
|
||||
|
||||
@ -902,3 +916,29 @@ void SkSetMatrixCommand::execute(SkCanvas* canvas) const {
|
||||
canvas->setMatrix(temp);
|
||||
}
|
||||
|
||||
SkSkewCommand::SkSkewCommand(SkScalar sx, SkScalar sy)
|
||||
: INHERITED(SKEW) {
|
||||
fSx = sx;
|
||||
fSy = sy;
|
||||
|
||||
fInfo.push(SkObjectParser::ScalarToString(sx, "SkScalar sx: "));
|
||||
fInfo.push(SkObjectParser::ScalarToString(sy, "SkScalar sy: "));
|
||||
}
|
||||
|
||||
void SkSkewCommand::execute(SkCanvas* canvas) const {
|
||||
canvas->skew(fSx, fSy);
|
||||
}
|
||||
|
||||
SkTranslateCommand::SkTranslateCommand(SkScalar dx, SkScalar dy)
|
||||
: INHERITED(TRANSLATE) {
|
||||
fDx = dx;
|
||||
fDy = dy;
|
||||
|
||||
fInfo.push(SkObjectParser::ScalarToString(dx, "SkScalar dx: "));
|
||||
fInfo.push(SkObjectParser::ScalarToString(dy, "SkScalar dy: "));
|
||||
}
|
||||
|
||||
void SkTranslateCommand::execute(SkCanvas* canvas) const {
|
||||
canvas->translate(fDx, fDy);
|
||||
}
|
||||
|
||||
|
@ -9,51 +9,13 @@
|
||||
#ifndef SKDRAWCOMMAND_H_
|
||||
#define SKDRAWCOMMAND_H_
|
||||
|
||||
#include "SkPictureFlat.h"
|
||||
#include "SkCanvas.h"
|
||||
#include "SkString.h"
|
||||
|
||||
class SK_API SkDrawCommand {
|
||||
public:
|
||||
enum OpType {
|
||||
kBeginCommentGroup_OpType,
|
||||
kClipPath_OpType,
|
||||
kClipRegion_OpType,
|
||||
kClipRect_OpType,
|
||||
kClipRRect_OpType,
|
||||
kComment_OpType,
|
||||
kConcat_OpType,
|
||||
kDrawBitmap_OpType,
|
||||
kDrawBitmapNine_OpType,
|
||||
kDrawBitmapRect_OpType,
|
||||
kDrawClear_OpType,
|
||||
kDrawDRRect_OpType,
|
||||
kDrawOval_OpType,
|
||||
kDrawPaint_OpType,
|
||||
kDrawPatch_OpType,
|
||||
kDrawPath_OpType,
|
||||
kDrawPicture_OpType,
|
||||
kDrawPoints_OpType,
|
||||
kDrawPosText_OpType,
|
||||
kDrawPosTextH_OpType,
|
||||
kDrawRect_OpType,
|
||||
kDrawRRect_OpType,
|
||||
kDrawSprite_OpType,
|
||||
kDrawText_OpType,
|
||||
kDrawTextBlob_OpType,
|
||||
kDrawTextOnPath_OpType,
|
||||
kDrawVertices_OpType,
|
||||
kEndCommentGroup_OpType,
|
||||
kRestore_OpType,
|
||||
kSave_OpType,
|
||||
kSaveLayer_OpType,
|
||||
kSetMatrix_OpType,
|
||||
|
||||
kLast_OpType = kSetMatrix_OpType
|
||||
};
|
||||
|
||||
static const int kOpTypeCount = kLast_OpType + 1;
|
||||
|
||||
SkDrawCommand(OpType opType);
|
||||
SkDrawCommand(DrawType drawType);
|
||||
|
||||
virtual ~SkDrawCommand();
|
||||
|
||||
@ -63,7 +25,7 @@ public:
|
||||
size_t offset() const { return fOffset; }
|
||||
|
||||
virtual const char* toCString() const {
|
||||
return GetCommandString(fOpType);
|
||||
return GetCommandString(fDrawType);
|
||||
}
|
||||
|
||||
bool isVisible() const {
|
||||
@ -95,17 +57,17 @@ public:
|
||||
virtual void setActive(bool active) {}
|
||||
virtual bool active() const { return false; }
|
||||
|
||||
OpType getType() const { return fOpType; }
|
||||
DrawType getType() const { return fDrawType; }
|
||||
|
||||
virtual bool render(SkCanvas* canvas) const { return false; }
|
||||
|
||||
static const char* GetCommandString(OpType type);
|
||||
static const char* GetCommandString(DrawType type);
|
||||
|
||||
protected:
|
||||
SkTDArray<SkString*> fInfo;
|
||||
|
||||
private:
|
||||
OpType fOpType;
|
||||
DrawType fDrawType;
|
||||
size_t fOffset;
|
||||
bool fVisible;
|
||||
};
|
||||
@ -462,24 +424,6 @@ private:
|
||||
typedef SkDrawCommand INHERITED;
|
||||
};
|
||||
|
||||
class SkDrawPatchCommand : public SkDrawCommand {
|
||||
public:
|
||||
SkDrawPatchCommand(const SkPoint cubics[12], const SkColor colors[4],
|
||||
const SkPoint texCoords[4], SkXfermode* xmode,
|
||||
const SkPaint& paint);
|
||||
void execute(SkCanvas* canvas) const SK_OVERRIDE;
|
||||
|
||||
private:
|
||||
SkPoint fCubics[12];
|
||||
SkColor fColors[4];
|
||||
SkPoint fTexCoords[4];
|
||||
SkAutoTUnref<SkXfermode> fXfermode;
|
||||
SkPaint fPaint;
|
||||
|
||||
typedef SkDrawCommand INHERITED;
|
||||
};
|
||||
|
||||
|
||||
class SkDrawRectCommand : public SkDrawCommand {
|
||||
public:
|
||||
SkDrawRectCommand(const SkRect& rect, const SkPaint& paint);
|
||||
@ -558,6 +502,16 @@ private:
|
||||
typedef SkDrawCommand INHERITED;
|
||||
};
|
||||
|
||||
class SkRotateCommand : public SkDrawCommand {
|
||||
public:
|
||||
SkRotateCommand(SkScalar degrees);
|
||||
void execute(SkCanvas* canvas) const SK_OVERRIDE;
|
||||
private:
|
||||
SkScalar fDegrees;
|
||||
|
||||
typedef SkDrawCommand INHERITED;
|
||||
};
|
||||
|
||||
class SkSaveCommand : public SkDrawCommand {
|
||||
public:
|
||||
SkSaveCommand();
|
||||
@ -590,6 +544,21 @@ private:
|
||||
typedef SkDrawCommand INHERITED;
|
||||
};
|
||||
|
||||
class SkScaleCommand : public SkDrawCommand {
|
||||
public:
|
||||
SkScaleCommand(SkScalar sx, SkScalar sy);
|
||||
void execute(SkCanvas* canvas) const SK_OVERRIDE;
|
||||
|
||||
SkScalar x() const { return fSx; }
|
||||
SkScalar y() const { return fSy; }
|
||||
|
||||
private:
|
||||
SkScalar fSx;
|
||||
SkScalar fSy;
|
||||
|
||||
typedef SkDrawCommand INHERITED;
|
||||
};
|
||||
|
||||
class SkSetMatrixCommand : public SkDrawCommand {
|
||||
public:
|
||||
SkSetMatrixCommand(const SkMatrix& matrix);
|
||||
@ -602,4 +571,30 @@ private:
|
||||
typedef SkDrawCommand INHERITED;
|
||||
};
|
||||
|
||||
class SkSkewCommand : public SkDrawCommand {
|
||||
public:
|
||||
SkSkewCommand(SkScalar sx, SkScalar sy);
|
||||
void execute(SkCanvas* canvas) const SK_OVERRIDE;
|
||||
private:
|
||||
SkScalar fSx;
|
||||
SkScalar fSy;
|
||||
|
||||
typedef SkDrawCommand INHERITED;
|
||||
};
|
||||
|
||||
class SkTranslateCommand : public SkDrawCommand {
|
||||
public:
|
||||
SkTranslateCommand(SkScalar dx, SkScalar dy);
|
||||
void execute(SkCanvas* canvas) const SK_OVERRIDE;
|
||||
|
||||
SkScalar x() const { return fDx; }
|
||||
SkScalar y() const { return fDy; }
|
||||
|
||||
private:
|
||||
SkScalar fDx;
|
||||
SkScalar fDy;
|
||||
|
||||
typedef SkDrawCommand INHERITED;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -48,10 +48,10 @@ static bool is_simple(const SkPaint& p) {
|
||||
// RESTORE
|
||||
// where the saveLayer's color can be moved into the drawBitmapRect
|
||||
static bool check_0(SkDebugCanvas* canvas, int curCommand) {
|
||||
if (SkDrawCommand::kSaveLayer_OpType != canvas->getDrawCommandAt(curCommand)->getType() ||
|
||||
if (SAVE_LAYER != canvas->getDrawCommandAt(curCommand)->getType() ||
|
||||
canvas->getSize() <= curCommand+2 ||
|
||||
SkDrawCommand::kDrawBitmapRect_OpType != canvas->getDrawCommandAt(curCommand+1)->getType() ||
|
||||
SkDrawCommand::kRestore_OpType != canvas->getDrawCommandAt(curCommand+2)->getType()) {
|
||||
DRAW_BITMAP_RECT_TO_RECT != canvas->getDrawCommandAt(curCommand+1)->getType() ||
|
||||
RESTORE != canvas->getDrawCommandAt(curCommand+2)->getType()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -120,13 +120,13 @@ static void apply_0(SkDebugCanvas* canvas, int curCommand) {
|
||||
// RESTORE
|
||||
// where the saveLayer's color can be moved into the drawBitmapRect
|
||||
static bool check_1(SkDebugCanvas* canvas, int curCommand) {
|
||||
if (SkDrawCommand::kSaveLayer_OpType != canvas->getDrawCommandAt(curCommand)->getType() ||
|
||||
if (SAVE_LAYER != canvas->getDrawCommandAt(curCommand)->getType() ||
|
||||
canvas->getSize() <= curCommand+5 ||
|
||||
SkDrawCommand::kSave_OpType != canvas->getDrawCommandAt(curCommand+1)->getType() ||
|
||||
SkDrawCommand::kClipRect_OpType != canvas->getDrawCommandAt(curCommand+2)->getType() ||
|
||||
SkDrawCommand::kDrawBitmapRect_OpType != canvas->getDrawCommandAt(curCommand+3)->getType() ||
|
||||
SkDrawCommand::kRestore_OpType != canvas->getDrawCommandAt(curCommand+4)->getType() ||
|
||||
SkDrawCommand::kRestore_OpType != canvas->getDrawCommandAt(curCommand+5)->getType()) {
|
||||
SAVE != canvas->getDrawCommandAt(curCommand+1)->getType() ||
|
||||
CLIP_RECT != canvas->getDrawCommandAt(curCommand+2)->getType() ||
|
||||
DRAW_BITMAP_RECT_TO_RECT != canvas->getDrawCommandAt(curCommand+3)->getType() ||
|
||||
RESTORE != canvas->getDrawCommandAt(curCommand+4)->getType() ||
|
||||
RESTORE != canvas->getDrawCommandAt(curCommand+5)->getType()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -186,11 +186,11 @@ static void apply_1(SkDebugCanvas* canvas, int curCommand) {
|
||||
// RESTORE
|
||||
// where the rect is entirely within the clip and the clip is an intersect
|
||||
static bool check_2(SkDebugCanvas* canvas, int curCommand) {
|
||||
if (SkDrawCommand::kSave_OpType != canvas->getDrawCommandAt(curCommand)->getType() ||
|
||||
if (SAVE != canvas->getDrawCommandAt(curCommand)->getType() ||
|
||||
canvas->getSize() <= curCommand+4 ||
|
||||
SkDrawCommand::kClipRect_OpType != canvas->getDrawCommandAt(curCommand+1)->getType() ||
|
||||
SkDrawCommand::kDrawRect_OpType != canvas->getDrawCommandAt(curCommand+2)->getType() ||
|
||||
SkDrawCommand::kRestore_OpType != canvas->getDrawCommandAt(curCommand+3)->getType()) {
|
||||
CLIP_RECT != canvas->getDrawCommandAt(curCommand+1)->getType() ||
|
||||
DRAW_RECT != canvas->getDrawCommandAt(curCommand+2)->getType() ||
|
||||
RESTORE != canvas->getDrawCommandAt(curCommand+3)->getType()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -221,11 +221,11 @@ static void apply_2(SkDebugCanvas* canvas, int curCommand) {
|
||||
// RESTORE
|
||||
// where the rect entirely encloses the clip
|
||||
static bool check_3(SkDebugCanvas* canvas, int curCommand) {
|
||||
if (SkDrawCommand::kSave_OpType != canvas->getDrawCommandAt(curCommand)->getType() ||
|
||||
if (SAVE != canvas->getDrawCommandAt(curCommand)->getType() ||
|
||||
canvas->getSize() <= curCommand+4 ||
|
||||
SkDrawCommand::kClipRRect_OpType != canvas->getDrawCommandAt(curCommand+1)->getType() ||
|
||||
SkDrawCommand::kDrawRect_OpType != canvas->getDrawCommandAt(curCommand+2)->getType() ||
|
||||
SkDrawCommand::kRestore_OpType != canvas->getDrawCommandAt(curCommand+3)->getType()) {
|
||||
CLIP_RRECT != canvas->getDrawCommandAt(curCommand+1)->getType() ||
|
||||
DRAW_RECT != canvas->getDrawCommandAt(curCommand+2)->getType() ||
|
||||
RESTORE != canvas->getDrawCommandAt(curCommand+3)->getType()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -269,11 +269,11 @@ static void apply_3(SkDebugCanvas* canvas, int curCommand) {
|
||||
// RESTORE
|
||||
// where the rect and drawBitmapRect dst exactly match
|
||||
static bool check_4(SkDebugCanvas* canvas, int curCommand) {
|
||||
if (SkDrawCommand::kSave_OpType != canvas->getDrawCommandAt(curCommand)->getType() ||
|
||||
if (SAVE != canvas->getDrawCommandAt(curCommand)->getType() ||
|
||||
canvas->getSize() <= curCommand+4 ||
|
||||
SkDrawCommand::kClipRect_OpType != canvas->getDrawCommandAt(curCommand+1)->getType() ||
|
||||
SkDrawCommand::kDrawBitmapRect_OpType != canvas->getDrawCommandAt(curCommand+2)->getType() ||
|
||||
SkDrawCommand::kRestore_OpType != canvas->getDrawCommandAt(curCommand+3)->getType()) {
|
||||
CLIP_RECT != canvas->getDrawCommandAt(curCommand+1)->getType() ||
|
||||
DRAW_BITMAP_RECT_TO_RECT != canvas->getDrawCommandAt(curCommand+2)->getType() ||
|
||||
RESTORE != canvas->getDrawCommandAt(curCommand+3)->getType()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -297,6 +297,43 @@ static void apply_4(SkDebugCanvas* canvas, int curCommand) {
|
||||
canvas->deleteDrawCommandAt(curCommand); // save
|
||||
}
|
||||
|
||||
// Check for:
|
||||
// TRANSLATE
|
||||
// where the translate is zero
|
||||
static bool check_5(SkDebugCanvas* canvas, int curCommand) {
|
||||
if (TRANSLATE != canvas->getDrawCommandAt(curCommand)->getType()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
SkTranslateCommand* t =
|
||||
(SkTranslateCommand*) canvas->getDrawCommandAt(curCommand);
|
||||
|
||||
return 0 == t->x() && 0 == t->y();
|
||||
}
|
||||
|
||||
// Just remove the translate
|
||||
static void apply_5(SkDebugCanvas* canvas, int curCommand) {
|
||||
canvas->deleteDrawCommandAt(curCommand); // translate
|
||||
}
|
||||
|
||||
// Check for:
|
||||
// SCALE
|
||||
// where the scale is 1,1
|
||||
static bool check_6(SkDebugCanvas* canvas, int curCommand) {
|
||||
if (SCALE != canvas->getDrawCommandAt(curCommand)->getType()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
SkScaleCommand* s = (SkScaleCommand*) canvas->getDrawCommandAt(curCommand);
|
||||
|
||||
return SK_Scalar1 == s->x() && SK_Scalar1 == s->y();
|
||||
}
|
||||
|
||||
// Just remove the scale
|
||||
static void apply_6(SkDebugCanvas* canvas, int curCommand) {
|
||||
canvas->deleteDrawCommandAt(curCommand); // scale
|
||||
}
|
||||
|
||||
// Check for:
|
||||
// SAVE
|
||||
// CLIP_RECT
|
||||
@ -319,21 +356,21 @@ static void apply_4(SkDebugCanvas* canvas, int curCommand) {
|
||||
// all the saveLayer's paints can be rolled into the drawBitmapRectToRect's paint
|
||||
// This pattern is used by Google spreadsheet when drawing the toolbar buttons
|
||||
static bool check_7(SkDebugCanvas* canvas, int curCommand) {
|
||||
if (SkDrawCommand::kSave_OpType != canvas->getDrawCommandAt(curCommand)->getType() ||
|
||||
if (SAVE != canvas->getDrawCommandAt(curCommand)->getType() ||
|
||||
canvas->getSize() <= curCommand+13 ||
|
||||
SkDrawCommand::kClipRect_OpType != canvas->getDrawCommandAt(curCommand+1)->getType() ||
|
||||
SkDrawCommand::kSaveLayer_OpType != canvas->getDrawCommandAt(curCommand+2)->getType() ||
|
||||
SkDrawCommand::kSave_OpType != canvas->getDrawCommandAt(curCommand+3)->getType() ||
|
||||
SkDrawCommand::kClipRect_OpType != canvas->getDrawCommandAt(curCommand+4)->getType() ||
|
||||
SkDrawCommand::kSaveLayer_OpType != canvas->getDrawCommandAt(curCommand+5)->getType() ||
|
||||
SkDrawCommand::kSave_OpType != canvas->getDrawCommandAt(curCommand+6)->getType() ||
|
||||
SkDrawCommand::kClipRect_OpType != canvas->getDrawCommandAt(curCommand+7)->getType() ||
|
||||
SkDrawCommand::kDrawBitmapRect_OpType != canvas->getDrawCommandAt(curCommand+8)->getType() ||
|
||||
SkDrawCommand::kRestore_OpType != canvas->getDrawCommandAt(curCommand+9)->getType() ||
|
||||
SkDrawCommand::kRestore_OpType != canvas->getDrawCommandAt(curCommand+10)->getType() ||
|
||||
SkDrawCommand::kRestore_OpType != canvas->getDrawCommandAt(curCommand+11)->getType() ||
|
||||
SkDrawCommand::kRestore_OpType != canvas->getDrawCommandAt(curCommand+12)->getType() ||
|
||||
SkDrawCommand::kRestore_OpType != canvas->getDrawCommandAt(curCommand+13)->getType()) {
|
||||
CLIP_RECT != canvas->getDrawCommandAt(curCommand+1)->getType() ||
|
||||
SAVE_LAYER != canvas->getDrawCommandAt(curCommand+2)->getType() ||
|
||||
SAVE != canvas->getDrawCommandAt(curCommand+3)->getType() ||
|
||||
CLIP_RECT != canvas->getDrawCommandAt(curCommand+4)->getType() ||
|
||||
SAVE_LAYER != canvas->getDrawCommandAt(curCommand+5)->getType() ||
|
||||
SAVE != canvas->getDrawCommandAt(curCommand+6)->getType() ||
|
||||
CLIP_RECT != canvas->getDrawCommandAt(curCommand+7)->getType() ||
|
||||
DRAW_BITMAP_RECT_TO_RECT != canvas->getDrawCommandAt(curCommand+8)->getType() ||
|
||||
RESTORE != canvas->getDrawCommandAt(curCommand+9)->getType() ||
|
||||
RESTORE != canvas->getDrawCommandAt(curCommand+10)->getType() ||
|
||||
RESTORE != canvas->getDrawCommandAt(curCommand+11)->getType() ||
|
||||
RESTORE != canvas->getDrawCommandAt(curCommand+12)->getType() ||
|
||||
RESTORE != canvas->getDrawCommandAt(curCommand+13)->getType()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -495,11 +532,11 @@ static void apply_7(SkDebugCanvas* canvas, int curCommand) {
|
||||
// the drawBitmapRectToRect is a 1-1 copy from src to dest
|
||||
// the clip rect is BW and a subset of the drawBitmapRectToRect's dest rect
|
||||
static bool check_8(SkDebugCanvas* canvas, int curCommand) {
|
||||
if (SkDrawCommand::kSave_OpType != canvas->getDrawCommandAt(curCommand)->getType() ||
|
||||
if (SAVE != canvas->getDrawCommandAt(curCommand)->getType() ||
|
||||
canvas->getSize() <= curCommand+4 ||
|
||||
SkDrawCommand::kClipRect_OpType != canvas->getDrawCommandAt(curCommand+1)->getType() ||
|
||||
SkDrawCommand::kDrawBitmapRect_OpType != canvas->getDrawCommandAt(curCommand+2)->getType() ||
|
||||
SkDrawCommand::kRestore_OpType != canvas->getDrawCommandAt(curCommand+3)->getType()) {
|
||||
CLIP_RECT != canvas->getDrawCommandAt(curCommand+1)->getType() ||
|
||||
DRAW_BITMAP_RECT_TO_RECT != canvas->getDrawCommandAt(curCommand+2)->getType() ||
|
||||
RESTORE != canvas->getDrawCommandAt(curCommand+3)->getType()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -569,11 +606,11 @@ static void apply_8(SkDebugCanvas* canvas, int curCommand) {
|
||||
// where:
|
||||
// clipRect is BW and encloses the DBMR2R's dest rect
|
||||
static bool check_9(SkDebugCanvas* canvas, int curCommand) {
|
||||
if (SkDrawCommand::kSave_OpType != canvas->getDrawCommandAt(curCommand)->getType() ||
|
||||
if (SAVE != canvas->getDrawCommandAt(curCommand)->getType() ||
|
||||
canvas->getSize() <= curCommand+4 ||
|
||||
SkDrawCommand::kClipRect_OpType != canvas->getDrawCommandAt(curCommand+1)->getType() ||
|
||||
SkDrawCommand::kDrawBitmapRect_OpType != canvas->getDrawCommandAt(curCommand+2)->getType() ||
|
||||
SkDrawCommand::kRestore_OpType != canvas->getDrawCommandAt(curCommand+3)->getType()) {
|
||||
CLIP_RECT != canvas->getDrawCommandAt(curCommand+1)->getType() ||
|
||||
DRAW_BITMAP_RECT_TO_RECT != canvas->getDrawCommandAt(curCommand+2)->getType() ||
|
||||
RESTORE != canvas->getDrawCommandAt(curCommand+3)->getType()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -614,6 +651,8 @@ struct OptTableEntry {
|
||||
{ check_2, apply_2, 0 },
|
||||
{ check_3, apply_3, 0 },
|
||||
{ check_4, apply_4, 0 },
|
||||
{ check_5, apply_5, 0 },
|
||||
{ check_6, apply_6, 0 },
|
||||
{ check_7, apply_7, 0 },
|
||||
{ check_8, apply_8, 0 },
|
||||
{ check_9, apply_9, 0 },
|
||||
|
Loading…
Reference in New Issue
Block a user