OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkTwoPointConicalGradient.h" | 8 #include "SkTwoPointConicalGradient.h" |
9 #include "SkTwoPointConicalGradient_gpu.h" | 9 #include "SkTwoPointConicalGradient_gpu.h" |
10 | 10 |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 } | 254 } |
255 | 255 |
256 if (fDstToIndexClass != kPerspective_MatrixClass) { | 256 if (fDstToIndexClass != kPerspective_MatrixClass) { |
257 SkPoint srcPt; | 257 SkPoint srcPt; |
258 dstProc(fDstToIndex, SkIntToScalar(x) + SK_ScalarHalf, | 258 dstProc(fDstToIndex, SkIntToScalar(x) + SK_ScalarHalf, |
259 SkIntToScalar(y) + SK_ScalarHalf, &srcPt); | 259 SkIntToScalar(y) + SK_ScalarHalf, &srcPt); |
260 SkScalar dx, fx = srcPt.fX; | 260 SkScalar dx, fx = srcPt.fX; |
261 SkScalar dy, fy = srcPt.fY; | 261 SkScalar dy, fy = srcPt.fY; |
262 | 262 |
263 if (fDstToIndexClass == kFixedStepInX_MatrixClass) { | 263 if (fDstToIndexClass == kFixedStepInX_MatrixClass) { |
264 SkFixed fixedX, fixedY; | 264 const auto step = fDstToIndex.fixedStepInX(SkIntToScalar(y)); |
265 (void)fDstToIndex.fixedStepInX(SkIntToScalar(y), &fixedX, &fixedY); | 265 dx = step.fX; |
266 dx = SkFixedToScalar(fixedX); | 266 dy = step.fY; |
267 dy = SkFixedToScalar(fixedY); | |
268 } else { | 267 } else { |
269 SkASSERT(fDstToIndexClass == kLinear_MatrixClass); | 268 SkASSERT(fDstToIndexClass == kLinear_MatrixClass); |
270 dx = fDstToIndex.getScaleX(); | 269 dx = fDstToIndex.getScaleX(); |
271 dy = fDstToIndex.getSkewY(); | 270 dy = fDstToIndex.getSkewY(); |
272 } | 271 } |
273 | 272 |
274 TwoPtRadialContext rec(twoPointConicalGradient.fRec, fx, fy, dx, dy); | 273 TwoPtRadialContext rec(twoPointConicalGradient.fRec, fx, fy, dx, dy); |
275 (*shadeProc)(&rec, dstC, cache, toggle, count); | 274 (*shadeProc)(&rec, dstC, cache, toggle, count); |
276 } else { // perspective case | 275 } else { // perspective case |
277 SkScalar dstX = SkIntToScalar(x) + SK_ScalarHalf; | 276 SkScalar dstX = SkIntToScalar(x) + SK_ScalarHalf; |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 str->appendScalar(fCenter2.fY); | 388 str->appendScalar(fCenter2.fY); |
390 str->append(") radius2: "); | 389 str->append(") radius2: "); |
391 str->appendScalar(fRadius2); | 390 str->appendScalar(fRadius2); |
392 str->append(" "); | 391 str->append(" "); |
393 | 392 |
394 this->INHERITED::toString(str); | 393 this->INHERITED::toString(str); |
395 | 394 |
396 str->append(")"); | 395 str->append(")"); |
397 } | 396 } |
398 #endif | 397 #endif |
OLD | NEW |