Changeset 148201 in webkit
- Timestamp:
- Apr 11, 2013 7:36:22 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r148200 r148201 1 2013-04-11 Arvid Nilsson <anilsson@rim.com> 2 3 [BlackBerry][CSS Filters] Blur filter fails to recompute blur size when layer size changes 4 https://bugs.webkit.org/show_bug.cgi?id=114272 5 6 Reviewed by Rob Buis. 7 8 Blur appeared blocky or pixelated when surface changed size after 9 creating the filter actions. The initial image size was used to 10 determine the blur size (expressed in texture coordinate system). 11 Fixed by recomputing the blur size when the surface size changes, using 12 a new Uniform1f subclass that can use a functor to compute the uniform 13 value per-frame. 14 15 This fixes css3/filters/effect-blur-hw.html. This can only be verified 16 by manual inspection because the BlackBerry port is not currently using 17 pixel tests. 18 19 PR 323730 20 21 * platform/graphics/blackberry/LayerFilterRenderer.cpp: 22 (WebCore): 23 (SurfaceFunctor): 24 (WebCore::SurfaceFunctor::SurfaceFunctor): 25 (InverseSurfaceWidth): 26 (WebCore::InverseSurfaceWidth::InverseSurfaceWidth): 27 (WebCore::InverseSurfaceWidth::operator()): 28 (InverseSurfaceHeight): 29 (WebCore::InverseSurfaceHeight::InverseSurfaceHeight): 30 (WebCore::LayerFilterRenderer::actionsForOperations): 31 * platform/graphics/blackberry/LayerFilterRenderer.h: 32 (Uniform1f): 33 (WebCore): 34 (Uniform1fWithFunctor): 35 (WebCore::Uniform1fWithFunctor::create): 36 (WebCore::Uniform1fWithFunctor::Uniform1fWithFunctor): 37 (WebCore::Uniform1fWithFunctor::apply): 38 (WebCore::Uniform1f::createWithFunctor): 39 1 40 2013-04-11 Arvid Nilsson <anilsson@rim.com> 2 41 -
trunk/Source/WebCore/platform/graphics/blackberry/LayerFilterRenderer.cpp
r148192 r148201 38 38 39 39 namespace WebCore { 40 41 class SurfaceFunctor { 42 public: 43 SurfaceFunctor(LayerRendererSurface* surface) 44 : m_surface(surface) 45 { 46 } 47 48 protected: 49 LayerRendererSurface* m_surface; 50 }; 51 52 class InverseSurfaceWidth : public SurfaceFunctor { 53 public: 54 InverseSurfaceWidth(LayerRendererSurface* surface) : SurfaceFunctor(surface) { } 55 56 float operator() () { return 1.0f / m_surface->size().width(); } 57 }; 58 59 class InverseSurfaceHeight : public SurfaceFunctor { 60 public: 61 InverseSurfaceHeight(LayerRendererSurface* surface) : SurfaceFunctor(surface) { } 62 63 float operator() () { return 1.0f / m_surface->size().height(); } 64 }; 40 65 41 66 static int operationTypeToProgramID(const FilterOperation::OperationType& t) … … 602 627 // BLUR Y: 603 628 ret.last()->appendParameter(Uniform1f::create(m_amountLocation[LayerData::CSSFilterShaderBlurY], amount)); 604 ret.last()->appendParameter(Uniform1f::create(m_blurAmountLocation[0] 605 , 1.0f / float(surface->size().height()))); 629 ret.last()->appendParameter(Uniform1f::createWithFunctor(m_blurAmountLocation[0], InverseSurfaceHeight(surface))); 606 630 607 631 // BLUR X: 608 632 ret.append(LayerFilterRendererAction::create(LayerData::CSSFilterShaderBlurX)); 609 633 ret.last()->appendParameter(Uniform1f::create(m_amountLocation[LayerData::CSSFilterShaderBlurX], amount)); 610 ret.last()->appendParameter(Uniform1f::create(m_blurAmountLocation[1] 611 , 1.0f / float(surface->size().width()))); 634 ret.last()->appendParameter(Uniform1f::createWithFunctor(m_blurAmountLocation[1], InverseSurfaceWidth(surface))); 612 635 613 636 } … … 635 658 ret.last()->appendParameter(Uniform1f::create(m_amountLocation[LayerData::CSSFilterShaderBlurY] 636 659 , dsfo.stdDeviation())); 637 ret.last()->appendParameter(Uniform1f::create(m_blurAmountLocation[0] 638 , 1.0f / float(surface->size().height()))); 660 ret.last()->appendParameter(Uniform1f::createWithFunctor(m_blurAmountLocation[0], InverseSurfaceHeight(surface))); 639 661 640 662 // BLUR X … … 642 664 ret.last()->appendParameter(Uniform1f::create(m_amountLocation[LayerData::CSSFilterShaderBlurX] 643 665 , dsfo.stdDeviation())); 644 ret.last()->appendParameter(Uniform1f::create(m_blurAmountLocation[1] 645 , 1.0f / float(surface->size().width()))); 666 ret.last()->appendParameter(Uniform1f::createWithFunctor(m_blurAmountLocation[1], InverseSurfaceWidth(surface))); 646 667 647 668 // Repaint original image -
trunk/Source/WebCore/platform/graphics/blackberry/LayerFilterRenderer.h
r148129 r148201 70 70 static PassRefPtr<Uniform> create(int location, float val); 71 71 72 template<typename Functor> 73 static PassRefPtr<Uniform> createWithFunctor(int location, Functor); 74 72 75 protected: 73 76 Uniform1f(int location, float val); 74 77 75 private: 76 virtual void apply(); 78 virtual void apply(); 79 77 80 float m_val; 78 81 }; 82 83 template<typename Functor> 84 class Uniform1fWithFunctor : public Uniform1f { 85 public: 86 static PassRefPtr<Uniform> create(int location, Functor functor) 87 { 88 return adoptRef(new Uniform1fWithFunctor(location, functor)); 89 } 90 91 protected: 92 Uniform1fWithFunctor(int location, Functor functor) 93 : Uniform1f(location, 0) 94 , m_functor(functor) 95 { 96 } 97 98 virtual void apply() 99 { 100 m_val = m_functor(); 101 Uniform1f::apply(); 102 } 103 104 Functor m_functor; 105 }; 106 107 template<typename Functor> 108 inline PassRefPtr<Uniform> Uniform1f::createWithFunctor(int location, Functor functor) 109 { 110 return Uniform1fWithFunctor<Functor>::create(location, functor); 111 } 79 112 80 113 class Uniform1i : public Uniform {
Note: See TracChangeset
for help on using the changeset viewer.