Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Side by Side Diff: src/effects/SkPerlinNoiseShader.cpp

Issue 184973007: Fix CTM scaling and clipping of SkRectShaderImageFilter. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Leanr ot ytpe Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « gm/imagefiltersscaled.cpp ('k') | src/effects/SkRectShaderImageFilter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « gm/imagefiltersscaled.cpp ('k') | src/effects/SkRectShaderImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698