| 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 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 918 } | 918 } |
| 919 | 919 |
| 920 SkSaveCommand::SkSaveCommand() | 920 SkSaveCommand::SkSaveCommand() |
| 921 : INHERITED(kSave_OpType) { | 921 : INHERITED(kSave_OpType) { |
| 922 } | 922 } |
| 923 | 923 |
| 924 void SkSaveCommand::execute(SkCanvas* canvas) const { | 924 void SkSaveCommand::execute(SkCanvas* canvas) const { |
| 925 canvas->save(); | 925 canvas->save(); |
| 926 } | 926 } |
| 927 | 927 |
| 928 SkSaveLayerCommand::SkSaveLayerCommand(const SkRect* bounds, const SkPaint* pain
t, | 928 SkSaveLayerCommand::SkSaveLayerCommand(const SkCanvas::SaveLayerRec& rec) |
| 929 SkCanvas::SaveFlags flags) | |
| 930 : INHERITED(kSaveLayer_OpType) { | 929 : INHERITED(kSaveLayer_OpType) { |
| 931 if (bounds) { | 930 if (rec.fBounds) { |
| 932 fBounds = *bounds; | 931 fBounds = *rec.fBounds; |
| 933 } else { | 932 } else { |
| 934 fBounds.setEmpty(); | 933 fBounds.setEmpty(); |
| 935 } | 934 } |
| 936 | 935 |
| 937 if (paint) { | 936 if (rec.fPaint) { |
| 938 fPaint = *paint; | 937 fPaint = *rec.fPaint; |
| 939 fPaintPtr = &fPaint; | 938 fPaintPtr = &fPaint; |
| 940 } else { | 939 } else { |
| 941 fPaintPtr = nullptr; | 940 fPaintPtr = nullptr; |
| 942 } | 941 } |
| 943 fFlags = flags; | 942 fSaveLayerFlags = rec.fSaveLayerFlags; |
| 944 | 943 |
| 945 if (bounds) { | 944 if (rec.fBounds) { |
| 946 fInfo.push(SkObjectParser::RectToString(*bounds, "Bounds: ")); | 945 fInfo.push(SkObjectParser::RectToString(*rec.fBounds, "Bounds: ")); |
| 947 } | 946 } |
| 948 if (paint) { | 947 if (rec.fPaint) { |
| 949 fInfo.push(SkObjectParser::PaintToString(*paint)); | 948 fInfo.push(SkObjectParser::PaintToString(*rec.fPaint)); |
| 950 } | 949 } |
| 951 fInfo.push(SkObjectParser::SaveFlagsToString(flags)); | 950 fInfo.push(SkObjectParser::SaveLayerFlagsToString(fSaveLayerFlags)); |
| 952 } | 951 } |
| 953 | 952 |
| 954 void SkSaveLayerCommand::execute(SkCanvas* canvas) const { | 953 void SkSaveLayerCommand::execute(SkCanvas* canvas) const { |
| 955 canvas->saveLayer(fBounds.isEmpty() ? nullptr : &fBounds, | 954 canvas->saveLayer(SkCanvas::SaveLayerRec(fBounds.isEmpty() ? nullptr : &fBou
nds, |
| 956 fPaintPtr, | 955 fPaintPtr, |
| 957 fFlags); | 956 fSaveLayerFlags)); |
| 958 } | 957 } |
| 959 | 958 |
| 960 void SkSaveLayerCommand::vizExecute(SkCanvas* canvas) const { | 959 void SkSaveLayerCommand::vizExecute(SkCanvas* canvas) const { |
| 961 canvas->save(); | 960 canvas->save(); |
| 962 } | 961 } |
| 963 | 962 |
| 964 SkSetMatrixCommand::SkSetMatrixCommand(const SkMatrix& matrix) | 963 SkSetMatrixCommand::SkSetMatrixCommand(const SkMatrix& matrix) |
| 965 : INHERITED(kSetMatrix_OpType) { | 964 : INHERITED(kSetMatrix_OpType) { |
| 966 fUserMatrix.reset(); | 965 fUserMatrix.reset(); |
| 967 fMatrix = matrix; | 966 fMatrix = matrix; |
| 968 | 967 |
| 969 fInfo.push(SkObjectParser::MatrixToString(matrix)); | 968 fInfo.push(SkObjectParser::MatrixToString(matrix)); |
| 970 } | 969 } |
| 971 | 970 |
| 972 void SkSetMatrixCommand::setUserMatrix(const SkMatrix& userMatrix) { | 971 void SkSetMatrixCommand::setUserMatrix(const SkMatrix& userMatrix) { |
| 973 fUserMatrix = userMatrix; | 972 fUserMatrix = userMatrix; |
| 974 } | 973 } |
| 975 | 974 |
| 976 void SkSetMatrixCommand::execute(SkCanvas* canvas) const { | 975 void SkSetMatrixCommand::execute(SkCanvas* canvas) const { |
| 977 SkMatrix temp = SkMatrix::Concat(fUserMatrix, fMatrix); | 976 SkMatrix temp = SkMatrix::Concat(fUserMatrix, fMatrix); |
| 978 canvas->setMatrix(temp); | 977 canvas->setMatrix(temp); |
| 979 } | 978 } |
| 980 | 979 |
| OLD | NEW |