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 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 | 432 |
433 size_t SkPerlinNoiseShader::contextSize() const { | 433 size_t SkPerlinNoiseShader::contextSize() const { |
434 return sizeof(PerlinNoiseShaderContext); | 434 return sizeof(PerlinNoiseShaderContext); |
435 } | 435 } |
436 | 436 |
437 SkPerlinNoiseShader::PerlinNoiseShaderContext::PerlinNoiseShaderContext( | 437 SkPerlinNoiseShader::PerlinNoiseShaderContext::PerlinNoiseShaderContext( |
438 const SkPerlinNoiseShader& shader, const ContextRec& rec) | 438 const SkPerlinNoiseShader& shader, const ContextRec& rec) |
439 : INHERITED(shader, rec) | 439 : INHERITED(shader, rec) |
440 { | 440 { |
441 SkMatrix newMatrix = *rec.fMatrix; | 441 SkMatrix newMatrix = *rec.fMatrix; |
442 newMatrix.postConcat(shader.getLocalMatrix()); | 442 newMatrix.preConcat(shader.getLocalMatrix()); |
| 443 if (rec.fLocalMatrix) { |
| 444 newMatrix.preConcat(*rec.fLocalMatrix); |
| 445 } |
443 SkMatrix invMatrix; | 446 SkMatrix invMatrix; |
444 if (!newMatrix.invert(&invMatrix)) { | 447 if (!newMatrix.invert(&invMatrix)) { |
445 invMatrix.reset(); | 448 invMatrix.reset(); |
446 } | 449 } |
447 // This (1,1) translation is due to WebKit's 1 based coordinates for the noi
se | 450 // This (1,1) translation is due to WebKit's 1 based coordinates for the noi
se |
448 // (as opposed to 0 based, usually). The same adjustment is in the setData()
function. | 451 // (as opposed to 0 based, usually). The same adjustment is in the setData()
function. |
449 newMatrix.postTranslate(SK_Scalar1, SK_Scalar1); | 452 newMatrix.postTranslate(SK_Scalar1, SK_Scalar1); |
450 newMatrix.postConcat(invMatrix); | 453 newMatrix.postConcat(invMatrix); |
451 newMatrix.postConcat(invMatrix); | 454 newMatrix.postConcat(invMatrix); |
452 fMatrix = newMatrix; | 455 fMatrix = newMatrix; |
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1366 str->append(" seed: "); | 1369 str->append(" seed: "); |
1367 str->appendScalar(fSeed); | 1370 str->appendScalar(fSeed); |
1368 str->append(" stitch tiles: "); | 1371 str->append(" stitch tiles: "); |
1369 str->append(fStitchTiles ? "true " : "false "); | 1372 str->append(fStitchTiles ? "true " : "false "); |
1370 | 1373 |
1371 this->INHERITED::toString(str); | 1374 this->INHERITED::toString(str); |
1372 | 1375 |
1373 str->append(")"); | 1376 str->append(")"); |
1374 } | 1377 } |
1375 #endif | 1378 #endif |
OLD | NEW |