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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 yScale *= input.height() / (float) input.width(); | 122 yScale *= input.height() / (float) input.width(); |
123 } else { | 123 } else { |
124 xScale *= input.width() / (float) input.height(); | 124 xScale *= input.width() / (float) input.height(); |
125 } | 125 } |
126 | 126 |
127 SkRect dst = SkRect::MakeXYWH(SK_Scalar1, SK_Scalar1, | 127 SkRect dst = SkRect::MakeXYWH(SK_Scalar1, SK_Scalar1, |
128 xScale * input.width(), | 128 xScale * input.width(), |
129 yScale * input.height()); | 129 yScale * input.height()); |
130 | 130 |
131 canvas->clear(0xFFFFFFFF); | 131 canvas->clear(0xFFFFFFFF); |
132 canvas->drawBitmapRect(input, dst); | 132 canvas->drawBitmapRect(input, NULL, dst); |
133 | 133 |
134 if (srcRect) { | 134 if (srcRect) { |
135 SkRect r = SkRect::MakeLTRB(srcRect->fLeft * xScale + SK_Scalar1, | 135 SkRect r = SkRect::MakeLTRB(srcRect->fLeft * xScale + SK_Scalar1, |
136 srcRect->fTop * yScale + SK_Scalar1, | 136 srcRect->fTop * yScale + SK_Scalar1, |
137 srcRect->fRight * xScale + SK_Scalar1, | 137 srcRect->fRight * xScale + SK_Scalar1, |
138 srcRect->fBottom * yScale + SK_Scalar1); | 138 srcRect->fBottom * yScale + SK_Scalar1); |
139 SkPaint p; | 139 SkPaint p; |
140 p.setColor(SK_ColorRED); | 140 p.setColor(SK_ColorRED); |
141 p.setStyle(SkPaint::kStroke_Style); | 141 p.setStyle(SkPaint::kStroke_Style); |
142 | 142 |
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
887 | 887 |
888 void SkSetMatrixCommand::setUserMatrix(const SkMatrix& userMatrix) { | 888 void SkSetMatrixCommand::setUserMatrix(const SkMatrix& userMatrix) { |
889 fUserMatrix = userMatrix; | 889 fUserMatrix = userMatrix; |
890 } | 890 } |
891 | 891 |
892 void SkSetMatrixCommand::execute(SkCanvas* canvas) const { | 892 void SkSetMatrixCommand::execute(SkCanvas* canvas) const { |
893 SkMatrix temp = SkMatrix::Concat(fUserMatrix, fMatrix); | 893 SkMatrix temp = SkMatrix::Concat(fUserMatrix, fMatrix); |
894 canvas->setMatrix(temp); | 894 canvas->setMatrix(temp); |
895 } | 895 } |
896 | 896 |
OLD | NEW |