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" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 case SAVE_LAYER: return "Save Layer"; | 58 case SAVE_LAYER: return "Save Layer"; |
59 case SCALE: return "Scale"; | 59 case SCALE: return "Scale"; |
60 case SET_MATRIX: return "Set Matrix"; | 60 case SET_MATRIX: return "Set Matrix"; |
61 case SKEW: return "Skew"; | 61 case SKEW: return "Skew"; |
62 case TRANSLATE: return "Translate"; | 62 case TRANSLATE: return "Translate"; |
63 case NOOP: return "NoOp"; | 63 case NOOP: return "NoOp"; |
64 case BEGIN_COMMENT_GROUP: return "BeginCommentGroup"; | 64 case BEGIN_COMMENT_GROUP: return "BeginCommentGroup"; |
65 case COMMENT: return "Comment"; | 65 case COMMENT: return "Comment"; |
66 case END_COMMENT_GROUP: return "EndCommentGroup"; | 66 case END_COMMENT_GROUP: return "EndCommentGroup"; |
67 case DRAW_DRRECT: return "Draw DRRect"; | 67 case DRAW_DRRECT: return "Draw DRRect"; |
| 68 case PUSH_CULL: return "PushCull"; |
| 69 case POP_CULL: return "PopCull"; |
68 default: | 70 default: |
69 SkDebugf("DrawType error 0x%08x\n", type); | 71 SkDebugf("DrawType error 0x%08x\n", type); |
70 SkASSERT(0); | 72 SkASSERT(0); |
71 break; | 73 break; |
72 } | 74 } |
73 SkDEBUGFAIL("DrawType UNUSED\n"); | 75 SkDEBUGFAIL("DrawType UNUSED\n"); |
74 return NULL; | 76 return NULL; |
75 } | 77 } |
76 | 78 |
77 SkString SkDrawCommand::toString() { | 79 SkString SkDrawCommand::toString() { |
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
929 fDy = dy; | 931 fDy = dy; |
930 fDrawType = TRANSLATE; | 932 fDrawType = TRANSLATE; |
931 | 933 |
932 fInfo.push(SkObjectParser::ScalarToString(dx, "SkScalar dx: ")); | 934 fInfo.push(SkObjectParser::ScalarToString(dx, "SkScalar dx: ")); |
933 fInfo.push(SkObjectParser::ScalarToString(dy, "SkScalar dy: ")); | 935 fInfo.push(SkObjectParser::ScalarToString(dy, "SkScalar dy: ")); |
934 } | 936 } |
935 | 937 |
936 void SkTranslateCommand::execute(SkCanvas* canvas) { | 938 void SkTranslateCommand::execute(SkCanvas* canvas) { |
937 canvas->translate(fDx, fDy); | 939 canvas->translate(fDx, fDy); |
938 } | 940 } |
| 941 |
| 942 SkPushCullCommand::SkPushCullCommand(const SkRect& cullRect) |
| 943 : fCullRect(cullRect) { |
| 944 fDrawType = PUSH_CULL; |
| 945 fInfo.push(SkObjectParser::RectToString(cullRect)); |
| 946 } |
| 947 |
| 948 void SkPushCullCommand::execute(SkCanvas* canvas) { |
| 949 //FIXME: add visualization overlay. |
| 950 canvas->pushCull(fCullRect); |
| 951 } |
| 952 |
| 953 SkPopCullCommand::SkPopCullCommand() { |
| 954 fDrawType = POP_CULL; |
| 955 } |
| 956 |
| 957 void SkPopCullCommand::execute(SkCanvas* canvas) { |
| 958 canvas->popCull(); |
| 959 } |
OLD | NEW |