Changeset 224996 in webkit
- Timestamp:
- Nov 17, 2017, 3:36:24 PM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r224995 r224996 1 2017-11-17 Simon Fraser <simon.fraser@apple.com> 2 3 Don't invert a matrix for every channel of every pixel of an FETurbulence filter 4 https://bugs.webkit.org/show_bug.cgi?id=179829 5 6 Reviewed by Dean Jackson. 7 8 FETurbulence::fillRegion() called filter().mapAbsolutePointToLocalPoint(point) for each 9 of the 4 channels on a point, which is stupid. 10 11 Fix to invert the matrix once, and then map the point once for each pixel. This reduces 12 the time in fillRegion() function by about 30%. 13 14 * platform/graphics/filters/FETurbulence.cpp: 15 (WebCore::FETurbulence::fillRegion): 16 * platform/graphics/filters/Filter.h: 17 (WebCore::Filter::absoluteTransform const): 18 (WebCore::Filter::mapAbsolutePointToLocalPoint const): Deleted. 19 1 20 2017-11-17 Brent Fulgham <bfulgham@apple.com> 2 21 -
trunk/Source/WebCore/platform/graphics/filters/FETurbulence.cpp
r224977 r224996 65 65 } 66 66 67 TurbulenceType FETurbulence::type() const68 {69 return m_type;70 }71 72 67 bool FETurbulence::setType(TurbulenceType type) 73 68 { … … 78 73 } 79 74 80 float FETurbulence::baseFrequencyY() const81 {82 return m_baseFrequencyY;83 }84 85 75 bool FETurbulence::setBaseFrequencyY(float baseFrequencyY) 86 76 { … … 91 81 } 92 82 93 float FETurbulence::baseFrequencyX() const94 {95 return m_baseFrequencyX;96 }97 98 83 bool FETurbulence::setBaseFrequencyX(float baseFrequencyX) 99 84 { … … 104 89 } 105 90 106 float FETurbulence::seed() const107 {108 return m_seed;109 }110 111 91 bool FETurbulence::setSeed(float seed) 112 92 { … … 117 97 } 118 98 119 int FETurbulence::numOctaves() const120 {121 return m_numOctaves;122 }123 124 99 bool FETurbulence::setNumOctaves(int numOctaves) 125 100 { … … 128 103 m_numOctaves = numOctaves; 129 104 return true; 130 }131 132 bool FETurbulence::stitchTiles() const133 {134 return m_stitchTiles;135 105 } 136 106 … … 335 305 { 336 306 IntRect filterRegion = absolutePaintRect(); 337 IntPoint point(0, filterRegion.y() + startY);307 FloatPoint point(0, filterRegion.y() + startY); 338 308 int indexOfPixelChannel = startY * (filterRegion.width() << 2); 339 int channel;340 309 StitchData stitchData; 310 AffineTransform inverseTransfrom = filter().absoluteTransform().inverse().value_or(AffineTransform()); 341 311 342 312 for (int y = startY; y < endY; ++y) { … … 345 315 for (int x = 0; x < filterRegion.width(); ++x) { 346 316 point.setX(point.x() + 1); 347 for (channel = 0; channel < 4; ++channel, ++indexOfPixelChannel) 348 pixelArray->set(indexOfPixelChannel, calculateTurbulenceValueForPoint(channel, paintingData, stitchData, filter().mapAbsolutePointToLocalPoint(point))); 317 FloatPoint localPoint = inverseTransfrom.mapPoint(point); 318 for (int channel = 0; channel < 4; ++channel, ++indexOfPixelChannel) 319 pixelArray->set(indexOfPixelChannel, calculateTurbulenceValueForPoint(channel, paintingData, stitchData, localPoint)); 349 320 } 350 321 } -
trunk/Source/WebCore/platform/graphics/filters/FETurbulence.h
r224977 r224996 40 40 static Ref<FETurbulence> create(Filter&, TurbulenceType, float, float, int, float, bool); 41 41 42 TurbulenceType type() const ;42 TurbulenceType type() const { return m_type; } 43 43 bool setType(TurbulenceType); 44 44 45 float baseFrequencyY() const ;45 float baseFrequencyY() const { return m_baseFrequencyX; } 46 46 bool setBaseFrequencyY(float); 47 47 48 float baseFrequencyX() const ;48 float baseFrequencyX() const { return m_baseFrequencyY; } 49 49 bool setBaseFrequencyX(float); 50 50 51 float seed() const ;51 float seed() const { return m_seed; } 52 52 bool setSeed(float); 53 53 54 int numOctaves() const ;54 int numOctaves() const { return m_numOctaves; } 55 55 bool setNumOctaves(int); 56 56 57 bool stitchTiles() const ;57 bool stitchTiles() const { return m_stitchTiles; } 58 58 bool setStitchTiles(bool); 59 59 -
trunk/Source/WebCore/platform/graphics/filters/Filter.h
r223728 r224996 44 44 45 45 const AffineTransform& absoluteTransform() const { return m_absoluteTransform; } 46 FloatPoint mapAbsolutePointToLocalPoint(const FloatPoint& point) const { return m_absoluteTransform.inverse().value_or(AffineTransform()).mapPoint(point); }47 46 48 47 RenderingMode renderingMode() const { return m_renderingMode; }
Note:
See TracChangeset
for help on using the changeset viewer.