OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkDither.h" | 8 #include "SkDither.h" |
9 #include "SkPerlinNoiseShader.h" | 9 #include "SkPerlinNoiseShader.h" |
10 #include "SkColorFilter.h" | 10 #include "SkColorFilter.h" |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 turbulenceFunctionResult = SkScalarMul(turbulenceFunctionResult, | 443 turbulenceFunctionResult = SkScalarMul(turbulenceFunctionResult, |
444 SkScalarDiv(SkIntToScalar(getPaintAlpha()), SkIntToScalar(255))); | 444 SkScalarDiv(SkIntToScalar(getPaintAlpha()), SkIntToScalar(255))); |
445 } | 445 } |
446 | 446 |
447 // Clamp result | 447 // Clamp result |
448 return SkScalarPin(turbulenceFunctionResult, 0, SK_Scalar1); | 448 return SkScalarPin(turbulenceFunctionResult, 0, SK_Scalar1); |
449 } | 449 } |
450 | 450 |
451 SkPMColor SkPerlinNoiseShader::shade(const SkPoint& point, StitchData& stitchDat
a) { | 451 SkPMColor SkPerlinNoiseShader::shade(const SkPoint& point, StitchData& stitchDat
a) { |
452 SkMatrix matrix = fMatrix; | 452 SkMatrix matrix = fMatrix; |
| 453 matrix.postConcat(getLocalMatrix()); |
453 SkMatrix invMatrix; | 454 SkMatrix invMatrix; |
454 if (!matrix.invert(&invMatrix)) { | 455 if (!matrix.invert(&invMatrix)) { |
455 invMatrix.reset(); | 456 invMatrix.reset(); |
456 } else { | 457 } else { |
457 invMatrix.postConcat(invMatrix); // Square the matrix | 458 invMatrix.postConcat(invMatrix); // Square the matrix |
458 } | 459 } |
459 // This (1,1) translation is due to WebKit's 1 based coordinates for the noi
se | 460 // This (1,1) translation is due to WebKit's 1 based coordinates for the noi
se |
460 // (as opposed to 0 based, usually). The same adjustment is in the setData()
function. | 461 // (as opposed to 0 based, usually). The same adjustment is in the setData()
function. |
461 matrix.postTranslate(SK_Scalar1, SK_Scalar1); | 462 matrix.postTranslate(SK_Scalar1, SK_Scalar1); |
462 SkPoint newPoint; | 463 SkPoint newPoint; |
(...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1385 str->append(" seed: "); | 1386 str->append(" seed: "); |
1386 str->appendScalar(fSeed); | 1387 str->appendScalar(fSeed); |
1387 str->append(" stitch tiles: "); | 1388 str->append(" stitch tiles: "); |
1388 str->append(fStitchTiles ? "true " : "false "); | 1389 str->append(fStitchTiles ? "true " : "false "); |
1389 | 1390 |
1390 this->INHERITED::toString(str); | 1391 this->INHERITED::toString(str); |
1391 | 1392 |
1392 str->append(")"); | 1393 str->append(")"); |
1393 } | 1394 } |
1394 #endif | 1395 #endif |
OLD | NEW |