| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #include "SkDrawCommand.h" | 10 #include "SkDrawCommand.h" |
| 11 #include "SkObjectParser.h" | 11 #include "SkObjectParser.h" |
| 12 | 12 |
| 13 #include "SkTextBlob.h" | 13 #include "SkTextBlob.h" |
| 14 | 14 |
| 15 // TODO(chudy): Refactor into non subclass model. | 15 // TODO(chudy): Refactor into non subclass model. |
| 16 | 16 |
| 17 const char* SkDrawCommand::kDrawRectString = "Draw Rect"; |
| 18 const char* SkDrawCommand::kClipRectString = "Clip Rect"; |
| 19 |
| 20 const SkDrawCommand::OpType SkDrawCommand::kSave_OpType = SAVE; |
| 21 const SkDrawCommand::OpType SkDrawCommand::kClipRect_OpType = CLIP_RECT; |
| 22 const SkDrawCommand::OpType SkDrawCommand::kDrawRect_OpType = DRAW_RECT; |
| 23 const SkDrawCommand::OpType SkDrawCommand::kRestore_OpType = RESTORE; |
| 24 const SkDrawCommand::OpType SkDrawCommand::kSetMatrix_OpType = SET_MATRIX; |
| 25 |
| 17 SkDrawCommand::SkDrawCommand(DrawType type) | 26 SkDrawCommand::SkDrawCommand(DrawType type) |
| 18 : fDrawType(type) | 27 : fDrawType(type) |
| 19 , fOffset(0) | 28 , fOffset(0) |
| 20 , fVisible(true) { | 29 , fVisible(true) { |
| 21 } | 30 } |
| 22 | 31 |
| 23 SkDrawCommand::~SkDrawCommand() { | 32 SkDrawCommand::~SkDrawCommand() { |
| 24 fInfo.deleteAll(); | 33 fInfo.deleteAll(); |
| 25 } | 34 } |
| 26 | 35 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 50 case DRAW_SPRITE: return "Draw Sprite"; | 59 case DRAW_SPRITE: return "Draw Sprite"; |
| 51 case DRAW_TEXT: return "Draw Text"; | 60 case DRAW_TEXT: return "Draw Text"; |
| 52 case DRAW_TEXT_BLOB: return "Draw Text Blob"; | 61 case DRAW_TEXT_BLOB: return "Draw Text Blob"; |
| 53 case DRAW_TEXT_ON_PATH: return "Draw Text On Path"; | 62 case DRAW_TEXT_ON_PATH: return "Draw Text On Path"; |
| 54 case DRAW_VERTICES: return "Draw Vertices"; | 63 case DRAW_VERTICES: return "Draw Vertices"; |
| 55 case RESTORE: return "Restore"; | 64 case RESTORE: return "Restore"; |
| 56 case ROTATE: return "Rotate"; | 65 case ROTATE: return "Rotate"; |
| 57 case SAVE: return "Save"; | 66 case SAVE: return "Save"; |
| 58 case SAVE_LAYER: return "Save Layer"; | 67 case SAVE_LAYER: return "Save Layer"; |
| 59 case SCALE: return "Scale"; | 68 case SCALE: return "Scale"; |
| 60 case SET_MATRIX: return "Set Matrix"; | 69 case SET_MATRIX: return "SetMatrix"; |
| 61 case SKEW: return "Skew"; | 70 case SKEW: return "Skew"; |
| 62 case TRANSLATE: return "Translate"; | 71 case TRANSLATE: return "Translate"; |
| 63 case NOOP: return "NoOp"; | 72 case NOOP: return "NoOp"; |
| 64 case BEGIN_COMMENT_GROUP: return "BeginCommentGroup"; | 73 case BEGIN_COMMENT_GROUP: return "BeginCommentGroup"; |
| 65 case COMMENT: return "Comment"; | 74 case COMMENT: return "Comment"; |
| 66 case END_COMMENT_GROUP: return "EndCommentGroup"; | 75 case END_COMMENT_GROUP: return "EndCommentGroup"; |
| 67 case DRAW_DRRECT: return "Draw DRRect"; | 76 case DRAW_DRRECT: return "Draw DRRect"; |
| 68 default: | 77 default: |
| 69 SkDebugf("DrawType error 0x%08x\n", type); | 78 SkDebugf("DrawType error 0x%08x\n", type); |
| 70 SkASSERT(0); | 79 SkASSERT(0); |
| (...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 935 fDy = dy; | 944 fDy = dy; |
| 936 | 945 |
| 937 fInfo.push(SkObjectParser::ScalarToString(dx, "SkScalar dx: ")); | 946 fInfo.push(SkObjectParser::ScalarToString(dx, "SkScalar dx: ")); |
| 938 fInfo.push(SkObjectParser::ScalarToString(dy, "SkScalar dy: ")); | 947 fInfo.push(SkObjectParser::ScalarToString(dy, "SkScalar dy: ")); |
| 939 } | 948 } |
| 940 | 949 |
| 941 void SkTranslateCommand::execute(SkCanvas* canvas) const { | 950 void SkTranslateCommand::execute(SkCanvas* canvas) const { |
| 942 canvas->translate(fDx, fDy); | 951 canvas->translate(fDx, fDy); |
| 943 } | 952 } |
| 944 | 953 |
| OLD | NEW |