| 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 #include "SkSweepGradient.h" | 9 #include "SkSweepGradient.h" |
| 10 | 10 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 int toggle = init_dither_toggle(x, y); | 85 int toggle = init_dither_toggle(x, y); |
| 86 SkPoint srcPt; | 86 SkPoint srcPt; |
| 87 | 87 |
| 88 if (fDstToIndexClass != kPerspective_MatrixClass) { | 88 if (fDstToIndexClass != kPerspective_MatrixClass) { |
| 89 proc(matrix, SkIntToScalar(x) + SK_ScalarHalf, | 89 proc(matrix, SkIntToScalar(x) + SK_ScalarHalf, |
| 90 SkIntToScalar(y) + SK_ScalarHalf, &srcPt); | 90 SkIntToScalar(y) + SK_ScalarHalf, &srcPt); |
| 91 SkScalar dx, fx = srcPt.fX; | 91 SkScalar dx, fx = srcPt.fX; |
| 92 SkScalar dy, fy = srcPt.fY; | 92 SkScalar dy, fy = srcPt.fY; |
| 93 | 93 |
| 94 if (fDstToIndexClass == kFixedStepInX_MatrixClass) { | 94 if (fDstToIndexClass == kFixedStepInX_MatrixClass) { |
| 95 SkFixed storage[2]; | 95 const auto step = matrix.fixedStepInX(SkIntToScalar(y) + SK_ScalarHa
lf); |
| 96 (void)matrix.fixedStepInX(SkIntToScalar(y) + SK_ScalarHalf, | 96 dx = step.fX; |
| 97 &storage[0], &storage[1]); | 97 dy = step.fY; |
| 98 dx = SkFixedToScalar(storage[0]); | |
| 99 dy = SkFixedToScalar(storage[1]); | |
| 100 } else { | 98 } else { |
| 101 SkASSERT(fDstToIndexClass == kLinear_MatrixClass); | 99 SkASSERT(fDstToIndexClass == kLinear_MatrixClass); |
| 102 dx = matrix.getScaleX(); | 100 dx = matrix.getScaleX(); |
| 103 dy = matrix.getSkewY(); | 101 dy = matrix.getSkewY(); |
| 104 } | 102 } |
| 105 | 103 |
| 106 for (; count > 0; --count) { | 104 for (; count > 0; --count) { |
| 107 *dstC++ = cache[toggle + SkATan2_255(fy, fx)]; | 105 *dstC++ = cache[toggle + SkATan2_255(fy, fx)]; |
| 108 fx += dx; | 106 fx += dx; |
| 109 fy += dy; | 107 fy += dy; |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 str->appendScalar(fCenter.fX); | 261 str->appendScalar(fCenter.fX); |
| 264 str->append(", "); | 262 str->append(", "); |
| 265 str->appendScalar(fCenter.fY); | 263 str->appendScalar(fCenter.fY); |
| 266 str->append(") "); | 264 str->append(") "); |
| 267 | 265 |
| 268 this->INHERITED::toString(str); | 266 this->INHERITED::toString(str); |
| 269 | 267 |
| 270 str->append(")"); | 268 str->append(")"); |
| 271 } | 269 } |
| 272 #endif | 270 #endif |
| OLD | NEW |