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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/filters/FETurbulence.cpp

Issue 2303703002: Revamp filter primitive region calculations for Filter Effects (Closed)
Patch Set: Baselines again; Manual for mac10.11-retina Created 4 years, 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org> 4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
6 * Copyright (C) 2010 Renata Hodovan <reni@inf.u-szeged.hu> 6 * Copyright (C) 2010 Renata Hodovan <reni@inf.u-szeged.hu>
7 * Copyright (C) 2011 Gabor Loki <loki@webkit.org> 7 * Copyright (C) 2011 Gabor Loki <loki@webkit.org>
8 * Copyright (C) 2013 Google Inc. All rights reserved. 8 * Copyright (C) 2013 Google Inc. All rights reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 bool FETurbulence::setStitchTiles(bool stitch) 121 bool FETurbulence::setStitchTiles(bool stitch)
122 { 122 {
123 if (m_stitchTiles == stitch) 123 if (m_stitchTiles == stitch)
124 return false; 124 return false;
125 m_stitchTiles = stitch; 125 m_stitchTiles = stitch;
126 return true; 126 return true;
127 } 127 }
128 128
129 sk_sp<SkShader> FETurbulence::createShader() const 129 sk_sp<SkShader> FETurbulence::createShader() const
130 { 130 {
131 const SkISize size = SkISize::Make(effectBoundaries().width(), effectBoundar ies().height()); 131 const SkISize size = SkISize::Make(
132 filterPrimitiveSubregion().width(),
133 filterPrimitiveSubregion().height());
132 // Frequency should be scaled by page zoom, but not by primitiveUnits. 134 // Frequency should be scaled by page zoom, but not by primitiveUnits.
133 // So we apply only the transform scale (as Filter::apply*Scale() do) 135 // So we apply only the transform scale (as Filter::apply*Scale() do)
134 // and not the target bounding box scale (as SVGFilter::apply*Scale() 136 // and not the target bounding box scale (as SVGFilter::apply*Scale()
135 // would do). Note also that we divide by the scale since this is 137 // would do). Note also that we divide by the scale since this is
136 // a frequency, not a period. 138 // a frequency, not a period.
137 float baseFrequencyX = m_baseFrequencyX / getFilter()->scale(); 139 float baseFrequencyX = m_baseFrequencyX / getFilter()->scale();
138 float baseFrequencyY = m_baseFrequencyY / getFilter()->scale(); 140 float baseFrequencyY = m_baseFrequencyY / getFilter()->scale();
139 return (type() == FETURBULENCE_TYPE_FRACTALNOISE) ? 141 return (type() == FETURBULENCE_TYPE_FRACTALNOISE) ?
140 SkPerlinNoiseShader::MakeFractalNoise(SkFloatToScalar(baseFrequencyX), 142 SkPerlinNoiseShader::MakeFractalNoise(SkFloatToScalar(baseFrequencyX),
141 SkFloatToScalar(baseFrequencyY), numOctaves(), SkFloatToScalar(seed( )), 143 SkFloatToScalar(baseFrequencyY), numOctaves(), SkFloatToScalar(seed( )),
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 FilterEffect::externalRepresentation(ts); 181 FilterEffect::externalRepresentation(ts);
180 ts << " type=\"" << type() << "\" " 182 ts << " type=\"" << type() << "\" "
181 << "baseFrequency=\"" << baseFrequencyX() << ", " << baseFrequencyY() << "\" " 183 << "baseFrequency=\"" << baseFrequencyX() << ", " << baseFrequencyY() << "\" "
182 << "seed=\"" << seed() << "\" " 184 << "seed=\"" << seed() << "\" "
183 << "numOctaves=\"" << numOctaves() << "\" " 185 << "numOctaves=\"" << numOctaves() << "\" "
184 << "stitchTiles=\"" << stitchTiles() << "\"]\n"; 186 << "stitchTiles=\"" << stitchTiles() << "\"]\n";
185 return ts; 187 return ts;
186 } 188 }
187 189
188 } // namespace blink 190 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698